示例#1
0
 private bool CheckElementExists(List <string> areaElementKeys, string elementName, string configPath,
                                 configurationArea area)
 {
     if (areaElementKeys.Contains(elementName))
     {
         _logger.Error(
             "Configuration [{0}] contains more than one element in area [{1}] with name [{2}]. Element will be ignored",
             configPath, area.name, elementName);
         return(true);
     }
     areaElementKeys.Add(elementName);
     return(false);
 }
示例#2
0
 private void HandleSettingObject(List <string> areaElementKeys, setting setting, string configPath, configurationArea area,
                                  Area areaObject)
 {
     if (CheckElementExists(areaElementKeys, setting.key, configPath, area))
     {
         return;
     }
     areaObject.Elements.Add(
         new Setting
     {
         Value = setting.value,
         Key   = setting.key
     });
 }
示例#3
0
        private bool HandleAlgorithmObject(List <string> areaElementKeys, algorithm algorithm, string configPath, configurationArea area,
                                           Area areaObject)
        {
            if (CheckElementExists(areaElementKeys, algorithm.key, configPath, area))
            {
                return(true);
            }
            var algorithmKeyList = new List <string>(algorithm.setting.Length);
            var algorithmObject  = new Algorithm
            {
                Name = algorithm.name,
                Key  = algorithm.key
            };

            foreach (var algorithmSetting in algorithm.setting)
            {
                if (!algorithmKeyList.Contains(algorithmSetting.key))
                {
                    algorithmObject.Settings.Add(
                        new Setting()
                    {
                        Key   = algorithmSetting.key,
                        Value = algorithmSetting.value
                    });
                }
            }
            areaObject.Elements.Add(algorithmObject);
            return(false);
        }