Exemplo n.º 1
0
        static APPConfig()
        {
            try
            {
                XmlFileHelper xmlfilehelper = new XmlFileHelper();

                //_fileName = gcsl.AppG.GetAppPath() + CONFIG_FILE;                     //不再使用gcsl封装,改为系统函数
                _fileName = System.Environment.CurrentDirectory + CONFIG_FILE;
                //Console.WriteLine(_fileName);
                //通用配置信息
                //IntervalCalculate = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/common", "interval_calculate").Value) * 1000;
                IntervalDisplay    = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/common", "interval_calculate").Value) * 1000;
                app_mode           = xmlfilehelper.GetXmlAttribute(_fileName, "/config/common", "appmode").Value;
                app_debug_password = xmlfilehelper.GetXmlAttribute(_fileName, "/config/common", "password").Value;
                try { log_validperiod = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/common", "log_validperiod").Value); }
                catch { log_validperiod = 60; }

                //实时计算引擎相关配置
                realcalcu_calcunode = xmlfilehelper.GetXmlAttribute(_fileName, "/config/realcalcu", "calcunode").Value;
                realcalcu_period    = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/realcalcu", "period").Value);
                realcalcu_periodwritepslcalcuitem = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/realcalcu", "periodwritepslcalcuitem").Value);    //配置文件中是小时
                realcalcu_autorun          = xmlfilehelper.GetXmlAttribute(_fileName, "/config/realcalcu", "autorun").Value;
                realcalcu_maxreadrtdb      = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/realcalcu", "maxreadrtdb").Value);
                realcalcu_recordcalcutime  = xmlfilehelper.GetXmlAttribute(_fileName, "/config/realcalcu", "recordcalcutime").Value;
                realcalcu_recordsavenumber = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/realcalcu", "recordsavenumber").Value);

                //历史计算引擎相关配置
                historycalcu_period4RTD = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/historycalcu", "historycalcu_period4RTD").Value);
                historycalcu_period4PSL = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/historycalcu", "historycalcu_period4PSL").Value);

                //实时数据库配置信息
                rtdb_Type              = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rtdb", "type").Value;
                rtdb_connString        = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rtdb", "connstring").Value;
                rtdb_maxrepeatonerror  = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/rtdb", "maxrepeatonerror").Value);
                rtdb_waitsecondonerror = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/rtdb", "waitsecondonerror").Value);

                //关系数据库配置信息
                rdb_Type       = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rdb", "type").Value;
                rdb_connString = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rdb", "connstring").Value;
                //Console.WriteLine(rdb_connString);

                //关系库数据表设置
                rdbtable_resulttagauto            = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rdbtable", "resulttagauto").Value;
                rdbtable_resulttagincludeinterval = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rdbtable", "resulttagincludeinterval").Value;
                rdbtable_tag2idalwaysreset        = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rdbtable", "tag2idalwaysreset").Value;
                rdbtable_iniTableIncludePsldata   = xmlfilehelper.GetXmlAttribute(_fileName, "/config/rdbtable", "iniTableIncludePsldata").Value;
                rdbtable_constmaxnumber           = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/rdbtable", "constmaxnumber").Value);

                //关系库psldata数据表设置
                psldata_startyear     = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/psldata", "startyear").Value);
                psldata_endyear       = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/psldata", "endyear").Value);
                psldata_intervalmonth = int.Parse(xmlfilehelper.GetXmlAttribute(_fileName, "/config/psldata", "intervalmonth").Value);
            }
            catch (Exception e)
            {
                string messageStr = String.Format(e.Message + "{0}!", CONFIG_FILE);
                MessageBox.Show(messageStr, "读入计算引擎xml文件");
            }
        }