From fa3729e2efcf9e774091c21e84d2c6d70e05688a Mon Sep 17 00:00:00 2001 From: kaczy Date: Mon, 19 Feb 2024 21:15:41 +0100 Subject: [PATCH] Fix config serialization --- CentrED/Config.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CentrED/Config.cs b/CentrED/Config.cs index dfbb322..918cc06 100644 --- a/CentrED/Config.cs +++ b/CentrED/Config.cs @@ -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"; @@ -25,11 +30,11 @@ static Config() } var jsonText = File.ReadAllText(_configFilePath); - Instance = JsonSerializer.Deserialize(jsonText); + Instance = JsonSerializer.Deserialize(jsonText, SerializerOptions); } public static void Save() { - File.WriteAllText(_configFilePath, JsonSerializer.Serialize(Instance)); + File.WriteAllText(_configFilePath, JsonSerializer.Serialize(Instance, SerializerOptions)); } } \ No newline at end of file