/// <summary>
        /// 移除一个协议节点
        /// </summary>
        /// <param name="protocolname">协议名称</param>
        /// <param name="factory">制造厂家</param>
        /// <param name="size">表型号</param>
        /// <returns></returns>
        private static bool Remove(string protocolname, string factory, string size)
        {
            if (protocolname == "" && (factory == "" || size == ""))
            {
                return(false);
            }
            CLDC_DataCore.DataBase.clsXmlControl _XmlNode = new CLDC_DataCore.DataBase.clsXmlControl(System.Windows.Forms.Application.StartupPath + CLDC_DataCore.Const.Variable.CONST_DGNPROTOCOL);

            if (_XmlNode.Count() == 0)
            {
                return(false);
            }

            if (protocolname != "")
            {
                _XmlNode.RemoveChild(CLDC_DataCore.DataBase.clsXmlControl.XPath(string.Format("R,Name,{0}", protocolname)));
            }
            if (factory != "" && size != "")
            {
                _XmlNode.RemoveChild(CLDC_DataCore.DataBase.clsXmlControl.XPath(string.Format("R,ZZCJ,{0},BXH,{1}", factory, size)));
            }

            _XmlNode.SaveXml();
            return(true);
        }
        /// <summary>
        /// 获取协议唯一标志组合名称列表
        /// </summary>
        /// <returns></returns>
        public static Dictionary <string, string> getProtocolString()
        {
            CLDC_DataCore.DataBase.clsXmlControl _XmlNode = new CLDC_DataCore.DataBase.clsXmlControl(System.Windows.Forms.Application.StartupPath + CLDC_DataCore.Const.Variable.CONST_DGNPROTOCOL);

            if (_XmlNode.Count() == 0)
            {
                return(new Dictionary <string, string>());
            }

            Dictionary <string, string> _ReturnNames = new Dictionary <string, string>();

            System.Xml.XmlNode _Xml = _XmlNode.toXmlNode();

            for (int i = 0; i < _Xml.ChildNodes.Count; i++)
            {
                _ReturnNames.Add(_Xml.ChildNodes[i].Attributes["Name"].Value, string.Format("协议名称:{0};制造厂家:{1};表型号:{2}", _Xml.ChildNodes[i].Attributes["Name"].Value
                                                                                            , _Xml.ChildNodes[i].Attributes["ZZCJ"].Value
                                                                                            , _Xml.ChildNodes[i].Attributes["BXH"].Value));
            }

            _Xml     = null;
            _XmlNode = null;

            return(_ReturnNames);
        }
        /// <summary>
        /// 获取协议名称列表
        /// </summary>
        /// <returns></returns>
        public static List <string> getProtocolNames()
        {
            CLDC_DataCore.DataBase.clsXmlControl _XmlNode = new CLDC_DataCore.DataBase.clsXmlControl(System.Windows.Forms.Application.StartupPath + CLDC_DataCore.Const.Variable.CONST_DGNPROTOCOL);

            if (_XmlNode.Count() == 0)
            {
                return(new List <string>());
            }

            List <string> _ReturnNames = new List <string>();

            System.Xml.XmlNode _Xml = _XmlNode.toXmlNode();

            for (int i = 0; i < _Xml.ChildNodes.Count; i++)
            {
                _ReturnNames.Add(_Xml.ChildNodes[i].Attributes["Name"].Value);
            }

            _Xml     = null;
            _XmlNode = null;

            return(_ReturnNames);
        }
        /// <summary>
        /// 根据制造厂家和表型号获取协议名称
        /// </summary>
        /// <param name="Factroy">制造厂家</param>
        /// <param name="Size">表型号</param>
        /// <returns></returns>
        public static string getProtocolName(string Factroy, string Size)
        {
            if (Factroy == "" || Size == "")
            {
                return("");
            }
            CLDC_DataCore.DataBase.clsXmlControl _XmlNode = new CLDC_DataCore.DataBase.clsXmlControl(System.Windows.Forms.Application.StartupPath + CLDC_DataCore.Const.Variable.CONST_DGNPROTOCOL);

            if (_XmlNode.Count() == 0)
            {
                return("");
            }

            System.Xml.XmlNode Xml_Child = null;

            Xml_Child = CLDC_DataCore.DataBase.clsXmlControl.FindSencetion(_XmlNode.toXmlNode()
                                                                           , CLDC_DataCore.DataBase.clsXmlControl.XPath(string.Format("R,ZZCJ,{0},BXH,{1}", Factroy, Size)));
            if (Xml_Child == null)
            {
                return("");
            }

            return(CLDC_DataCore.DataBase.clsXmlControl.getNodeAttributeValue(Xml_Child, "Name"));
        }
        /// <summary>
        /// 加载XML文档
        /// </summary>
        /// <param name="protocolname"></param>
        /// <param name="factroy"></param>
        /// <param name="size"></param>
        private void LoadXmlData(string protocolname, string factory, string size)
        {
            if (protocolname == "" && (factory == "" || size == ""))
            {
                return;
            }

            CommDataBase.clsXmlControl _XmlNode = new CommDataBase.clsXmlControl(System.Windows.Forms.Application.StartupPath + CLDC_DataCore.Const.Variable.CONST_DGNPROTOCOL);

            if (_XmlNode.Count() == 0)
            {
                return;
            }

            System.Xml.XmlNode _FindXmlNode = null;

            if (protocolname != "")
            {
                _FindXmlNode = CLDC_DataCore.DataBase.clsXmlControl.FindSencetion(_XmlNode.toXmlNode()
                                                                                  , CLDC_DataCore.DataBase.clsXmlControl.XPath(string.Format("R,Name,{0}", protocolname)));
            }
            else if (factory != "" && size != "")
            {
                _FindXmlNode = CLDC_DataCore.DataBase.clsXmlControl.FindSencetion(_XmlNode.toXmlNode()
                                                                                  , CLDC_DataCore.DataBase.clsXmlControl.XPath(string.Format("R,ZZCJ,{0},BXH,{1}", factory, size)));
            }
            if (_FindXmlNode == null)
            {
                return;
            }

            #region ----------------------------加载协议文件信息----------------------------------------------------------------------

            this.ProtocolName = _FindXmlNode.Attributes["Name"].Value;                                          //协议名称

            this.DnbFactroy = CLDC_DataCore.DataBase.clsXmlControl.getNodeAttributeValue(_FindXmlNode, "ZZCJ"); //制造厂家

            this.DnbSize = CLDC_DataCore.DataBase.clsXmlControl.getNodeAttributeValue(_FindXmlNode, "BXH");     //表型号

            this.DllFile = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                             , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,DllFile"));                                                         //协议库名称
            this.ClassName = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                               , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ClassName"));                                                     //说使用协议类名称
            this.Setting = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                             , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,Setting"));                                                         //通信参数
            this.UserID = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                            , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,UserID"));                                                           //用户名
            this.VerifyPasswordType = int.Parse(CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                                  , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,VerifyPasswordType")));                        //验证类型
            this.WritePassword = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                   , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,WritePassword"));                                             //写密码
            this.WriteClass = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,WriteClass"));                                                   //写密码等级
            this.ClearDemandPassword = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                         , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ClearDemandPassword"));                                 //清需量密码
            this.ClearDemandClass = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                      , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ClearDemandClass"));                                       //请需量密码等级
            this.ClearDLPassword = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                     , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ClearDLPassword"));                                         //清电量密码
            this.ClearDLClass = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                  , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ClearDLClass"));                                               //清电量等级
            this.TariffOrderType = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                     , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,TariffOrderType"));                                         //费率类型
            this.DateTimeFormat = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                    , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,DateTimeFormat"));                                           //日期格式
            this.SundayIndex = int.Parse(CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                           , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,SundayIndex")));                                      //星期天表示
            this.ClockPL = float.Parse(CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode, CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ClockPL")) == "" ? "1"
                                                                : CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode, CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ClockPL")));     //时钟频率
            this.FECount = int.Parse(CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                       , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,FECount")));                                              //唤醒FE个数
            this.DataFieldPassword = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                       , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,DataFieldPassword")) == "0" ? false : true;               //数据域是否包含密码
            this.BlockAddAA = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,BlockAddAA")) == "0" ? false : true;                             //写数据块是否加AA
            this.ConfigFile = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode
                                                                                , CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,ConfigFile"));                                                   //配置文件
            this.HaveProgrammingkey = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode, CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,HaveProgrammingkey")) == "0" ? false : true; //有无编程键
            this.IsSouthEncryption  = CLDC_DataCore.DataBase.clsXmlControl.getNodeValue(_FindXmlNode, CLDC_DataCore.DataBase.clsXmlControl.XPath("C,Name,IsSouthEn")) == "0" ? false : true;          //有无编程键

            _FindXmlNode = CLDC_DataCore.DataBase.clsXmlControl.FindSencetion(_FindXmlNode, CLDC_DataCore.DataBase.clsXmlControl.XPath("Prjs"));                                                      //转到项目数据节点


            this._Loading = true;                //改写加载标志,表示加载协议成功

            this.DgnPras = new Dictionary <string, string>();

            if (_FindXmlNode == null)
            {
                return;
            }

            for (int i = 0; i < _FindXmlNode.ChildNodes.Count; i++)
            {
                this.DgnPras.Add(_FindXmlNode.ChildNodes[i].Attributes["ID"].Value, _FindXmlNode.ChildNodes[i].ChildNodes[0].Value);        //加入ID,值
            }

            if (this.DgnPras.Count == 0)
            {
                return;
            }



            #endregion
        }