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();
        }
        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 cmdRuleAdd_Click(object sender, EventArgs e)
        {
            ListViewItemRule listViewItem = new ListViewItemRule();
            listViewItem.Xml = new XmlDocument().CreateElement("rule");
            listViewItem.Xml.SetAttribute("name", "New rule");
            listViewItem.Xml.SetAttribute("enabled", "true");
            listViewItem.Xml.SetAttribute("layer", "all");
            listViewItem.Xml.SetAttribute("action", "block");
            listViewItem.Xml.SetAttribute("weight", "auto");

            if (RuleEdit(listViewItem) == true)
                lstRules.Items.Add(listViewItem);

            EnabledUI();
        }