Esempio n. 1
0
        //convert the current configuration into an XElement node
        public void SaveCurrentConfig(byte group)
        {
            XElement cfgNode = new XElement("Item");
            XElement sNode   = new XElement("Item");

            //group = pack|vib|sub
            if (group > 3) //save pack config
            {
                _curr_cfg.ToElement(ref cfgNode);
                pkg_confs.AddConfig(pkg_confs.cfg_name, cfgNode);
            }

            if ((group % 4) > 1) //save vib config
            {
                sNode.RemoveAll();
                try
                {
                    agent.GetNodeElement(vib_addr, ref sNode);
                    nodes_config[vib_addr].AddConfig(pkg_confs.cfg_name, sNode);
                    if (bot_addr != vib_addr)
                    {
                        agent.GetNodeElement(bot_addr, ref sNode);
                        nodes_config[bot_addr].AddConfig(pkg_confs.cfg_name, sNode);
                    }
                }
                catch
                {
                }
            }
            if ((group % 2) == 1) //save sub config
            {
                foreach (byte n in weight_nodes)
                {
                    sNode.RemoveAll();
                    try
                    {
                        agent.GetNodeElement(n, ref sNode);
                        nodes_config[n].AddConfig(pkg_confs.cfg_name, sNode);
                    }
                    catch
                    {
                    }
                }
            }
        }
Esempio n. 2
0
        public static void set_pwd(string user, string value)
        {
            XElement x = new XElement("Item");

            x.SetAttributeValue("Name", user);
            x.SetValue(MD5Value(value + user +   "1r%4#", true));
            pwds.AddConfig(user, x);
            pwds.SaveConfigToFile();
        }
Esempio n. 3
0
 public void SaveAppConfig()
 {
     app_cfg.AddConfig(app_cfg.cfg_name, curr_cfg);
     app_cfg.SaveConfigToFile();
 }