This repository was archived by the owner on May 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSave.cs
More file actions
53 lines (44 loc) · 1.39 KB
/
Save.cs
File metadata and controls
53 lines (44 loc) · 1.39 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.IO;
using Tomlet;
using Tomlet.Attributes;
namespace FC_AP;
internal static class Save
{
internal static Data Settings { get; private set; }
public static void Load()
{
if (!File.Exists(Path.Combine("UserData", "FC AP.cfg")))
{
var defaultConfig = TomletMain.TomlStringFrom(new Data(true, true, true));
File.WriteAllText(Path.Combine("UserData", "FC AP.cfg"), defaultConfig);
}
var data = File.ReadAllText(Path.Combine("UserData", "FC AP.cfg"));
try
{
Settings = TomletMain.To<Data>(data);
}
catch
{
File.Delete(Path.Combine("UserData", "FC AP.cfg"));
Load();
}
}
}
public class Data
{
[TomlPrecedingComment("Whether delete FC indicator when missing a collectable notes")]
internal readonly bool CollectableMissEnabled;
[TomlPrecedingComment("Whether delete FC indicator when missing a ghost")]
internal readonly bool GhostMissEnabled;
[TomlPrecedingComment("Whether the FC AP indicator is enabled")]
internal bool IndicatorEnabled;
public Data()
{
}
internal Data(bool ghostMissEnabled, bool collectableMissEnabled, bool indicatorEnabled)
{
CollectableMissEnabled = collectableMissEnabled;
GhostMissEnabled = ghostMissEnabled;
IndicatorEnabled = indicatorEnabled;
}
}