void SaveConfig() { IL2Config save = new IL2Config(); int.TryParse(portTextBox.Text, out save.port); string output = JsonConvert.SerializeObject(save, Formatting.Indented); File.WriteAllText(saveFilename, output); }
void LoadConfig() { if (File.Exists(saveFilename)) { string text = File.ReadAllText(saveFilename); IL2Config config = JsonConvert.DeserializeObject <IL2Config>(text); portTextBox.Text = "" + config.port; } }