summaryrefslogtreecommitdiff
path: root/grapher/Models/Serialized/RawAccelSettings.cs
diff options
context:
space:
mode:
authorJacobPalecki <[email protected]>2020-08-31 23:03:46 -0700
committerGitHub <[email protected]>2020-08-31 23:03:46 -0700
commit471fe599bab6ba0632ddd1dacd20c7fc42db0eee (patch)
tree90a82ee14dbb112621657efbd2523ed35f59d154 /grapher/Models/Serialized/RawAccelSettings.cs
parentMerge pull request #16 from JacobPalecki/Misc (diff)
parentadd independent xy accel to driver (diff)
downloadrawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.tar.xz
rawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.zip
Merge pull request #17 from a1xd/indep
Indep
Diffstat (limited to 'grapher/Models/Serialized/RawAccelSettings.cs')
-rw-r--r--grapher/Models/Serialized/RawAccelSettings.cs25
1 files changed, 10 insertions, 15 deletions
diff --git a/grapher/Models/Serialized/RawAccelSettings.cs b/grapher/Models/Serialized/RawAccelSettings.cs
index 21a7f0c..7aed917 100644
--- a/grapher/Models/Serialized/RawAccelSettings.cs
+++ b/grapher/Models/Serialized/RawAccelSettings.cs
@@ -24,17 +24,16 @@ namespace grapher.Models.Serialized
public RawAccelSettings() { }
public RawAccelSettings(
- ManagedAccel managedAccel,
+ DriverSettings accelSettings,
GUISettings guiSettings)
{
- AccelerationSettings = new modifier_args(managedAccel);
+ AccelerationSettings = accelSettings;
GUISettings = guiSettings;
}
-
public GUISettings GUISettings { get; set; }
- public modifier_args AccelerationSettings { get; set; }
+ public DriverSettings AccelerationSettings { get; set; }
public static RawAccelSettings Load()
{
@@ -42,23 +41,19 @@ namespace grapher.Models.Serialized
}
public static RawAccelSettings Load(string file)
- {
- if (!Exists(file))
+ {
+ try
{
- throw new Exception($"Settings file does not exist at {file}");
+ return JsonConvert.DeserializeObject<RawAccelSettings>(File.ReadAllText(file), SerializerSettings);
}
-
- RawAccelSettings deserializedSettings;
- try
+ catch (FileNotFoundException e)
{
- deserializedSettings = JsonConvert.DeserializeObject<RawAccelSettings>(File.ReadAllText(file), SerializerSettings);
+ throw new FileNotFoundException($"Settings file does not exist at {file}", e);
}
- catch(Exception e)
+ catch (JsonSerializationException e)
{
- throw new Exception($"Settings file at {file} does not contain valid Raw Accel Settings.", e);
+ throw new JsonSerializationException($"Settings file at {file} does not contain valid Raw Accel Settings.", e);
}
-
- return deserializedSettings;
}
public static bool Exists()