private void ComboboxSelectedConfig_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ((string)comboboxSelectedConfig.SelectedItem == "New Config") { ConfigEditorWindow configEditor = new ConfigEditorWindow(BotDataPath, null); configEditor.ShowDialog(); if (configEditor.ConfigName != null && configEditor.Config != null) { ConfigToLoad = Path.Combine(BotDataPath, configEditor.ConfigName, "config.json"); if (!Directory.Exists(Path.GetDirectoryName(ConfigToLoad))) { Directory.CreateDirectory(Path.GetDirectoryName(ConfigToLoad)); } File.WriteAllText(ConfigToLoad, JsonConvert.SerializeObject(configEditor.Config, Formatting.Indented)); } } else { ConfigToLoad = Path.Combine(BotDataPath, (string)comboboxSelectedConfig.SelectedItem, "config.json"); } Close(); }
private void ButtonConfig_Click(object sender, RoutedEventArgs e) { ConfigEditorWindow configWindow = new ConfigEditorWindow(DataPath, AmeisenBot, Config, Path.GetFileName(Path.GetDirectoryName(ConfigPath))); configWindow.ShowDialog(); if (configWindow.SaveConfig) { AmeisenBot.Config = configWindow.Config; AmeisenBot.ReloadConfig(); File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(configWindow.Config, Formatting.Indented)); } }
private void ButtonConfig_Click(object sender, RoutedEventArgs e) { ConfigEditorWindow configEditor = new ConfigEditorWindow(BotDataPath, Config); configEditor.ShowDialog(); }