//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 { NodeMaster.GetNodeElement(vib_addr, ref sNode); nodes_config[vib_addr].AddConfig(pkg_confs.cfg_name, sNode); if (bot_addr != vib_addr) { NodeMaster.GetNodeElement(bot_addr, ref sNode); nodes_config[bot_addr].AddConfig(pkg_confs.cfg_name, sNode); } } catch (Exception ex) { Debug.Write(ex.Message); } } if ((group % 2) == 1) //save sub config { foreach (byte n in weight_nodes) { sNode.RemoveAll(); try { NodeMaster.GetNodeElement(n, ref sNode); nodes_config[n].AddConfig(pkg_confs.cfg_name, sNode); } catch (Exception ex) { Debug.Write(ex.Message); } } } }
public static void set_pwd(string user, string value) { XElement x = new XElement("Item"); x.SetElementValue("sn", MD5Value(value + user + "1r%4#", true)); pwds.AddConfig(user, x); pwds.SaveConfigToFile(); }
static public void SaveAppConfig() { app_cfg.AddConfig(app_cfg.cfg_name, curr_cfg); app_cfg.SaveConfigToFile(); }