예제 #1
0
        public void Initial()
        {
            ConfigClass config = ImportXml(_settingPath) as ConfigClass;

            if (config == null)
            {
                _logger.Info("加载配置文件转换异常!采用默认配置。");
                _monitorSettings   = new List <MonitorModel>();
                _subscribeSettings = new List <SubscribeModel>();
                _listenPort        = 8888;
                _scanPerid         = 5;
                return;
            }
            else
            {
                _monitorSettings   = config.MonitorSettings;
                _subscribeSettings = config.SubscribeSettings;
                _listenPort        = config.ListenPort;
                _scanPerid         = config.ScanPeriod;
            }
        }
예제 #2
0
        public void Initial()
        {
            ConfigClass config = ImportXml(_settingPath) as ConfigClass;

            if (config == null)
            {
                string msg = "加载配置文件转换异常!采用默认配置。";
                _logger.Warn(msg);
                LogHelper.Instance.ErrorLogger.Add(new ErrorLogEntity(DateTime.Now, "ERROR", msg));
                _monitorSettings   = new List <MonitorModel>();
                _subscribeSettings = new List <SubscribeModel>();
                _listenPort        = 8888;
                _scanPerid         = 1;
                _exceptionSavePath = @"C:\ExceptionSave";
                if (!Directory.Exists(_exceptionSavePath))
                {
                    Directory.CreateDirectory(_exceptionSavePath);
                }
            }
            else
            {
                _monitorSettings   = config.MonitorSettings;
                _subscribeSettings = config.SubscribeSettings;
                _listenPort        = config.ListenPort;
                _scanPerid         = config.ScanPeriod;
                if (Directory.Exists(config.ExceptionSavePath))
                {
                    _exceptionSavePath = config.ExceptionSavePath;
                }
                else
                {
                    _exceptionSavePath = @"C:\ExceptionSave";
                }
                if (!Directory.Exists(_exceptionSavePath))
                {
                    Directory.CreateDirectory(_exceptionSavePath);
                }
            }
        }