/// <summary>
        /// Returns a list of <see cref="SettingsPropertyDescriptor"/> objects describing each property belonging
        /// to a settings group.
        /// </summary>
        /// <remarks>
        /// The specified group must refer to a locally installed settings class.
        /// </remarks>
        public static List <SettingsPropertyDescriptor> ListSettingsProperties(SettingsGroupDescriptor group)
        {
            Platform.CheckForNullReference(group, "group");

            var settingsClass = Type.GetType(group.AssemblyQualifiedTypeName);

            if (settingsClass == null)
            {
                throw new SettingsException(string.Format("{0} is not a locally installed settings group.", group.Name));
            }

            return(SettingsClassMetaDataReader.GetSettingsProperties(settingsClass)
                   .Select(property => new SettingsPropertyDescriptor(property)).ToList());
        }
        /// <summary>
        /// Returns a list of <see cref="SettingsPropertyDescriptor"/> objects describing each property belonging
        /// to a settings group.
        /// </summary>
        public static List <SettingsPropertyDescriptor> ListSettingsProperties(SettingsGroupDescriptor group)
        {
            Type settingsClass = Type.GetType(group.AssemblyQualifiedTypeName);

            return(CollectionUtils.Map <PropertyInfo, SettingsPropertyDescriptor, List <SettingsPropertyDescriptor> >(
                       SettingsClassMetaDataReader.GetSettingsProperties(settingsClass),
                       delegate(PropertyInfo p)
            {
                SettingsPropertyDescriptor info = new SettingsPropertyDescriptor(
                    SettingsClassMetaDataReader.GetName(p),
                    SettingsClassMetaDataReader.GetType(p).FullName,
                    SettingsClassMetaDataReader.GetDescription(p),
                    SettingsClassMetaDataReader.GetScope(p),
                    SettingsClassMetaDataReader.GetDefaultValue(p));
                return info;
            }));
        }
Ejemplo n.º 3
0
 private static ICollection <PropertyInfo> GetProperties(Type settingsClass, SettingScope scope)
 {
     return(SettingsClassMetaDataReader.GetSettingsProperties(settingsClass, scope));
 }