-
Notifications
You must be signed in to change notification settings - Fork 1
/
Save.cs
32 lines (28 loc) · 1.01 KB
/
Save.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.IO;
using UnityEngine.UI;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
namespace TNHBGLoader
{
public class Save
{
public string LastLoadedBank { get; set; }
public string LastLoadedAnnouncer { get; set; }
public string[] LastLoadedVls { get; set; }
public string[] LastLoadedVlsSets { get; set; }
public void Write()
{
string save = Path.Combine(Directory.GetCurrentDirectory(), "lastloaded.yaml");
var _serializer = new SerializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance).Build();
var yamlfest = _serializer.Serialize(this);
File.WriteAllText(yamlfest, save);
}
public static Save Read()
{
string save = Path.Combine(Directory.GetCurrentDirectory(), "lastloaded.yaml");
var _deserializer = new DeserializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance).Build();
var yamlfest = _deserializer.Deserialize<Save>(File.ReadAllText(save));
return yamlfest;
}
}
}