public void Process()
        {
            AppConfigurationSection section = (AppConfigurationSection)ConfigurationManager.GetSection("ConfigurationSection");
            var operationSystems            = section.OperationSystems.Cast <OperationSystemElement>().ToList();
            List <ILockTarget> targets      = new List <ILockTarget>();

            foreach (LockTargetElement element in section.LockTargets)
            {
                targets.Add(new Mikrotik(element.Target, element.Port, element.BlackList, element.User, element.Password));
            }
            var currentOperationSystemElement = operationSystems.FirstOrDefault(item => item.Version == Environment.OSVersion.VersionString) ?? operationSystems.FirstOrDefault(item => item.IsDefault);

            // get regex expressions
            List <String> expressions = new List <String>();

            foreach (var key in currentOperationSystemElement.SearchPatterns.AllKeys)
            {
                expressions.Add(currentOperationSystemElement.SearchPatterns[key].Value);
            }

            //get white list
            List <String> whiteList = new List <String>();

            foreach (var key in section.WhiteList.AllKeys)
            {
                whiteList.Add(section.WhiteList[key].Value);
            }

            var config = currentOperationSystemElement != null ? new OperationSystemConfig()
            {
                Version       = currentOperationSystemElement.Version,
                InstanceId    = currentOperationSystemElement.InstanceId,
                SearchEngines = expressions.Select(item => new Regex(item, RegexOptions.Singleline)).ToList(),
                Source        = currentOperationSystemElement.Source
            } : null;

            TimeSpan scanPeriod = TimeSpan.Parse(ConfigurationManager.AppSettings["ScanPeriod"]);
            Int32    countLimit = Int32.Parse(ConfigurationManager.AppSettings["CountLimit"]);

            if (config != null)
            {
                var ipList = this.GetIpList(config, scanPeriod, countLimit, whiteList).Distinct().ToList();
                this.SendBlockList(targets, ipList);
            }
            else
            {
                LogManager.GetLogger("Configuration").Error($"Unknown OS version {Environment.OSVersion.VersionString}");
            }

            targets.ForEach(target => target.Close());
            targets.Clear();
        }
 private AppConfigurationManager()
 {
     config = (AppConfigurationSection)ConfigurationManager.GetSection("appConfigurationSection");
 }