diff --git a/Util/Config.cs b/Util/Config.cs index 8ac0ace..8666a96 100644 --- a/Util/Config.cs +++ b/Util/Config.cs @@ -45,9 +45,13 @@ namespace EliteBGS.Util { public void SaveGlobal() { var serializer = JsonSerializer.CreateDefault(); - using (var file = new StreamWriter(File.OpenWrite(config_file), Encoding.UTF8)) { - var stream = new JsonTextWriter(file); - serializer.Serialize(stream, global_config); + using (FileStream filestream = File.OpenWrite(config_file)) { + filestream.SetLength(0); + filestream.Flush(); + using (StreamWriter file = new StreamWriter(filestream, Encoding.UTF8)) { + var stream = new JsonTextWriter(file); + serializer.Serialize(stream, global_config); + } } }