//------------------------------------------------------------------------------ IEnumerable <string> GetSimpleSettingsNamesImpl(IEnumerable <string> fullSettingsNames) { if (fullSettingsNames == null) { return(null); } var settingsNames = new List <string>(); var serializer = SettingsHelper.GetSerializerDependFromSettingAttributeType(this.Context, typeof(ATTRIBUTE)); var delimeter = SettingNameFormatInfo.GetSettingNameDelimeter(serializer as ISettingsSerializerWishes); foreach (var fullSettingName in fullSettingsNames) { string formatVersionPrefix; string typeInfo; string settingName; var parseResult = SettingNameFormatInfo.Parse(fullSettingName, delimeter, out formatVersionPrefix, out typeInfo, out settingName, SettingNameMode.Dynamic); if (parseResult) { settingsNames.Add(settingName); } } return(settingsNames); }
//------------------------------------------------------------------------------ IEnumerable <string> GetDynamicSettingsNamesForType(ISettingsSerializer serializer, Type settingsType, bool respectOrder) { IEnumerable <string> result = null; var dynamicSettingsInfo = (IDynamicSettingsInfo)serializer; var delimeter = SettingNameFormatInfo.GetSettingNameDelimeter(serializer as ISettingsSerializerWishes); var settingsTypeInfo = SettingNameFormatInfo.GetSettingsTypeInfo(settingsType, serializer as ISettingsSerializerWishes); var settingsNames = dynamicSettingsInfo.GetDynamicSettingsNames(); var filteredSettingsNames = new List <string>(); foreach (var rawSettingName in settingsNames) { string formatVersion; string typeInfo; string name; bool parseResult = SettingNameFormatInfo.Parse(rawSettingName, delimeter, out formatVersion, out typeInfo, out name, SettingNameMode.Dynamic); if (parseResult) { if (settingsTypeInfo == typeInfo) { filteredSettingsNames.Add(rawSettingName); } } } result = filteredSettingsNames; if (respectOrder) { var settingsOrder = LoadDynamicSettingsDefaultOrder(serializer, settingsType); if (settingsOrder != null) { var fullSettingsNamesCustomOrder = new List <string>(); foreach (var simpleSettingName in settingsOrder) { var fullSettingName = SettingNameFormatInfo.GetFullSettingName(simpleSettingName, serializer as ISettingsSerializerWishes, settingsType, SettingNameMode.Dynamic); fullSettingsNamesCustomOrder.Add(fullSettingName); } // берём только то, что есть в каждой коллекции result = fullSettingsNamesCustomOrder.Intersect(result); } } return(result); }