//convert the current configuration into an XElement node public void SaveCurrentConfig() { XElement cfgNode = new XElement("Item"); sys_cfg.ToElement(cfgNode); vib_node.ToElement(cfgNode); if (pack_node is BottomPackNode) { pack_node.ToElement(cfgNode); } all_conf.AddConfig(all_conf.cfg_name, cfgNode); all_conf.SaveConfigToFile(); }
//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 { } } } }