summaryrefslogtreecommitdiff
path: root/grapher/Models/Serialized/RawAccelSettings.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-08-31 19:41:21 -0400
committera1xd <[email protected]>2020-08-31 19:41:21 -0400
commit9010cc593af419dd824dba0ade6a2022aea6143f (patch)
tree90a82ee14dbb112621657efbd2523ed35f59d154 /grapher/Models/Serialized/RawAccelSettings.cs
parentclean up wrapper, minimize heap alloc (diff)
downloadrawaccel-9010cc593af419dd824dba0ade6a2022aea6143f.tar.xz
rawaccel-9010cc593af419dd824dba0ade6a2022aea6143f.zip
add independent xy accel to driver
other changes: modifier_args type name is now settings, which is now the type passed in driver ioctl remove most settings/args verification from driver, plan to let gui handle most of it add another accel arg, rate, which is used to set the 'accel' parameter of types which call exp (nat/sig), might want to cap it add (update) serializable DriverSettings (ModifierArgs) class to gui and static methods for interop remove properties from ManagedAccel, its now just a black box for accessing modifier methods add exception handling in wrapper_io to throw proper managed types change SettingsManager::Startup to make a new settings file if an error occurs during deserialization change structure of accel types; how offset and weight are applied now depend on additivity of types remove tagged_union and add a handrolled variant/visit impl AccelGui::UpdateActiveValueLabels currently broken for caps and a few other args remove gui default layout and initial natural accel setup cli not updated
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()