private void StoreSettings()
{
Settings.Store.LdapHost = Regex.Split(ldapHostTextBox.Text.Trim(), @"\s+");
Settings.Store.LdapPort = Convert.ToInt32(ldapPortTextBox.Text.Trim());
Settings.Store.LdapTimeout = Convert.ToInt32(timeoutTextBox.Text.Trim());
Settings.Store.UseSsl = (useSslCheckBox.CheckState == CheckState.Checked);
Settings.Store.RequireCert = (validateServerCertCheckBox.CheckState == CheckState.Checked);
Settings.Store.ServerCertFile = sslCertFileTextBox.Text.Trim();
Settings.Store.SearchDN = searchDnTextBox.Text.Trim();
Settings.Store.SetEncryptedSetting("SearchPW", searchPassTextBox.Text);
Settings.Store.GroupDnPattern = this.groupDNPattern.Text.Trim();
Settings.Store.GroupMemberAttrib = this.groupMemberAttrTB.Text.Trim();
Settings.Store.Dereference = this.DereferenceComboBox.SelectedIndex;
// Authentication
Settings.Store.AllowEmptyPasswords = this.allowEmptyPwCB.Checked;
Settings.Store.DnPattern = dnPatternTextBox.Text.Trim();
Settings.Store.DoSearch = (searchForDnCheckBox.CheckState == CheckState.Checked);
Settings.Store.SearchFilter = searchFilterTextBox.Text.Trim();
Settings.Store.SearchContexts = Regex.Split(searchContextsTextBox.Text.Trim(), @"\s*\r?\n\s*");
// Authorization
Settings.Store.AuthzRequireAuth = this.authzRequireAuthCB.Checked;
Settings.Store.AuthzAllowOnError = this.authzAllowOnErrorCB.Checked;
List <GroupAuthzRule> lst = new List <GroupAuthzRule>();
foreach (Object item in this.authzRulesListBox.Items)
{
lst.Add(item as GroupAuthzRule);
m_logger.DebugFormat("Saving rule: {0}", item);
}
// Add the default as the last rule in the list
lst.Add(new GroupAuthzRule(this.authzDefaultAllowRB.Checked));
GroupRuleLoader.SaveAuthzRules(lst);
// Gateway
List <GroupGatewayRule> gwList = new List <GroupGatewayRule>();
foreach (Object item in this.gatewayRulesListBox.Items)
{
gwList.Add(item as GroupGatewayRule);
m_logger.DebugFormat("Saving rule: {0}", item);
}
GroupRuleLoader.SaveGatewayRules(gwList);
}