public static void SetBoolean(string option, bool value) { Initialize(); defaults[option] = value; if (persistent_settings == null) { return; } IEnumerable <string> collection = persistent_settings.GetSubCollectionNames("AntlrVSIX"); persistent_settings.SetBoolean("AntlrVSIX", option, value); }
public Settings(IServiceProvider provider) { SettingsManager settingsManager = new ShellSettingsManager(provider); _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!_settingsStore.CollectionExists("DebugAttachManagerProcesses")) { return; } IEnumerable <string> services = _settingsStore.GetSubCollectionNames("DebugAttachManagerProcesses"); foreach (var s in services) { var p = new StoredProcessInfo { ProcessName = _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "ProcessName"), Title = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "Title") ? _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "Title") : null, RemoteServerName = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemoteServerName") ? _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "RemoteServerName") : null, RemotePortNumber = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") ? _settingsStore.GetInt64("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") : (long?)null, Selected = _settingsStore.GetBoolean("DebugAttachManagerProcesses\\" + s, "Selected"), DebugMode = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "DebugMode") ? _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "DebugMode") : null }; Processes.Add(p.Hash, p); } if (_settingsStore.PropertyExists("DebugAttachManagerProcesses", "RemoteServer")) { RemoteServer = _settingsStore.GetString("DebugAttachManagerProcesses", "RemoteServer"); } }
public void LoadFilterStoreData() { SettingsManager settingsManager = new ShellSettingsManager(LogcatOutputToolWindowCommand.Instance.ServiceProvider); WritableSettingsStore settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (settingsStore.CollectionExists(StoreFilterCollectionName)) { int count = settingsStore.GetSubCollectionCount(StoreFilterCollectionName); IEnumerable <string> filter_name_list = settingsStore.GetSubCollectionNames(LogcatOutputToolWindowControl.StoreFilterCollectionName); if (filter_name_list == null) { return; } foreach (string name in filter_name_list) { string filter_sub_collection = StoreFilterCollectionName + "\\" + name; string tag = settingsStore.GetString(filter_sub_collection, LogcatOutputToolWindowControl.StorePropertyFilterTagName, ""); int pid = settingsStore.GetInt32(filter_sub_collection, LogcatOutputToolWindowControl.StorePropertyFilterPidName, 0); string msg = settingsStore.GetString(filter_sub_collection, LogcatOutputToolWindowControl.StorePropertyFilterMsgName, ""); string pkg = settingsStore.GetString(filter_sub_collection, LogcatOutputToolWindowControl.StorePropertyFilterPackageName, ""); int level = settingsStore.GetInt32(filter_sub_collection, LogcatOutputToolWindowControl.StorePropertyFilterLevelName, 0); AddFilterItem(name, tag, pid, msg, pkg, (LogcatOutputToolWindowControl.LogcatItem.Level)level, false); } } }
//-------- Generic methods for handling ShortcutFileInfo in UserSettingsStore public List <ShortcutFileInfo> FetchShortcutFileInfo(string collectionName) { List <ShortcutFileInfo> shortcutFiles = new List <ShortcutFileInfo>(); if (UserSettingsStore.CollectionExists(collectionName)) { foreach (var shortcutDef in UserSettingsStore.GetSubCollectionNames(collectionName)) { shortcutFiles.Add(ExtractShortcutsInfoFromSettingsStore(collectionName, shortcutDef)); } } return(shortcutFiles); }
public Settings(IServiceProvider provider) { SettingsManager settingsManager = new ShellSettingsManager(provider); _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!_settingsStore.CollectionExists("DebugAttachManagerProcesses")) { return; } IEnumerable <string> services = _settingsStore.GetSubCollectionNames("DebugAttachManagerProcesses"); foreach (var s in services) { var p = new StoredProcessInfo { ProcessName = _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "ProcessName"), Title = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "Title") ? _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "Title") : null, RemoteServerName = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemoteServerName") ? _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "RemoteServerName") : null, RemotePortNumber = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") ? _settingsStore.GetInt64("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") : (long?)null, Selected = _settingsStore.GetBoolean("DebugAttachManagerProcesses\\" + s, "Selected"), DebugMode = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "DebugMode") ? _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "DebugMode") : null }; Processes.Add(p.Hash, p); } if (_settingsStore.PropertyExists("DebugAttachManagerProcesses", "RemoteServer")) { RemoteServer = _settingsStore.GetString("DebugAttachManagerProcesses", "RemoteServer"); } for (int i = 0; i < Constants.NUMBER_OF_OPTIONAL_COLUMNS; i++) { string columnName = $"Column{i}"; if (_settingsStore.PropertyExists("DebugAttachManagerProcesses", columnName)) { ProcessesColumns[i] = _settingsStore.GetBoolean("DebugAttachManagerProcesses", columnName); } else { if (i == 0) { // This is a hack, so we display PID by default ProcessesColumns[i] = true; } } } }
private static void Initialize() { if (initialized) { return; } object dte2 = null; try { dte2 = Package.GetGlobalService(typeof(SDTE)); } catch (Exception) { } if (dte2 == null) { initialized = true; return; } IServiceProvider isp = (IServiceProvider)dte2; ServiceProvider sp = new ServiceProvider(isp); var settingsManager = new ShellSettingsManager(sp); persistent_settings = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); try { IEnumerable <string> collection = persistent_settings.GetSubCollectionNames("AntlrVSIX"); persistent_store_initialized = true; } catch (Exception) { persistent_settings.CreateCollection("AntlrVSIX"); persistent_store_initialized = false; } if (!persistent_store_initialized) { defaults.TryGetValue("RestrictedDirectory", out object RestrictedDirectory); POptions.SetBoolean("RestrictedDirectory", (bool)RestrictedDirectory); defaults.TryGetValue("NonInteractiveParse", out object NonInteractiveParse); POptions.SetBoolean("NonInteractiveParse", (bool)NonInteractiveParse); defaults.TryGetValue("GenerateVisitorListener", out object GenerateVisitorListener); POptions.SetBoolean("GenerateVisitorListener", (bool)GenerateVisitorListener); defaults.TryGetValue("CorpusLocation", out object CorpusLocation); POptions.SetString("CorpusLocation", (string)CorpusLocation); defaults.TryGetValue("IncrementalReformat", out object IncrementalReformat); POptions.SetBoolean("IncrementalReformat", (bool)IncrementalReformat); defaults.TryGetValue("OverrideAntlrPluggins", out object OverrideAntlrPluggins); POptions.SetBoolean("OverrideAntlrPluggins", (bool)OverrideAntlrPluggins); defaults.TryGetValue("OverrideJavaPluggins", out object OverrideJavaPluggins); POptions.SetBoolean("OverrideJavaPluggins", (bool)OverrideJavaPluggins); defaults.TryGetValue("OverridePythonPluggins", out object OverridePythonPluggins); POptions.SetBoolean("OverridePythonPluggins", (bool)OverridePythonPluggins); defaults.TryGetValue("OverrideRustPluggins", out object OverrideRustPluggins); POptions.SetBoolean("OverrideRustPluggins", (bool)OverrideRustPluggins); defaults.TryGetValue("OptInLogging", out object OptInLogging); POptions.SetInt32("OptInLogging", (int)OptInLogging); } initialized = true; }