/// <summary>
        /// 初始化参数  port   timeout   xmal.config 里面的配置   获取成功返回ture
        /// </summary>
        /// <returns></returns>
        private bool loadConfig()
        {
            try
            {
                dtuPort = int.Parse(xmlHelper.getValue("dtuServerPort"));
                webPort = int.Parse(xmlHelper.getValue("webServerPort"));
                timeout = int.Parse(xmlHelper.getValue("socketTimeout"));
                connectedCount = int.Parse(xmlHelper.getValue("connectedCount"));
                int infoLog = int.Parse(xmlHelper.getValue("infoLogEnable"));
                int errorLog = int.Parse(xmlHelper.getValue("errorLogEnable"));
                int recordEvent = int.Parse(xmlHelper.getValue("recordEventEnable"));
                if (infoLog == 1)
                {
                    showInfoLog = true;
                }
                else
                {
                    showInfoLog = false;
                }
                if (errorLog == 1)
                {
                    showErrorLog = true;
                }
                else
                {
                    showErrorLog = false;
                }
                if (recordEvent == 1)
                {
                    this.recordEventEnable = true;
                }
                else
                {
                    this.recordEventEnable = false;
                }

                CityServerIp = xmlHelper.getValue("CityServerIp");
                try
                {
                    CityServerPort = int.Parse(xmlHelper.getValue("CityServerPort"));
                }
                catch { CityServerPort = 0; }
                return true;
            }
            catch (Exception)
            {
                MessageBox.Show("读取配置信息出错!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
        }
Exemple #2
0
        /// <summary>
        /// 初始化参数  port   timeout   xmal.config 里面的配置   获取成功返回ture
        /// </summary>
        /// <returns></returns>
        private bool loadConfig()
        {
            try
            {
                dtuPort        = int.Parse(xmlHelper.getValue("dtuServerPort"));
                webPort        = int.Parse(xmlHelper.getValue("webServerPort"));
                timeout        = int.Parse(xmlHelper.getValue("socketTimeout"));
                connectedCount = int.Parse(xmlHelper.getValue("connectedCount"));
                int infoLog     = int.Parse(xmlHelper.getValue("infoLogEnable"));
                int errorLog    = int.Parse(xmlHelper.getValue("errorLogEnable"));
                int recordEvent = int.Parse(xmlHelper.getValue("recordEventEnable"));
                if (infoLog == 1)
                {
                    showInfoLog = true;
                }
                else
                {
                    showInfoLog = false;
                }
                if (errorLog == 1)
                {
                    showErrorLog = true;
                }
                else
                {
                    showErrorLog = false;
                }
                if (recordEvent == 1)
                {
                    this.recordEventEnable = true;
                }
                else
                {
                    this.recordEventEnable = false;
                }

                SysCache.ShowInfoLog  = showInfoLog;
                SysCache.ShowErrorLog = showErrorLog;
                SysCache.RecordEevent = recordEventEnable;

                BaseMessage.ShowLog      = SysCache.ShowInfoLog;
                WaterBaseMessage.ShowLog = SysCache.ShowInfoLog;

                FilePathCache.Path = xmlHelper.getValue("imgSavePath").Trim('/') + "/";
                return(true);
            }
            catch (Exception)
            {
                MessageBox.Show("读取配置信息出错,程序退出!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                System.Environment.Exit(0);
                return(false);
            }
        }