Exemple #1
0
        public static UserSettingsUpgradeStep Create(Type settingsClass)
        {
            //Important: this line first so we can't get into infinite recursion issues with trying
            //to migrate the UpgradeSettings class on first access (SettingsStoreSettingsProvider does that).
            if (!ApplicationSettingsHelper.IsUserSettingsMigrationEnabled(settingsClass))
            {
                return(null);
            }

            if (!new SettingsGroupDescriptor(settingsClass).HasUserScopedSettings)
            {
                return(null);                //no point
            }
            if (!UpgradeSettings.IsUserUpgradeEnabled())
            {
                return(null);
            }

            if (UpgradeSettings.Default.IsUserUpgradeStepCompleted(settingsClass.FullName))
            {
                return(null);
            }

            ApplicationSettingsBase settings = ApplicationSettingsHelper.GetSettingsClassInstance(settingsClass);

            return(new UserSettingsUpgradeStep(settings));
        }
Exemple #2
0
        public static bool MigrateSharedSettings(Type settingsClass, string previousExeConfigFilename)
        {
            if (!ApplicationSettingsHelper.IsSharedSettingsMigrationEnabled(settingsClass))
            {
                return(false);
            }

            ApplicationSettingsBase settings = ApplicationSettingsHelper.GetSettingsClassInstance(settingsClass);

            ApplicationSettingsExtensions.MigrateSharedSettings(settings, previousExeConfigFilename);
            return(true);
        }