summaryrefslogtreecommitdiff
path: root/grapher/Models/Serialized/GUISettings.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-07-05 23:33:41 -0400
committera1xd <[email protected]>2021-07-05 23:33:41 -0400
commit31efc792f5895d7ef3533390875de3c480add996 (patch)
tree8db5b16a88f50448cb525ba8ae56801985294f63 /grapher/Models/Serialized/GUISettings.cs
parentMerge pull request #87 from matthewstrasiotto/streamer_mode (diff)
parentHandle power\exponent correctly in GUI (diff)
downloadrawaccel-31efc792f5895d7ef3533390875de3c480add996.tar.xz
rawaccel-31efc792f5895d7ef3533390875de3c480add996.zip
merge lut2
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 a4eb627..e7b67ba 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
{
@@ -70,6 +71,32 @@ namespace grapher.Models.Serialized
StreamingMode.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
+
}
}