summaryrefslogtreecommitdiff
path: root/grapher/Models/Serialized/GUISettings.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-04-06 01:21:42 -0400
committera1xd <[email protected]>2021-04-06 01:21:42 -0400
commit7c1f14845bc948e9ea25908e96099203d9433a69 (patch)
treeeadfae6ec0a775a35c29807bde3c20be8160e034 /grapher/Models/Serialized/GUISettings.cs
parentLUT text layout (diff)
downloadrawaccel-7c1f14845bc948e9ea25908e96099203d9433a69.tar.xz
rawaccel-7c1f14845bc948e9ea25908e96099203d9433a69.zip
update wrapper + writer to handle lut
grapher is building but applying options still broken for the most part
Diffstat (limited to 'grapher/Models/Serialized/GUISettings.cs')
-rw-r--r--grapher/Models/Serialized/GUISettings.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/grapher/Models/Serialized/GUISettings.cs b/grapher/Models/Serialized/GUISettings.cs
index bb35055..93d56de 100644
--- a/grapher/Models/Serialized/GUISettings.cs
+++ b/grapher/Models/Serialized/GUISettings.cs
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System;
+using System.IO;
namespace grapher.Models.Serialized
{
@@ -65,6 +66,32 @@ namespace grapher.Models.Serialized
AutoWriteToDriverOnStartup.GetHashCode();
}
+ public void Save()
+ {
+ File.WriteAllText(Constants.GuiConfigFileName, JsonConvert.SerializeObject(this));
+ }
+
+ public static GUISettings MaybeLoad()
+ {
+ GUISettings settings = null;
+
+ try
+ {
+ settings = JsonConvert.DeserializeObject<GUISettings>(
+ File.ReadAllText(Constants.GuiConfigFileName));
+ }
+ catch (Exception ex)
+ {
+ if (!(ex is JsonException || ex is FileNotFoundException))
+ {
+ throw;
+ }
+ }
+
+ return settings;
+ }
+
#endregion Methods
+
}
}