summaryrefslogtreecommitdiff
path: root/grapher/Models
diff options
context:
space:
mode:
Diffstat (limited to 'grapher/Models')
-rw-r--r--grapher/Models/Devices/DeviceIDManager.cs5
-rw-r--r--grapher/Models/Serialized/GUISettings.cs21
-rw-r--r--grapher/Models/Serialized/SettingsManager.cs7
3 files changed, 8 insertions, 25 deletions
diff --git a/grapher/Models/Devices/DeviceIDManager.cs b/grapher/Models/Devices/DeviceIDManager.cs
index e0ee686..ff18718 100644
--- a/grapher/Models/Devices/DeviceIDManager.cs
+++ b/grapher/Models/Devices/DeviceIDManager.cs
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Management;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher.Models.Devices
diff --git a/grapher/Models/Serialized/GUISettings.cs b/grapher/Models/Serialized/GUISettings.cs
index e7b67ba..b7fe4de 100644
--- a/grapher/Models/Serialized/GUISettings.cs
+++ b/grapher/Models/Serialized/GUISettings.cs
@@ -1,11 +1,10 @@
-using Newtonsoft.Json;
-using System;
+using System;
using System.IO;
-
+using System.Text.Json;
+using System.Text.Json.Serialization;
namespace grapher.Models.Serialized
{
[Serializable]
- [JsonObject(ItemRequired = Required.Always)]
public class GUISettings
{
#region Constructors
@@ -17,22 +16,16 @@ namespace grapher.Models.Serialized
#region Properties
- [JsonProperty(Order = 1)]
public int DPI { get; set; }
- [JsonProperty(Order = 2)]
public int PollRate { get; set; }
- [JsonProperty(Order = 3)]
public bool ShowLastMouseMove { get; set; }
- [JsonProperty(Order = 4)]
public bool ShowVelocityAndGain { get; set; }
- [JsonProperty(Order = 5)]
public bool AutoWriteToDriverOnStartup { get; set; }
- [JsonProperty(Order = 6)]
public bool StreamingMode { get; set; }
#endregion Properties
@@ -41,9 +34,7 @@ namespace grapher.Models.Serialized
public override bool Equals(object obj)
{
- var other = obj as GUISettings;
-
- if (other == null)
+ if (obj is not GUISettings other)
{
return false;
}
@@ -73,7 +64,7 @@ namespace grapher.Models.Serialized
public void Save()
{
- File.WriteAllText(Constants.GuiConfigFileName, JsonConvert.SerializeObject(this));
+ File.WriteAllText(Constants.GuiConfigFileName, JsonSerializer.Serialize(this));
}
public static GUISettings MaybeLoad()
@@ -82,7 +73,7 @@ namespace grapher.Models.Serialized
try
{
- settings = JsonConvert.DeserializeObject<GUISettings>(
+ settings = JsonSerializer.Deserialize<GUISettings>(
File.ReadAllText(Constants.GuiConfigFileName));
}
catch (Exception ex)
diff --git a/grapher/Models/Serialized/SettingsManager.cs b/grapher/Models/Serialized/SettingsManager.cs
index 3789c05..6db211f 100644
--- a/grapher/Models/Serialized/SettingsManager.cs
+++ b/grapher/Models/Serialized/SettingsManager.cs
@@ -1,11 +1,8 @@
-using Newtonsoft.Json;
-using System;
+using System;
using System.IO;
using System.Windows.Forms;
using System.Threading;
-using System.Text;
-using System.Drawing;
-using grapher.Models.Devices;
+using System.Text.Json;
using System.Collections.Generic;
using System.Linq;