From 16463cf9f04fd221e1d2a7ace7f796d60fc9ceb3 Mon Sep 17 00:00:00 2001 From: Doombox Date: Mon, 16 Mar 2020 09:39:06 +0000 Subject: [PATCH] Fixed configuration defaults. --- .../Models/UserConfigModel.cs | 16 ++++------------ .../Services/ConfigService.cs | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/PostScriptumMortarCalculator/Models/UserConfigModel.cs b/PostScriptumMortarCalculator/Models/UserConfigModel.cs index 4b60306..3d8dfdd 100644 --- a/PostScriptumMortarCalculator/Models/UserConfigModel.cs +++ b/PostScriptumMortarCalculator/Models/UserConfigModel.cs @@ -4,19 +4,11 @@ namespace PostScriptumMortarCalculator.Models { public class UserConfigModel { - [JsonProperty] public string Theme { get; set; } - [JsonProperty] public string Accent { get; set; } - [JsonProperty] public double IndicatorOpacity { get; set; } - [JsonProperty] public double GridOpacity { get; set; } + [JsonProperty] public string Theme { get; set; } = "Dark"; + [JsonProperty] public string Accent { get; set; } = "Lime"; + [JsonProperty] public double IndicatorOpacity { get; set; } = 0.25d; + [JsonProperty] public double GridOpacity { get; set; } = 0.25d; [JsonProperty] public string LastMapName { get; set; } [JsonProperty] public string LastMortarName { get; set; } - - public static UserConfigModel Default => new UserConfigModel - { - Theme = "Dark", - Accent = "Lime", - IndicatorOpacity = 0.25d, - GridOpacity = 0.25d - }; } } \ No newline at end of file diff --git a/PostScriptumMortarCalculator/Services/ConfigService.cs b/PostScriptumMortarCalculator/Services/ConfigService.cs index f1f8b80..310bc26 100644 --- a/PostScriptumMortarCalculator/Services/ConfigService.cs +++ b/PostScriptumMortarCalculator/Services/ConfigService.cs @@ -25,7 +25,7 @@ public ConfigService() public ConfigService LoadOrDefault() { if (!Directory.Exists(m_configDir) || !File.Exists(m_configFilePath)) - ActiveConfig = UserConfigModel.Default; + ActiveConfig = new UserConfigModel(); else ActiveConfig = JsonConvert.DeserializeObject(File.ReadAllText(m_configFilePath)); return this;