summaryrefslogtreecommitdiff
path: root/writer
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-04-01 01:51:31 -0400
committera1xd <[email protected]>2021-04-01 01:51:31 -0400
commit14bde56daf188bfc027dc8ead5b45ec0aa1109d6 (patch)
tree6c674efea62c4e945e4d8ed3e947189742486015 /writer
parentrefactor lut/motivity (diff)
downloadrawaccel-14bde56daf188bfc027dc8ead5b45ec0aa1109d6.tar.xz
rawaccel-14bde56daf188bfc027dc8ead5b45ec0aa1109d6.zip
update rest
grapher is still broken refactored io / error handling a bit
Diffstat (limited to 'writer')
-rw-r--r--writer/Program.cs38
-rw-r--r--writer/Properties/AssemblyInfo.cs4
2 files changed, 12 insertions, 30 deletions
diff --git a/writer/Program.cs b/writer/Program.cs
index 37e384c..d381c16 100644
--- a/writer/Program.cs
+++ b/writer/Program.cs
@@ -16,27 +16,13 @@ namespace writer
MessageBox.Show(msg, "Raw Accel writer");
}
- static void Send(JToken settingsToken)
- {
- var settings = settingsToken.ToObject<DriverSettings>();
-
- var errors = DriverInterop.GetSettingsErrors(settings);
- if (errors.Empty())
- {
- DriverInterop.Write(settings);
- return;
- }
-
- Show($"Bad settings:\n\n{errors}");
- }
-
static void Main(string[] args)
{
try
{
- VersionHelper.ValidateAndGetDriverVersion(typeof(Program).Assembly.GetName().Version);
+ VersionHelper.ValidOrThrow();
}
- catch (VersionException e)
+ catch (InteropException e)
{
Show(e.Message);
return;
@@ -48,23 +34,19 @@ namespace writer
return;
}
- if (!File.Exists(args[0]))
- {
- Show($"Settings file not found at {args[0]}");
- return;
- }
-
try
{
- var JO = JObject.Parse(File.ReadAllText(args[0]));
+ var settings = DriverSettings.FromFile(args[0]);
+ var errors = new SettingsErrors(settings);
- if (JO.ContainsKey(DriverSettings.Key))
+ if (errors.Empty())
{
- Send(JO[DriverSettings.Key]);
- return;
+ new ManagedAccel(settings).Activate();
+ }
+ else
+ {
+ Show($"Bad settings:\n\n{errors}");
}
-
- Send(JO);
}
catch (JsonException e)
{
diff --git a/writer/Properties/AssemblyInfo.cs b/writer/Properties/AssemblyInfo.cs
index fc6a1ca..7f47c6d 100644
--- a/writer/Properties/AssemblyInfo.cs
+++ b/writer/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion(RawAccelVersion.value)]
-[assembly: AssemblyFileVersion(RawAccelVersion.value)]
+[assembly: AssemblyVersion(VersionHelper.VersionString)]
+[assembly: AssemblyFileVersion(VersionHelper.VersionString)] \ No newline at end of file