public static void LoadConfig() { if (!File.Exists(jsonPath)) { DirUtil.CreateDirectoryIfNotExist(ConfigFolder); Instance = new UserConfig(); Instance.LoadDefaults(); string jsonString = JsonConvert.SerializeObject(Instance, Formatting.Indented); DirUtil.WriteTextToFile(jsonPath, jsonString); } Instance = new UserConfig(); JsonConvert.PopulateObject(DirUtil.ReadTextFile(jsonPath), Instance); }
private void btnDumpChatLog_Click(object sender, RoutedEventArgs e) { DirUtil.CreateDirectoryIfNotExist("ServerChatDump"); File.WriteAllLines("ServerChatDump/serverchatdump.txt", GetServerLogText(true)); }