diff options
| author | a1xd <[email protected]> | 2021-09-09 17:28:10 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-09-09 17:28:10 -0400 |
| commit | 1964548acbc56edb346d2e396eb0108010d869e1 (patch) | |
| tree | 1f709352d4ff564df385afd3cb8a341d52134644 /grapher/Models/Serialized | |
| parent | rename driver_settings (diff) | |
| download | rawaccel-1964548acbc56edb346d2e396eb0108010d869e1.tar.xz rawaccel-1964548acbc56edb346d2e396eb0108010d869e1.zip | |
port to .NET 5
dependency changes
- Newtonsoft.JSON
+ System.Windows.Forms.DataVisualization
+ System.Data.SqlClient (indirect, but was not added automatically by NuGet)
added ARM64 target
Diffstat (limited to 'grapher/Models/Serialized')
| -rw-r--r-- | grapher/Models/Serialized/GUISettings.cs | 21 | ||||
| -rw-r--r-- | grapher/Models/Serialized/SettingsManager.cs | 7 |
2 files changed, 8 insertions, 20 deletions
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; |