Пример #1
0
 public SettingsGroupsCollection(IEnumerable <Type> taskSettings)
 {
     foreach (var taskType in taskSettings)
     {
         var groups = SettingsIni.GetSections(taskType.Name);
         groups.ForEach(x => _list.Add(SettingsIni.GetGroupName(x)));
     }
     _list = _list.Distinct().ToList();
 }
Пример #2
0
        public SettingsGroupRepresentDictionary(string groupName, IEnumerable <Type> taskSettings)
        {
            GroupName = groupName;
            var typeMap  = taskSettings.ToDictionary(t => t.Name);
            var sections = SettingsIni.GetSectionsByGroupName(groupName);

            foreach (var section in sections)
            {
                var className = SettingsIni.GetClassName(section);
                if (typeMap.ContainsKey(className))
                {
                    Add(className, Activator.CreateInstance(typeMap[className], groupName));
                }
            }
        }
Пример #3
0
 public SettingsRepresentCollection(Type settingRepresentType)
 {
     SettingsRepresentTypeName = settingRepresentType.Name;
     SettingsIni.GetSections(SettingsRepresentTypeName).ForEach(t => _list.Add(Activator.CreateInstance(settingRepresentType, t)));
 }