public void Save() { // When writing the template caches, we need the existing cache version to read the existing caches for before updating. // so don't update it until after the template caches are written. _userTemplateCache.WriteTemplateCaches(_userSettings.Version); // now it's safe to update the cache version, which is written in the settings file. _userSettings.SetVersionToCurrent(); JObject serialized = JObject.FromObject(_userSettings); _paths.WriteAllText(_paths.User.SettingsFile, serialized.ToString()); }
private void Save(TemplateCache cacheToSave) { // When writing the template caches, we need the existing cache version to read the existing caches for before updating. // so don't update it until after the template caches are written. cacheToSave.WriteTemplateCaches(_userSettings.Version); // now it's safe to update the cache version, which is written in the settings file. _userSettings.SetVersionToCurrent(); JObject serialized = JObject.FromObject(_userSettings); _paths.WriteAllText(_paths.User.SettingsFile, serialized.ToString()); WriteInstallDescriptorCache(); if (_userTemplateCache != cacheToSave) // object equals { ReloadTemplates(); } }