public void DeleteCollection() { if (_settingsStore != null && _settingsStore.CollectionExists(CollectionPath)) { _settingsStore.DeleteCollection(CollectionPath); } }
protected void ClearAllSettings(string settingsRoot) { WritableSettingsStore userSettingsStore = _settingsManager.Value.GetWritableSettingsStore(SettingsScope.UserSettings); if (userSettingsStore.CollectionExists(settingsRoot)) { userSettingsStore.DeleteCollection(settingsRoot); } }
public void Reset() { if (settingsStore.CollectionExists(collectionPath)) { settingsStore.DeleteCollection(collectionPath); } settingsStore.CreateCollection(collectionPath); serviceContainer.Get <MainViewModel>().Update(); }
public void Save() { int i = 1; if (_settingsStore.CollectionExists("DebugAttachManagerProcesses")) { _settingsStore.DeleteCollection("DebugAttachManagerProcesses"); } foreach (var p in Processes.Values) { _settingsStore.CreateCollection("DebugAttachManagerProcesses\\Process " + i); if (p.Title != null) { _settingsStore.SetString("DebugAttachManagerProcesses\\Process " + i, "Title", p.Title); } if (p.RemoteServerName != null) { _settingsStore.SetString("DebugAttachManagerProcesses\\Process " + i, "RemoteServerName", p.RemoteServerName); } if (p.RemotePortNumber.HasValue) { _settingsStore.SetInt64("DebugAttachManagerProcesses\\Process " + i, "RemotePortNumber", p.RemotePortNumber.Value); } _settingsStore.SetString("DebugAttachManagerProcesses\\Process " + i, "ProcessName", p.ProcessName); _settingsStore.SetBoolean("DebugAttachManagerProcesses\\Process " + i, "Selected", p.Selected); if (p.DebugMode != null) { _settingsStore.SetString("DebugAttachManagerProcesses\\Process " + i, "DebugMode", p.DebugMode); } i++; } if (!_settingsStore.CollectionExists("DebugAttachManagerProcesses")) { _settingsStore.CreateCollection("DebugAttachManagerProcesses"); } if (!string.IsNullOrEmpty(RemoteServer)) { _settingsStore.SetString("DebugAttachManagerProcesses", "RemoteServer", RemoteServer); } if (!string.IsNullOrEmpty(RemotePort)) { _settingsStore.SetString("DebugAttachManagerProcesses", "RemotePort", RemotePort); } if (!string.IsNullOrEmpty(RemoteUserName)) { _settingsStore.SetString("DebugAttachManagerProcesses", "RemoteUserName", RemoteUserName); } for (i = 0; i < Constants.NUMBER_OF_OPTIONAL_COLUMNS; i++) { string columnName = $"Column{i}"; _settingsStore.SetBoolean("DebugAttachManagerProcesses", columnName, _processesColumns[i]); } }
public void DeleteCategory(string category) { var path = GetCollectionPath(category); try { _settingsStore.DeleteCollection(path); } catch (ArgumentException) { // Documentation is a lie - raises ArgumentException if the // collection does not exist. } }
public void DeleteFilterStoreData(string name) { SettingsManager settingsManager = new ShellSettingsManager(LogcatOutputToolWindowCommand.Instance.ServiceProvider); WritableSettingsStore settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (settingsStore.CollectionExists(StoreFilterCollectionName)) { string filter_sub_collection = StoreFilterCollectionName + "\\" + name; settingsStore.DeleteCollection(filter_sub_collection); } }
private void SaveSettings() { if (SettingsStore.CollectionExists(RecentCommandLinesCollectionName)) { SettingsStore.DeleteCollection(RecentCommandLinesCollectionName); } SettingsStore.CreateCollection(RecentCommandLinesCollectionName); for (int i = 0; i < RecentCommandLines.Count; i++) { SettingsStore.SetString(RecentCommandLinesCollectionName, i.ToString(), RecentCommandLines[i]); } }
/// <summary> /// This is used to reset the configuration to its default state /// </summary> /// <param name="deleteConfigurationFile">True to delete the configuration settings collection if it exists, /// false to just set the default values</param> public void ResetConfiguration(bool deleteConfigurationFile) { EnableExtendedXmlCommentsCompletion = EnableGoToDefinition = true; EnableGoToDefinitionInCRef = DefaultEnableGoToDefinitionInCRef; ShellSettingsManager settingsManager = new ShellSettingsManager(_serviceProvider); WritableSettingsStore settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (deleteConfigurationFile && settingsStore.CollectionExists(CollectionPath)) { settingsStore.DeleteCollection(CollectionPath); } }
public void RemoveProfileTest() { var defaultProfileSettings = Path.Combine(SolutionSettings, DefaultProfileName); using (mocks.Record()) { // we already have default settings Expect.Call(store.CollectionExists(SolutionSettings)).Return(true); // validation Expect.Call(store.CollectionExists(defaultProfileSettings)).Return(true); // actual delete Expect.Call(store.DeleteCollection(defaultProfileSettings)).Return(true); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); settings.RemoveProfile(DefaultProfileName); } }
protected override void Dispose(bool disposing) { if (disposing) { using (ServiceProvider serviceProvider = new ServiceProvider((IServiceProvider)(Package.GetGlobalService(typeof(IServiceProvider))))) { SettingsManager settingsManager = new ShellSettingsManager(serviceProvider); WritableSettingsStore settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (settingsStore.CollectionExists(FilterSettings)) { settingsStore.DeleteCollection(FilterSettings); } settingsStore.CreateCollection(FilterSettings); for (int i = 0; (i < CommonFilters.Count); ++i) { settingsStore.SetString(FilterSettings, i.ToString(), CommonFilters[i]); } } } base.Dispose(disposing); }
public void Defaults() { writableSettingsStore.DeleteCollection(Constants.SettingsCollectionPath); LoadSettings(); }
public void ResetUserShortcutsRegistry() { UserShortcutsRegistry.Clear(); UserSettingsStore.DeleteCollection(USER_SHORTCUTS_DEFS); }
public void DeleteCollection(string collectionName) { store.DeleteCollection(collectionName); }