private void buttonOk_Click(object sender, EventArgs e) { List <String> errors = new List <string>(); if (String.IsNullOrEmpty(textBoxFilezillaLocation.Text) || File.Exists(textBoxFilezillaLocation.Text)) { SuperPuTTY.Settings.FileZillaExe = textBoxFilezillaLocation.Text; } if (String.IsNullOrEmpty(textBoxWinSCPLocation.Text) || File.Exists(textBoxWinSCPLocation.Text)) { SuperPuTTY.Settings.WinSCPExe = textBoxWinSCPLocation.Text; } if (String.IsNullOrEmpty(textBoxPscpLocation.Text) || File.Exists(textBoxPscpLocation.Text)) { SuperPuTTY.Settings.PscpExe = textBoxPscpLocation.Text; } if (String.IsNullOrEmpty(textBoxVNCLocation.Text) || File.Exists(textBoxVNCLocation.Text)) { SuperPuTTY.Settings.VNCExe = textBoxVNCLocation.Text; } if (String.IsNullOrEmpty(textBoxRDPLocation.Text) || File.Exists(textBoxRDPLocation.Text)) { SuperPuTTY.Settings.RDPExe = textBoxRDPLocation.Text; } string settingsDir = textBoxSettingsFolder.Text; if (String.IsNullOrEmpty(settingsDir) || !Directory.Exists(settingsDir)) { errors.Add("Settings Folder must be set to valid directory"); } else { SuperPuTTY.Settings.SettingsFolder = settingsDir; } if (this.comboBoxLayouts.SelectedValue != null) { SuperPuTTY.Settings.DefaultLayoutName = (string)comboBoxLayouts.SelectedValue; } if (!String.IsNullOrEmpty(textBoxPuttyLocation.Text) && File.Exists(textBoxPuttyLocation.Text)) { SuperPuTTY.Settings.PuttyExe = textBoxPuttyLocation.Text; } else { errors.Insert(0, "PuTTY is required to properly use this application."); } string mintty = this.textBoxMinttyLocation.Text; if (!string.IsNullOrEmpty(mintty) && File.Exists(mintty)) { SuperPuTTY.Settings.MinttyExe = mintty; } if (errors.Count == 0) { SuperPuTTY.Settings.SingleInstanceMode = this.checkSingleInstanceMode.Checked; SuperPuTTY.Settings.RestrictContentToDocumentTabs = this.checkConstrainPuttyDocking.Checked; SuperPuTTY.Settings.MultipleTabCloseConfirmation = this.checkConfirmTabClose.Checked; SuperPuTTY.Settings.RestoreWindowLocation = this.checkRestoreWindow.Checked; SuperPuTTY.Settings.ExitConfirmation = this.checkExitConfirmation.Checked; SuperPuTTY.Settings.ExpandSessionsTreeOnStartup = this.checkExpandTree.Checked; SuperPuTTY.Settings.EnableControlTabSwitching = this.checkEnableControlTabSwitching.Checked; SuperPuTTY.Settings.EnableKeyboadShortcuts = this.checkEnableKeyboardShortcuts.Checked; SuperPuTTY.Settings.MinimizeToTray = this.checkMinimizeToTray.Checked; SuperPuTTY.Settings.TabTextBehavior = (string)this.comboBoxTabText.SelectedItem; SuperPuTTY.Settings.TabSwitcher = (string)this.comboBoxTabSwitching.SelectedItem.GetType().FullName; SuperPuTTY.Settings.SessionsTreeShowLines = this.checkSessionsTreeShowLines.Checked; SuperPuTTY.Settings.SessionsTreeFont = this.btnFont.Font; SuperPuTTY.Settings.WindowActivator = (string)this.comboBoxActivatorType.SelectedItem; SuperPuTTY.Settings.Opacity = (double)this.numericUpDownOpacity.Value / 100.0; SuperPuTTY.Settings.SessionsSearchMode = (string)this.comboSearchMode.SelectedItem; SuperPuTTY.Settings.QuickSelectorCaseSensitiveSearch = this.checkQuickSelectorCaseSensitiveSearch.Checked; SuperPuTTY.Settings.ShowDocumentIcons = this.checkShowDocumentIcons.Checked; SuperPuTTY.Settings.DockingRestrictFloatingWindows = this.checkRestrictFloatingWindows.Checked; SuperPuTTY.Settings.SessionsShowSearch = this.checkSessionsShowSearch.Checked; SuperPuTTY.Settings.FilterSessionsOnChange = this.checkFilterWhileTyping.Checked; SuperPuTTY.Settings.PuttyPanelShowNewSessionMenu = this.checkPuttyEnableNewSessionMenu.Checked; SuperPuTTY.Settings.AutoUpdateCheck = this.checkBoxCheckForUpdates.Checked; SuperPuTTY.Settings.PscpHomePrefix = this.textBoxHomeDirPrefix.Text; SuperPuTTY.Settings.PscpRootHomePrefix = this.textBoxRootDirPrefix.Text; SuperPuTTY.Settings.SessiontreeShowFoldersFirst = this.checkSessionTreeFoldersFirst.Checked; SuperPuTTY.Settings.PersistCommandBarHistory = this.checkBoxPersistTsHistory.Checked; SuperPuTTY.Settings.SaveCommandHistoryDays = (int)this.numericUpDown1.Value; SuperPuTTY.Settings.AllowPlainTextPuttyPasswordArg = this.checkBoxAllowPuttyPWArg.Checked; SuperPuTTY.Settings.PuttyDefaultParameters = this.textBoxPuttyDefaultParameters.Text; // save shortcuts KeyboardShortcut[] shortcuts = new KeyboardShortcut[this.Shortcuts.Count]; this.Shortcuts.CopyTo(shortcuts, 0); SuperPuTTY.Settings.UpdateFromShortcuts(shortcuts); SuperPuTTY.Settings.Save(); // @TODO - move this to a better place...maybe event handler after opening if (OrigSettingsFolder != SuperPuTTY.Settings.SettingsFolder) { SuperPuTTY.LoadLayouts(); SuperPuTTY.LoadSessions(); } else if (OrigDefaultLayoutName != SuperPuTTY.Settings.DefaultLayoutName) { SuperPuTTY.LoadLayouts(); } DialogResult = DialogResult.OK; } else { StringBuilder sb = new StringBuilder(); foreach (string s in errors) { sb.Append(s).AppendLine().AppendLine(); } if (MessageBox.Show(sb.ToString(), "Errors", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { DialogResult = DialogResult.Cancel; } } }