private SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties, bool returnPrevious)
        {
            bool   anyUserScopedSettings = AnyUserScoped(properties);
            Type   settingsClass         = (Type)context["SettingsClassType"];
            string settingsKey           = (string)context["SettingsKey"];
            string user = anyUserScopedSettings ? Thread.CurrentPrincipal.Identity.Name : null;

            var group = new SettingsGroupDescriptor(settingsClass);

            if (returnPrevious)
            {
                group = _store.GetPreviousSettingsGroup(group);
            }
            else if (anyUserScopedSettings)
            {
                SettingsMigrator.MigrateUserSettings(group);
            }

            var storedValues = new Dictionary <string, string>();

            if (group != null)
            {
                foreach (var userDefault in _store.GetSettingsValues(group, null, settingsKey))
                {
                    storedValues[userDefault.Key] = userDefault.Value;
                }

                if (anyUserScopedSettings)
                {
                    foreach (var userValue in _store.GetSettingsValues(group, user, settingsKey))
                    {
                        storedValues[userValue.Key] = userValue.Value;
                    }
                }
            }

            return(GetSettingsValues(properties, storedValues));
        }
Exemple #2
0
 public abstract void RemoveUserSettings(SettingsGroupDescriptor group, string user, string instanceKey);
Exemple #3
0
 public abstract void PutSettingsValues(SettingsGroupDescriptor group, string user, string instanceKey, Dictionary <string, string> dirtyValues);
Exemple #4
0
 public abstract Dictionary <string, string> GetSettingsValues(SettingsGroupDescriptor group, string user, string instanceKey);
Exemple #5
0
 public abstract void ImportSettingsGroup(SettingsGroupDescriptor group, List <SettingsPropertyDescriptor> properties);
Exemple #6
0
 public abstract IList <SettingsPropertyDescriptor> ListSettingsProperties(SettingsGroupDescriptor group);
Exemple #7
0
 public abstract SettingsGroupDescriptor GetPreviousSettingsGroup(SettingsGroupDescriptor group);
Exemple #8
0
 public static UserSettingsUpgradeStep Create(SettingsGroupDescriptor settingsGroup)
 {
     return(Create(ApplicationSettingsHelper.GetSettingsClass(settingsGroup)));
 }
Exemple #9
0
 public static bool MigrateSharedSettings(SettingsGroupDescriptor settingsGroup, string previousExeConfigFilename)
 {
     return(MigrateSharedSettings(ApplicationSettingsHelper.GetSettingsClass(settingsGroup), previousExeConfigFilename));
 }
Exemple #10
0
 public static bool MigrateUserSettings(SettingsGroupDescriptor settingsGroup)
 {
     return(MigrateUserSettings(ApplicationSettingsHelper.GetSettingsClass(settingsGroup)));
 }