Skip to content

Commit

Permalink
Fix config serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Feb 19, 2024
1 parent 35bd200 commit fa3729e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions CentrED/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public class ConfigRoot

public static class Config
{
private static readonly JsonSerializerOptions SerializerOptions = new()
{
IncludeFields = true
};

public static ConfigRoot Instance;
private static string _configFilePath = "settings.json";

Expand All @@ -25,11 +30,11 @@ static Config()
}

var jsonText = File.ReadAllText(_configFilePath);
Instance = JsonSerializer.Deserialize<ConfigRoot>(jsonText);
Instance = JsonSerializer.Deserialize<ConfigRoot>(jsonText, SerializerOptions);
}

public static void Save()
{
File.WriteAllText(_configFilePath, JsonSerializer.Serialize(Instance));
File.WriteAllText(_configFilePath, JsonSerializer.Serialize(Instance, SerializerOptions));
}
}

0 comments on commit fa3729e

Please sign in to comment.