-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfiguration.cs
More file actions
44 lines (31 loc) · 1.07 KB
/
Configuration.cs
File metadata and controls
44 lines (31 loc) · 1.07 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
using System.Text.Json;
namespace CombatCursorContainment;
public sealed class Configuration
{
public bool EnableLocking { get; set; } = true;
public bool DoNotLockIfDead { get; set; } = false;
public bool DoNotLockIfOutsideDuty { get; set; } = false;
public bool DoNotLockDuringCutscene { get; set; } = false;
public bool DoNotLockDuringTransition { get; set; } = false;
public bool DoNotLockIfWeaponSheathed { get; set; } = false;
public bool DoNotLockIfMounted { get; set; } = false;
public bool DoNotLockIfGathererCrafter { get; set; } = false;
public static Configuration Load()
{
if (!File.Exists(Services.PluginInterface.ConfigFile.FullName))
{
return new Configuration();
}
var bytes = File.ReadAllBytes(Services.PluginInterface.ConfigFile.FullName);
return JsonSerializer.Deserialize<Configuration>(bytes) ?? new Configuration();
}
public static void Save(Configuration config)
{
config.Save();
}
public void Save()
{
var str = JsonSerializer.Serialize(this);
File.WriteAllText(Services.PluginInterface.ConfigFile.FullName, str);
}
}