public void SaveSettingsToStorage(RemarkerService service) { Contract.Requires(service != null); lock (ProfileManager.dataLock) { if (ProfileManager.backupSettings != null) { return; } } RegistryKey key = null; try { key = service.Package.UserRegistryRoot.CreateSubKey(ProfileManager.SUBKEY_NAME); Debug.Assert(key != null, "key != null"); key.SetValue("Version", service.Version); foreach (var valueName in service.ValueNames) { service.Save(key, valueName); } } finally { if (key != null) { key.Close(); } } }
public void SaveSettingsToXml(IVsSettingsWriter writer) { RemarkerService service = this.Service; var stringBuilder = new StringBuilder(); foreach (var valueName in service.ValueNames) { stringBuilder.Append(valueName); stringBuilder.Append(";"); service.Save(writer, valueName); } writer.WriteSettingLong("Version", service.Version); writer.WriteSettingString("ValueKeys", stringBuilder.ToString()); }