private bool RuleEdit(ListViewItemRule listViewItem) { FormRule form = new FormRule(); form.Xml = listViewItem.Xml.CloneNode(true) as XmlElement; if(form.ShowDialog() == DialogResult.OK) { listViewItem.Xml = form.Xml; listViewItem.FirewallDisable(); if (m_started) { listViewItem.FirewallEnable(); } listViewItem.Update(); EnabledUI(); return true; } return false; }
private void ProfileLoad(string path) { FileInfo f = new FileInfo(path); path = f.FullName; StopFirewall(); XmlDocument xmlDoc = new XmlDocument(); lstRules.Items.Clear(); xmlDoc.Load(path); foreach(XmlElement xmlRule in xmlDoc.SelectNodes("//rule")) { ListViewItemRule listViewItem = new ListViewItemRule(); listViewItem.Xml = xmlRule; listViewItem.Update(); lstRules.Items.Add(listViewItem); } txtDescription.Text = xmlDoc.DocumentElement.GetAttribute("description"); cboWeight.Text = Lang.GetText("weight", xmlDoc.DocumentElement.GetAttribute("weight")); m_path = path; EnabledUI(); }