Skip to content

Commit

Permalink
Fixed configuration defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirdoombox committed Mar 16, 2020
1 parent 15a0ee9 commit 16463cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
16 changes: 4 additions & 12 deletions PostScriptumMortarCalculator/Models/UserConfigModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
}
2 changes: 1 addition & 1 deletion PostScriptumMortarCalculator/Services/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserConfigModel>(File.ReadAllText(m_configFilePath));
return this;
Expand Down

0 comments on commit 16463cf

Please sign in to comment.