in src/IdFix/FormSettings.cs [110:171]
private void okButton_Click(object sender, EventArgs e)
{
try
{
int port = string.IsNullOrEmpty(comboBoxPort.Text) ? 0 : int.Parse(comboBoxPort.Text);
if (port != Constants.GlobalCatalogPort)
{
if (MessageBox.Show(this, StringLiterals.LdapPortWarningMessage, StringLiterals.LdapPortWarningTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
{
return;
}
}
SettingsManager.Instance.Filter = textBoxFilter.Text;
SettingsManager.Instance.Port = port;
if (SettingsManager.Instance.CurrentDirectoryType == DirectoryType.ActiveDirectory)
{
var tempList = new List<string>();
foreach (object item in checkedListBoxAD.CheckedItems)
{
tempList.Add(item.ToString());
}
SettingsManager.Instance.ActiveForestList = tempList.ToArray();
//If the checkbox is checked, we set the searchBase
if (searchBaseCheckBox.Checked)
{
if (String.IsNullOrEmpty(textBoxSearchBase.Text) || checkedListBoxAD.CheckedItems.Count > 1)
{
//If they checked it and nothing is set, then we clear the check box and set state.
searchBaseCheckBox.Checked = false;
SettingsManager.Instance.SearchBaseEnabled = false;
SettingsManager.Instance.SearchBase = String.Empty;
}
else
{
SettingsManager.Instance.SearchBaseEnabled = true;
SettingsManager.Instance.SearchBase = textBoxSearchBase.Text;
}
}
}
else
{
SettingsManager.Instance.Server = textBoxServer.Text;
SettingsManager.Instance.DistinguishedName = textBoxDomain.Text;
}
if (SettingsManager.Instance.CurrentCredentialMode != CredentialMode.CurrentUser)
{
SettingsManager.Instance.Username = textBoxUser.Text;
SettingsManager.Instance.Password = textBoxPassword.Text;
}
this.Close();
}
catch (Exception ex)
{
this._setDisplay(StringLiterals.Exception + "Settings - " + ex.Message);
}
}