summaryrefslogtreecommitdiff
path: root/writer
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-12-05 21:28:08 -0500
committerGitHub <[email protected]>2020-12-05 21:28:08 -0500
commitc8503654da5bc40a129e58914549cd394349d059 (patch)
treee4760c579597d0e292c7b03dff95d19bb8f3c750 /writer
parentMerge pull request #45 from JacobPalecki/fix (diff)
parentupdate signed, add installers (diff)
downloadrawaccel-c8503654da5bc40a129e58914549cd394349d059.tar.xz
rawaccel-c8503654da5bc40a129e58914549cd394349d059.zip
Merge pull request #46 from a1xd/1.3
Diffstat (limited to 'writer')
-rw-r--r--writer/Program.cs41
-rw-r--r--writer/Properties/AssemblyInfo.cs10
-rw-r--r--writer/writer.csproj1
3 files changed, 29 insertions, 23 deletions
diff --git a/writer/Program.cs b/writer/Program.cs
index 2d4128f..37e384c 100644
--- a/writer/Program.cs
+++ b/writer/Program.cs
@@ -1,15 +1,21 @@
-using Microsoft.CSharp.RuntimeBinder;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
+using System.Windows.Forms;
namespace writer
{
class Program
{
+
+ static void Show(string msg)
+ {
+ MessageBox.Show(msg, "Raw Accel writer");
+ }
+
static void Send(JToken settingsToken)
{
var settings = settingsToken.ToObject<DriverSettings>();
@@ -21,27 +27,30 @@ namespace writer
return;
}
- foreach (var err in errors.x)
+ Show($"Bad settings:\n\n{errors}");
+ }
+
+ static void Main(string[] args)
+ {
+ try
{
- Console.WriteLine(err + (settings.combineMagnitudes ? "" : " (x)"));
+ VersionHelper.ValidateAndGetDriverVersion(typeof(Program).Assembly.GetName().Version);
}
- foreach (var err in errors.y)
+ catch (VersionException e)
{
- Console.WriteLine(err + " (y)");
+ Show(e.Message);
+ return;
}
- }
- static void Main(string[] args)
- {
- if (args.Length != 1 || args[0].Equals("help"))
+ if (args.Length != 1)
{
- Console.WriteLine("USAGE: {0} <file>", System.AppDomain.CurrentDomain.FriendlyName);
+ Show($"Usage: {System.AppDomain.CurrentDomain.FriendlyName} <settings file path>");
return;
}
if (!File.Exists(args[0]))
{
- Console.WriteLine("Settings file not found at {0}", args[0]);
+ Show($"Settings file not found at {args[0]}");
return;
}
@@ -59,15 +68,11 @@ namespace writer
}
catch (JsonException e)
{
- Console.WriteLine("Settings invalid:\n{0}", e.Message.ToString());
- }
- catch (DriverNotInstalledException)
- {
- Console.WriteLine("Driver is not installed");
+ Show($"Settings invalid:\n\n{e.Message}");
}
catch (Exception e)
{
- Console.WriteLine("Error: {0}", e.Message.ToString());
+ Show($"Error:\n\n{e}");
}
}
}
diff --git a/writer/Properties/AssemblyInfo.cs b/writer/Properties/AssemblyInfo.cs
index 37e79ad..fc6a1ca 100644
--- a/writer/Properties/AssemblyInfo.cs
+++ b/writer/Properties/AssemblyInfo.cs
@@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("writer")]
+[assembly: AssemblyTitle("Raw Accel settings writer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("writer")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyProduct("Raw Accel")]
+[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -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("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion(RawAccelVersion.value)]
+[assembly: AssemblyFileVersion(RawAccelVersion.value)]
diff --git a/writer/writer.csproj b/writer/writer.csproj
index a874b7f..1c4cca5 100644
--- a/writer/writer.csproj
+++ b/writer/writer.csproj
@@ -44,6 +44,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />