private void OnButtonApplyClick(object sender, EventArgs e) { if (_engineList.SettingAvailable) { EngineSetting setting = _engineList.Settings[_listBoxSettings.SelectedIndex]; string name = _textBoxName.Text; if (string.IsNullOrWhiteSpace(name)) { return; } bool nameChanged = name != setting.Name; if (nameChanged && _listBoxSettings.Items.Contains(name)) { MessageBox.Show(this, "Setting with this name already exists.", "Zentropy", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (nameChanged) { setting.Name = name; } setting.ExecutablePath = _comboBoxExePath.Text; setting.LogoPath = _comboBoxLogoPath.Text; setting.UciOptions = _textBoxUciOptions.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); _engineList.TryAddExePath(setting.ExecutablePath); _engineList.TryAddLogoPath(setting.LogoPath); EngineSelected?.Invoke(); UpdateUI(_listBoxSettings.SelectedIndex); } }