adds writer support for commandsfile json

This commit is contained in:
Madpeter 2020-10-24 19:02:09 +01:00
parent f8c0af2e4d
commit b55682c72a

View file

@ -49,6 +49,16 @@ namespace BetterSecondBotShared.IO
serializer.Serialize(writer, Config);
}
}
public void WriteJsonCommands(JsonCommandsfile commandsfile, string targetfile)
{
JsonSerializer serializer = new JsonSerializer();
using (StreamWriter sw = new StreamWriter(@"" + root_folder + "" + targetfile))
using (JsonWriter writer = new JsonTextWriter(sw) { Formatting = Formatting.Indented })
{
serializer.Serialize(writer, commandsfile);
}
}
public void makeOld(string targetfile)
{
System.IO.File.Move(@""+root_folder + "" + targetfile, @"" + root_folder + "" + targetfile+".old");