private void buttonSaveConf_Click(object sender, EventArgs e) { if (textBoxNewConfName.Text != "") { if (Ini.FindConfiguration(textBoxNewConfName.Text, AllConfigurations) == null) { Ini.CConfiguration Configuration = new Ini.CConfiguration(); Ini.CConfiguration OutConfiguration = new Ini.CConfiguration(); Configuration = Ini.FindConfiguration(listBoxConf.SelectedItem.ToString(), AllConfigurations); OutConfiguration = Ini.CopyConfiguration(textBoxNewConfName.Text, Configuration); OutConfiguration.RunExeName = textBoxRunExeName.Text; AllConfigurations.Add(OutConfiguration); try { Ini.SeaveConfigurationsToXml(AllConfigurations, ConfigPath); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } UpdateForm(ConfigPath, 0, 0, 0); } else { MessageBox.Show("A configuration with this name already exists"); } } else { MessageBox.Show("A configuration not selected or new name not specified"); } }
private void SaveDataToFile() { try { if (listBoxConf.SelectedItem != null) { Ini.CConfiguration Configuration = new Ini.CConfiguration(); Configuration = Ini.FindConfiguration(listBoxConf.SelectedItem.ToString(), AllConfigurations); if (Configuration != null) { Ini.SaveConfigurationToFiles(Configuration); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }