Beispiel #1
0
        public bool RollBackSettings()
        {
            lock (ProfileManager.dataLock)
            {
                if (ProfileManager.backupCount == 0)
                {
                    return(false);
                }

                if (ProfileManager.backupSettings == null)
                {
                    ProfileManager.backupCount--;
                    return(false);
                }

                RemarkerService service = this.Service;
                foreach (var backupSetting in ProfileManager.backupSettings)
                {
                    // Restore the original setting
                    service.Load(backupSetting.Value, backupSetting.Key);
                }

                return(true);
            }
        }
Beispiel #2
0
        public void LoadSettingsFromXml(IVsSettingsReader reader)
        {
            string valueKeysString;

            reader.ReadSettingString("ValueKeys", out valueKeysString);
            RemarkerService service = this.Service;

            foreach (var valueKey in valueKeysString.Split(';').Where(
                         valueKey => !string.IsNullOrWhiteSpace(valueKey)))
            {
                try
                {
                    service.Load(reader, valueKey);
                }
                catch (Exception)
                {
                }
            }
        }
Beispiel #3
0
        public void LoadSettingsFromStorage(RemarkerService service)
        {
            Contract.Requires(service != null);

            lock (ProfileManager.dataLock)
            {
                if (ProfileManager.backupSettings != null)
                {
                    return;
                }
            }

            RegistryKey key = null;

            try
            {
                key = service.Package.UserRegistryRoot.OpenSubKey(ProfileManager.SUBKEY_NAME);

                foreach (var valueName in service.ValueNames)
                {
                    service.Load(key, valueName);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(string.Format("Remarker::LoadSettingsFromStorage: {0}",
                                              ex));
            }
            finally
            {
                if (key != null)
                {
                    key.Close();
                }
            }
        }