Example #1
0
 public add_server(Interface frmctrl, configuration config)
 {
     InitializeComponent();
     old_configeration = config;
     m_parent = frmctrl;
     user_level_box.Text = "1";
     voice_level_box.Text = "3";
     hop_level_box.Text = "6";
     op_level_box.Text = "7";
     sop_level_box.Text = "8";
     founder_level_box.Text = "9";
     owner_level_box.Text = "10";
     xmlDocModules.Load(m_parent.cur_dir + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar + "Module_Config" + Path.DirectorySeparatorChar + "Default" + Path.DirectorySeparatorChar + "modules.xml");
     XmlNodeList xnList = xmlDocModules.SelectNodes("/modules/module");
     foreach (XmlNode xnModules in xnList)
     {
         String module_name = xnModules["name"].InnerText;
         module_list.Items.Add(module_name);
         // Add commands to command list
         XmlNodeList optionList = xnModules.ChildNodes;
         foreach (XmlNode option in optionList)
         {
             if (option.Name.Equals("commands"))
             {
                 XmlNodeList Options = option.ChildNodes;
                 foreach (XmlNode options in Options)
                 {
                     command_list.Items.Add(options["name"].InnerText);
                 }
             }
         }
     }
     xnList = xmlDocModules.SelectNodes("/modules/module");
     foreach (XmlNode xn_node in xnList)
     {
         XmlNodeList optionList = xn_node.ChildNodes;
         foreach (XmlNode option in optionList)
         {
             if (option.Name.Equals("commands"))
             {
                 XmlNodeList Options = option.ChildNodes;
                 foreach (XmlNode options in Options)
                 {
                     if (options["name"].InnerText.Equals(command_list.Items[0]))
                     {
                         command_label.Text = options["name"].InnerText;
                         command_name.Text = options["name"].InnerText;
                         command_triggers.Text = options["triggers"].InnerText;
                         command_arguments.Text = options["syntax"].InnerText;
                         command_description.Text = options["description"].InnerText;
                         command_access_level.Text = options["access_level"].InnerText;
                         channel_blacklist.Text = options["blacklist"].InnerText;
                         show_in_help.Checked = Convert.ToBoolean(options["show_help"].InnerText);
                         spam_counter.Checked = Convert.ToBoolean(options["spam_check"].InnerText);
                         break;
                     }
                 }
             }
         }
     }
     module_list.SelectedIndex = 0;
     command_list.SelectedIndex = 0;
 }