/// <summary> /// 存储功耗方案 /// </summary> public void Save() { if (_LstPowerConsume.Count == 0) { return; } CLDC_DataCore.DataBase.clsXmlControl _XmlNode = new CLDC_DataCore.DataBase.clsXmlControl(); _XmlNode.appendchild("", "PowerConsume", "Name", Name); for (int _i = 0; _i < _LstPowerConsume.Count; _i++) { _XmlNode.appendchild("" , "R" , "bChecked" , _LstPowerConsume[_i].PowerConsumePrjID , "ItemName" , _LstPowerConsume[_i].PowerConsumePrjName , "Para" , _LstPowerConsume[_i].PrjParm); } _XmlNode.SaveXml(_FAPath); }
/// <summary> /// 添加一个新的协议! /// </summary> /// <returns></returns> public bool AddNewProtocol() { if (ProtocolName == "" || _DnbFactroy == "" || _DnbSize == "") { return(false); } CLDC_DataCore.DataBase.clsXmlControl _XmlNode = new CLDC_DataCore.DataBase.clsXmlControl(System.Windows.Forms.Application.StartupPath + CLDC_DataCore.Const.Variable.CONST_DGNPROTOCOL); if (ContainsNode(_XmlNode, ProtocolName, "", "")) { Remove(ProtocolName, "", ""); } if (ContainsNode(_XmlNode, "", _DnbFactroy, _DnbSize)) { Remove("", _DnbFactroy, _DnbSize); } if (_XmlNode.toXmlNode() == null) { _XmlNode.appendchild("", "DgnProtocol"); } _XmlNode.appendchild("", "R", "Name", ProtocolName, "ZZCJ", _DnbFactroy, "BXH", _DnbSize); #region -----------------------------------------插入XML节点--------------------------------------------- string _Xpath = CLDC_DataCore.DataBase.clsXmlControl.XPath(string.Format("R,Name,{0}", ProtocolName)); _XmlNode.appendchild(_Xpath, "C", "Name", "DllFile", this.DllFile); //协议库名称 _XmlNode.appendchild(_Xpath, "C", "Name", "ClassName", this.ClassName); //所使用的协议名称 _XmlNode.appendchild(_Xpath, "C", "Name", "Setting", this.Setting); //通信参数 _XmlNode.appendchild(_Xpath, "C", "Name", "UserID", this.UserID); //用户名 _XmlNode.appendchild(_Xpath, "C", "Name", "VerifyPasswordType", this.VerifyPasswordType.ToString()); //验证类型 _XmlNode.appendchild(_Xpath, "C", "Name", "WritePassword", this.WritePassword); //写密码 _XmlNode.appendchild(_Xpath, "C", "Name", "WriteClass", this.WriteClass); //写等级 _XmlNode.appendchild(_Xpath, "C", "Name", "ClearDemandPassword", this.ClearDemandPassword); //清需量密码 _XmlNode.appendchild(_Xpath, "C", "Name", "ClearDemandClass", this.ClearDemandClass); //请需量密码等级 _XmlNode.appendchild(_Xpath, "C", "Name", "ClearDLPassword", this.ClearDLPassword); //清电量密码 _XmlNode.appendchild(_Xpath, "C", "Name", "ClearDLClass", this.ClearDLClass); //清电量等级 _XmlNode.appendchild(_Xpath, "C", "Name", "TariffOrderType", this.TariffOrderType); //费率类型 _XmlNode.appendchild(_Xpath, "C", "Name", "DateTimeFormat", this.DateTimeFormat); //日期格式 _XmlNode.appendchild(_Xpath, "C", "Name", "SundayIndex", this.SundayIndex.ToString()); //星期天表示 _XmlNode.appendchild(_Xpath, "C", "Name", "ClockPL", this.ClockPL.ToString()); //时钟频率 _XmlNode.appendchild(_Xpath, "C", "Name", "FECount", this.FECount.ToString()); //唤醒FE个数 _XmlNode.appendchild(_Xpath, "C", "Name", "DataFieldPassword", this.DataFieldPassword ? "1" : "0"); //数据域是否包含密码 _XmlNode.appendchild(_Xpath, "C", "Name", "BlockAddAA", this.BlockAddAA ? "1" : "0"); //写数据块是否加AA _XmlNode.appendchild(_Xpath, "C", "Name", "ConfigFile", this.ConfigFile); //配置文件 _XmlNode.appendchild(_Xpath, "C", "Name", "HaveProgrammingkey", this.HaveProgrammingkey ? "1" : "0"); //有无编程键 _XmlNode.appendchild(_Xpath, "C", "Name", "IsSouthEn", this.IsSouthEncryption ? "1" : "0"); //是否是南网13加密机 if (this.DgnPras.Count > 0) { _XmlNode.appendchild(_Xpath, "Prjs"); //插入项目节点 } else { _XmlNode.SaveXml(); return(true); } _Xpath = CLDC_DataCore.DataBase.clsXmlControl.XPath(string.Format("R,Name,{0}|Prjs", ProtocolName)); foreach (string _Key in this.DgnPras.Keys) { _XmlNode.appendchild(_Xpath, "D", "ID", _Key, DgnPras[_Key]); } _XmlNode.SaveXml(); #endregion return(true); }