public void InitializeDialog(string fileName, bool allowEdit) { m_isCreateNew = false; m_policy = new Policy(); m_policy.ImportPolicyFromXMLFile(fileName); textBox_PolicyName.Text = m_policy.PolicyName; this.Text = "Importing Policy - " + m_policy.PolicyName; if (!allowEdit) { textBox_PolicyName.Enabled = false; listView_AddServers.Enabled = false; } else { if (m_policy != null && m_policy.IsDynamic) { listView_AddServers.Items.Clear(); listView_AddServers.Enabled = false; listView_AddServers.Items.Add("This is a dynamic policy servers are added at run time"); } if (m_policy != null && m_policy.IsSystemPolicy) { textBox_PolicyName.Enabled = false; controlConfigurePolicyVulnerabilities1.Enabled = false; } } controlConfigurePolicyVulnerabilities1.InitilizeControl(m_policy); }
private void _page_PolicyType_BeforeMoveNext(object sender, CancelEventArgs e) { if (radioButtonCreateFromStandard.Checked) { string fileName = (string)textBox_PolicyName.Tag; if (!string.IsNullOrEmpty(fileName)) { m_policy.ImportPolicyFromXMLFile(fileName, false); _policyInterview.SetInterviewText(string.Empty); _policyInterview.InterviewName = string.Empty; } else { MsgBox.ShowError("Error Creating Policy", "Must specify a Standard Policy."); e.Cancel = true; } } else { textBox_PolicyName.Tag = null; m_policy = new Policy(); m_policy.IsDynamic = true; m_policy.DynamicSelection = string.Empty; } }
public void InitializeDialog(string fileName, bool allowEdit) { m_isCreateNew = true; m_policy = new Policy(); m_policy.ImportPolicyFromXMLFile(fileName, false); m_policy.IsSystemPolicy = false; this.Text = string.Format(IMPORTTITLEFMT, m_policy.PolicyName); InitializeDialogCommon(allowEdit); }
private void _page_PolicyName_BeforeDisplay(object sender, EventArgs e) { if (!string.IsNullOrEmpty((string)textBox_PolicyName.Tag)) { Policy p = new Policy(); p.ImportPolicyFromXMLFile((string)textBox_PolicyName.Tag, false); textBox_Description.Text = p.PolicyDescription; } }
private void _page_Interview_BeforeDisplay(object sender, EventArgs e) { if (!string.IsNullOrEmpty((string)textBox_PolicyName.Tag)) { if (string.IsNullOrEmpty(_policyInterview.InterviewName) && string.IsNullOrEmpty(_policyInterview.GetInterviewText())) { Policy p = new Policy(); p.ImportPolicyFromXMLFile((string)textBox_PolicyName.Tag, false); _policyInterview.SetInterviewText(p.InterviewText); _policyInterview.InterviewName = p.InterviewName; } } }
private void button_Import_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; string fileName = Forms.Form_ImportPolicy.Process(); if (!string.IsNullOrEmpty(fileName)) { Policy policy = new Policy(); policy.ImportPolicyFromXMLFile(fileName, false); policy.IsSystemPolicy = false; if (Form_ImportExportPolicySecuriyChecks.ProcessImport(policy, Program.gController.isAdmin)) { m_importing = true; loadPolicyMetrics(); m_policy.UpdatePolicyMetricsFromSelectedSecurityChecks(policy); } } Cursor = Cursors.Default; }
public Form_WizardCreatePolicy() { InitializeComponent(); // Set the intro text in the wizard. _rtb_Introduction.Rtf = WizardIntroText; // Select the intro page. _wizard.SelectedPage = _page_Introduction; m_policy = new Policy(); m_policy.IsDynamic = true; m_policy.DynamicSelection = string.Empty; radioButtonCreateNew.Checked = true; // load value lists for listview display ValueList radioButtonValueList = new ValueList(); radioButtonValueList.Key = "RadioButton"; radioButtonValueList.DisplayStyle = ValueListDisplayStyle.Picture; ValueListItem listItem; radioButtonValueList.ValueListItems.Clear(); listItem = new ValueListItem(CheckState.Checked); listItem.DisplayText = "Checked"; listItem.Appearance.Image = AppIcons.AppImage16(AppIcons.Enum.RadioButtonChecked); radioButtonValueList.ValueListItems.Add(listItem); listItem = new ValueListItem(CheckState.Unchecked); listItem.DisplayText = "UnChecked"; listItem.Appearance.Image = AppIcons.AppImage16(AppIcons.Enum.RadioButtonUnChecked); radioButtonValueList.ValueListItems.Add(listItem); _ultraListViewStandardPolicies.SubItemColumns["CheckState"].ValueList = radioButtonValueList; // Load builtin standard Policies string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath); path = path.Substring(0, path.LastIndexOf(Path.DirectorySeparatorChar)); string policyPath = path + @"\" + Utility.Constants.Policy_Install_Folder; if (Directory.Exists(policyPath)) { string[] files = Directory.GetFiles(policyPath); foreach (string f in files) { Policy p = new Policy(); p.ImportPolicyFromXMLFile(f, false); UltraListViewItem li = _ultraListViewStandardPolicies.Items.Add(p.PolicyName, p.PolicyName); li.Tag = f; li.SubItems["CheckState"].Value = CheckState.Unchecked; li.SubItems["Count"].Value = p.MetricCount; //save the policy for displaying the description m_Templates.Add(f, p); } if (_ultraListViewStandardPolicies.Items.Count > 0) { _ultraListViewStandardPolicies.Items[0].SubItems["CheckState"].Value = CheckState.Checked; } _ultraListViewStandardPolicies.Enabled = false; } setTemplateDescription(); }