public object Read(string subPath, string property, object defaultValue) { Validate.IsNotNull(property, nameof(property)); Validate.IsNotEmpty(property, nameof(property)); var collection = subPath != null?Path.Combine(_root, subPath) : _root; _store.CreateCollection(collection); if (defaultValue is bool b) { return(_store.GetBoolean(collection, property, b)); } if (defaultValue is int i) { return(_store.GetInt32(collection, property, i)); } if (defaultValue is uint u) { return(_store.GetUInt32(collection, property, u)); } if (defaultValue is long l) { return(_store.GetInt64(collection, property, l)); } if (defaultValue is ulong ul) { return(_store.GetUInt64(collection, property, ul)); } return(_store.GetString(collection, property, defaultValue?.ToString() ?? "")); }
/// <summary> /// Read from a settings store /// </summary> /// <typeparam name="T"></typeparam> /// <param name="subpath">The subcollection path (appended to the path passed to the constructor)</param> /// <param name="property">The property name to read</param> /// <param name="defaultValue">The default value to use in case the property doesn't exist. /// The type of the default value will be used to figure out the proper way to read the property, so if pass null, /// the property will be read as a string (which may or may not be what you want)</param> /// <returns></returns> public object Read(string subpath, string property, object defaultValue) { Guard.ArgumentNotNull(property, nameof(property)); Guard.ArgumentNotEmptyString(property, nameof(property)); var collection = subpath != null?Path.Combine(root, subpath) : root; store.CreateCollection(collection); if (defaultValue is bool) { return(store.GetBoolean(collection, property, (bool)defaultValue)); } else if (defaultValue is int) { return(store.GetInt32(collection, property, (int)defaultValue)); } else if (defaultValue is uint) { return(store.GetUInt32(collection, property, (uint)defaultValue)); } else if (defaultValue is long) { return(store.GetInt64(collection, property, (long)defaultValue)); } else if (defaultValue is ulong) { return(store.GetUInt64(collection, property, (ulong)defaultValue)); } return(store.GetString(collection, property, defaultValue?.ToString() ?? "")); }
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]); } }
private void SaveShortcutFileInfoToSettingsStore(string collectionPrefix, ShortcutFileInfo shortcutFileInfo) { // Store values in UserSettingsStore. Use the "Name" property as the Collection key string collectionPath = $"{collectionPrefix}\\{shortcutFileInfo.DisplayName}"; UserSettingsStore.CreateCollection(collectionPath); UserSettingsStore.SetString(collectionPath, NAME, shortcutFileInfo.DisplayName); UserSettingsStore.SetString(collectionPath, FILEPATH, shortcutFileInfo.Filepath); UserSettingsStore.SetString(collectionPath, EXTENSION_NAME, shortcutFileInfo.ExtensionName); UserSettingsStore.SetString(collectionPath, LAST_WRITE_TIME, shortcutFileInfo.LastWriteTime.ToString(ShortcutFileInfo.DATETIME_FORMAT)); UserSettingsStore.SetInt32(collectionPath, FLAGS, shortcutFileInfo.NotifyFlag); }
public void SaveSettings([NotNull] MvvmToolsSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (!_userSettingsStore.CollectionExists(SettingsPropName)) { _userSettingsStore.CreateCollection(SettingsPropName); } SetEnum(GoToViewOrViewModelPropName, settings.GoToViewOrViewModelOption); SetBool(GoToViewOrViewModelSearchSolutionPropName, settings.GoToViewOrViewModelSearchSolution); SetStringCollection(ViewSuffixesPropName, settings.ViewSuffixes); SetString(LocalTemplateFolderPropName, settings.LocalTemplateFolder); // If a solution is loaded... if (settings.SolutionOptions != null) { // Save solution and project option files, or delete them if they // match the inherited values. SaveOrDeleteSettingsFile(settings.SolutionOptions, SolutionDefaultProjectOptions); foreach (var p in settings.ProjectOptions) { if (!string.IsNullOrWhiteSpace(p?.ProjectModel?.SettingsFile)) { SaveOrDeleteSettingsFile(p, settings.SolutionOptions); } } } }
private static void EnsureSettingsStoreCollectionExists(WritableSettingsStore userSettingsStore) { if (!userSettingsStore.CollectionExists(PathCollectionString)) { userSettingsStore.CreateCollection(PathCollectionString); } }
/// <summary> The value of the wrapped property is retrieved by calling the property get method on <paramref name="baseOptionModel"/>. /// This value is converted or serialized to a native type supported by the <paramref name="settingsStore"/>, /// then persisted to the store, assuring the collection exists first. No exceptions should be thrown from /// this method. </summary> /// <typeparam name="TOptMdl"> Type of the base option model. </typeparam> /// <param name="baseOptionModel"> The base option model which is used as the target object from which the property /// value will be retrieved. It also can be used for serialization of stored data. </param> /// <param name="settingsStore"> The settings store to set the setting value in. </param> /// <returns> True if we were able to persist the value in the store. However, if the serialization results in a null value, /// it cannot be persisted in the settings store and false will be returned. False is also returned if any step /// of the process failed, and these are logged. </returns> public virtual bool Save <TOptMdl>(BaseOptionModel <TOptMdl> baseOptionModel, WritableSettingsStore settingsStore) where TOptMdl : BaseOptionModel <TOptMdl>, new() { string collectionName = OverrideCollectionName ?? baseOptionModel.CollectionName; object?value = null; try { value = WrappedPropertyGetMethod(baseOptionModel); value = ConvertPropertyTypeToStorageType(value, baseOptionModel); if (value == null) { Exception ex = new("Cannot store null in settings store."); ex.LogAsync("BaseOptionModel<{0}>.{1} CollectionName:{2} PropertyName:{3} dataType:{4} PropertyType:{5} Value:{6}", baseOptionModel.GetType().FullName, nameof(Load), collectionName, PropertyName, DataType, PropertyInfo.PropertyType, value ?? "[NULL]").Forget(); return(false); } // Rather than if ! CollectionExists then CreateCollection this is likely more efficient. settingsStore.CreateCollection(collectionName); SettingStoreSetMethod(settingsStore, collectionName, PropertyName, value); return(true); } catch (Exception ex) { ex.Log("BaseOptionModel<{0}>.{1} CollectionName:{2} PropertyName:{3} dataType:{4} PropertyType:{5} Value:{6}", baseOptionModel.GetType().FullName, nameof(Load), collectionName, PropertyName, DataType, PropertyInfo.PropertyType, value ?? "[NULL]"); } return(false); }
public void Store() { try { if (!writableSettingsStore.CollectionExists(Constants.SettingsCollectionPath)) { writableSettingsStore.CreateCollection(Constants.SettingsCollectionPath); } writableSettingsStore.SetInt32(Constants.SettingsCollectionPath, "FilenameColor", this.FilenameColor.ToArgb()); writableSettingsStore.SetInt32(Constants.SettingsCollectionPath, "FoldersColor", this.FoldersColor.ToArgb()); writableSettingsStore.SetInt32(Constants.SettingsCollectionPath, "ProjectColor", this.ProjectColor.ToArgb()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "ViewFilename", this.ViewFilename.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "ViewFolders", this.ViewFolders.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "ViewProject", this.ViewProject.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "FilenameSize", this.FilenameSize.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "FoldersSize", this.FoldersSize.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "ProjectSize", this.ProjectSize.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "Position", this.Position.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "Opacity", this.Opacity.ToString()); writableSettingsStore.SetString(Constants.SettingsCollectionPath, "Theme", this.Theme.ToString()); SettingsChanged?.Invoke(this, EventArgs.Empty); } catch (Exception ex) { Debug.Fail(ex.Message); } }
/// <summary> /// Saves the properties to the registry asyncronously. /// </summary> public virtual async Task SaveAsync() { ShellSettingsManager manager = await _settingsManager.GetValueAsync().ConfigureAwait(true); WritableSettingsStore settingsStore = manager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settingsStore.CollectionExists(CollectionName)) { settingsStore.CreateCollection(CollectionName); } #if DEBUG_OPTION_VALUES_LOAD_SAVE Debug.WriteLine($"SaveAsync<{typeof(T).Name}>()"); #endif var propertiesToSerialize = GetOptionProperties(); foreach (PropertyInfo property in propertiesToSerialize) { string output = SerializeValue(property.GetValue(this)); #if DEBUG_OPTION_VALUES_LOAD_SAVE Debug.WriteLine($"{property.Name} = {property.GetValue(this)}"); #endif settingsStore.SetString(CollectionName, property.Name, output); } #if DEBUG_OPTION_VALUES_LOAD_SAVE Debug.WriteLine($"SaveAsync<{typeof(T).Name}>() finished ================================="); #endif }
private void SaveSetingsString(string settingsString) { try { if (!_writableSettingsStore.CollectionExists(CollectionPath)) { _writableSettingsStore.CreateCollection(CollectionPath); } _writableSettingsStore.SetString(CollectionPath, PropertyName, settingsString); } catch (Exception ex) { Debug.Fail(ex.Message); } }
public bool WriteStringData(string key, string value) { try { if (!_writableSettingsStore.CollectionExists(tasCollectionPath)) { _writableSettingsStore.CreateCollection(tasCollectionPath); } _writableSettingsStore.SetString(tasCollectionPath, key, value); if (_writableSettingsStore.PropertyExists(tasCollectionPath, key)) { return(true); } else { throw new Exception($"Tried to write value \"{value}\" to user settings store property \"{key}\" but no such property existed after writing."); } } catch (Exception ex) { _logger.Error(ex.Message); return(false); } }
private void RaiseParametersChanged(Parameter param) { if (ParametersChanged != null) { ParametersChanged(this, new ParametersEnventArgs(param)); } if (param == Parameter.Port || param == Parameter.DisableESMTP) { SettingsManager settingsManager = new ShellSettingsManager(VMSTPSettingsStore.ServiceProvider); WritableSettingsStore configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); bool collectionExists = configurationSettingsStore.CollectionExists(VMSTPSettingsStore.Collection); if (!collectionExists) { configurationSettingsStore.CreateCollection(VMSTPSettingsStore.Collection); } if (collectionExists || configurationSettingsStore.CollectionExists(VMSTPSettingsStore.Collection)) { configurationSettingsStore.SetBoolean(VMSTPSettingsStore.Collection, "DisableESMTP", DisableESMTP); configurationSettingsStore.SetInt32(VMSTPSettingsStore.Collection, "Port", Port); } } }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private void MenuItemCallback(object sender, EventArgs e) { // Show a Message Box to prove we were here IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); Guid clsid = Guid.Empty; DeployConfiguration config = new DeployConfiguration(); SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.CollectionExists("SyncIIS")) { userSettingsStore.CreateCollection("SyncIIS"); } config.Domain = userSettingsStore.GetString("SyncIIS", "Domain", ""); config.SetSecurePassword(userSettingsStore.GetString("SyncIIS", "Password", "")); config.Site = userSettingsStore.GetString("SyncIIS", "Site", ""); config.Source = userSettingsStore.GetString("SyncIIS", "Source", ""); config.Target = userSettingsStore.GetString("SyncIIS", "Target", "").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList <string>(); config.Username = userSettingsStore.GetString("SyncIIS", "Username", ""); SyncWindow window = new SyncWindow(config); window.ShowDialog(); var settings = window.Configuration; userSettingsStore.SetString("SyncIIS", "Domain", settings.Domain); userSettingsStore.SetString("SyncIIS", "Password", settings.GetUnsecurePassword()); userSettingsStore.SetString("SyncIIS", "Site", settings.Site); userSettingsStore.SetString("SyncIIS", "Source", settings.Source); userSettingsStore.SetString("SyncIIS", "Target", string.Join(",", settings.Target.ToArray())); userSettingsStore.SetString("SyncIIS", "Username", settings.Username); }
static StaticBoilerplateSettings() { SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); Store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); Store.CreateCollection(CollectionPath); if (Store.PropertyExists(CollectionPath, TestProjectsKey)) { string dictionaryString = Store.GetString(CollectionPath, TestProjectsKey); if (string.IsNullOrEmpty(dictionaryString)) { TestProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); } else { TestProjectsDictionary = new Dictionary <string, string>(JsonConvert.DeserializeObject <Dictionary <string, string> >(dictionaryString), StringComparer.OrdinalIgnoreCase); } } else { TestProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); } }
public static void IgnoreSolution(bool ignore) { WritableSettingsStore wstore = _settings.GetWritableSettingsStore(SettingsScope.UserSettings); if (!wstore.CollectionExists(Constants.VSIX_NAME)) { wstore.CreateCollection(Constants.VSIX_NAME); } string solution = VSPackage.GetSolution(); if (string.IsNullOrEmpty(solution)) { return; } string property = GetPropertyName(solution); if (ignore) { wstore.SetInt32(Constants.VSIX_NAME, property, 1); } else { wstore.DeleteProperty(Constants.VSIX_NAME, property); } }
/// <summary> /// Saves the properties to the registry asyncronously. /// </summary> public virtual async Task SaveAsync() { ShellSettingsManager manager = await _settingsManager.GetValueAsync(); WritableSettingsStore settingsStore = manager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settingsStore.CollectionExists(CollectionName)) { settingsStore.CreateCollection(CollectionName); } foreach (PropertyInfo property in GetOptionProperties()) { var output = SerializeValue(property.GetValue(this)); settingsStore.SetString(CollectionName, property.Name, output); } T liveModel = await GetLiveInstanceAsync(); if (this != liveModel) { await liveModel.LoadAsync(); } Saved?.Invoke(this, liveModel); }
private void GeneralOptionSave(WritableSettingsStore settingsStore) { if (!settingsStore.CollectionExists(CollectionName)) { settingsStore.CreateCollection(CollectionName); } WriteSetting(settingsStore, _generalOptionProvider.SortOptions, nameof(_generalOptionProvider.SortOptions)); WriteSetting(settingsStore, _generalOptionProvider.AutoScroll, nameof(_generalOptionProvider.AutoScroll)); WriteSetting(settingsStore, _generalOptionProvider.IsEnabledIndentGuides, nameof(_generalOptionProvider.IsEnabledIndentGuides)); WriteSetting(settingsStore, _generalOptionProvider.IndentGuideThickness, nameof(_generalOptionProvider.IndentGuideThickness)); WriteSetting(settingsStore, _generalOptionProvider.IndentGuideDashSize, nameof(_generalOptionProvider.IndentGuideDashSize)); WriteSetting(settingsStore, _generalOptionProvider.IndentGuideSpaceSize, nameof(_generalOptionProvider.IndentGuideSpaceSize)); WriteSetting(settingsStore, _generalOptionProvider.IndentGuideOffsetY, nameof(_generalOptionProvider.IndentGuideOffsetY)); WriteSetting(settingsStore, _generalOptionProvider.IndentGuideOffsetX, nameof(_generalOptionProvider.IndentGuideOffsetX)); WriteSetting(settingsStore, _generalOptionProvider.Asm1FileExtensions, nameof(_generalOptionProvider.Asm1FileExtensions)); WriteSetting(settingsStore, _generalOptionProvider.Asm2FileExtensions, nameof(_generalOptionProvider.Asm2FileExtensions)); WriteSetting(settingsStore, _generalOptionProvider.Asm1SelectedSet, nameof(_generalOptionProvider.Asm1SelectedSet)); WriteSetting(settingsStore, _generalOptionProvider.Asm2SelectedSet, nameof(_generalOptionProvider.Asm2SelectedSet)); WriteSetting(settingsStore, _generalOptionProvider.AutocompleteInstructions, nameof(_generalOptionProvider.AutocompleteInstructions)); WriteSetting(settingsStore, _generalOptionProvider.AutocompleteFunctions, nameof(_generalOptionProvider.AutocompleteFunctions)); WriteSetting(settingsStore, _generalOptionProvider.AutocompleteLabels, nameof(_generalOptionProvider.AutocompleteLabels)); WriteSetting(settingsStore, _generalOptionProvider.AutocompleteVariables, nameof(_generalOptionProvider.AutocompleteVariables)); WriteSetting(settingsStore, _generalOptionProvider.SignatureHelp, nameof(_generalOptionProvider.SignatureHelp)); }
public FormsPlayerViewModel([Import(typeof(SVsServiceProvider))] IServiceProvider services) { ConnectCommand = new DelegateCommand(Connect, () => !isConnected); DisconnectCommand = new DelegateCommand(Disconnect, () => isConnected); events = services.GetService <DTE>().Events.DocumentEvents; events.DocumentSaved += document => Publish(document.FullName); var manager = new ShellSettingsManager(services); settings = manager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settings.CollectionExists(SettingsPath)) { settings.CreateCollection(SettingsPath); } if (settings.PropertyExists(SettingsPath, SettingsKey)) { SessionId = settings.GetString(SettingsPath, SettingsKey, ""); } if (string.IsNullOrEmpty(SessionId)) { // Initialize SessionId from MAC address. var mac = NetworkInterface.GetAllNetworkInterfaces() .Where(nic => nic.NetworkInterfaceType != NetworkInterfaceType.Loopback) .Select(nic => nic.GetPhysicalAddress().ToString()) .First(); SessionId = NaiveBijective.Encode(NaiveBijective.Decode(mac)); } TaskScheduler.UnobservedTaskException += OnTaskException; }
public void CreateDefaultSettingsTest() { var defaultProfileSettings = Path.Combine(SolutionSettings, DefaultProfileName); using (mocks.Record()) { Expect.Call(store.CollectionExists(SolutionSettings)).Return(false); Expect.Call(() => store.CreateCollection(defaultProfileSettings)); Expect.Call(() => store.SetString(SolutionSettings, ActiveProfileProperty, DefaultProfileName)); } using (mocks.Playback()) { var settings = new VsSettingsManager(SolutionId, store); } }
private static void HandleCollection() { if (!_userSettingsStore.CollectionExists(CollectionName)) { _userSettingsStore.CreateCollection(CollectionName); } }
/// <summary> /// Sets the settings store up. /// Creates the default collection for this extensions settings if it does not exist /// </summary> /// <param name="store"></param> public static void SetupIndentRainbowCollection(this WritableSettingsStore store) { if (!store.CollectionExists(collectionName)) { store.CreateCollection(collectionName); } }
public void SaveString(string name, string category, string value) { var path = GetCollectionPath(category); if (!_settingsStore.CollectionExists(path)) { _settingsStore.CreateCollection(path); } _settingsStore.SetString(path, name, value); }
public PaketSettings(ShellSettingsManager settingsManager) { settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settingsStore.CollectionExists(StoreCollection)) { settingsStore.CreateCollection(StoreCollection); } }
public void Set(string propertyName, string propertyValue) { if (!userSettingsStore.CollectionExists(collection)) { userSettingsStore.CreateCollection(collection); } userSettingsStore.SetString(collection, propertyName, propertyValue); }
private static void SaveBoolean(OptionName.SettingIds name, bool variableValue, WritableSettingsStore settingsStore) { if (!settingsStore.CollectionExists(defaultCollectionPath)) { settingsStore.CreateCollection(defaultCollectionPath); } settingsStore.SetBoolean(defaultCollectionPath, name.ToString(), variableValue); }
private static void SetOption(WritableSettingsStore store, string catelogName, string optionName, int value) { if (!store.CollectionExists(COLLECTION_PATH)) { store.CreateCollection(COLLECTION_PATH); } store?.SetInt32(COLLECTION_PATH, CombineCatelogAndOptionName(catelogName, optionName), value); }
private static void SetOption(WritableSettingsStore store, string catelogName, string optionName, Color value) { if (!store.CollectionExists(COLLECTION_PATH)) { store.CreateCollection(COLLECTION_PATH); } store?.SetString(COLLECTION_PATH, CombineCatelogAndOptionName(catelogName, optionName), string.Join(",", value.R, value.G, value.B)); }
public void Reset() { if (settingsStore.CollectionExists(collectionPath)) { settingsStore.DeleteCollection(collectionPath); } settingsStore.CreateCollection(collectionPath); serviceContainer.Get <MainViewModel>().Update(); }
protected SettingStore() { SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.CollectionExists(CollectionPath)) { userSettingsStore.CreateCollection(CollectionPath); } }
public static void SaveCurrent() { if (!settingsStore.CollectionExists(CollectionPath)) { settingsStore.CreateCollection(CollectionPath); } settingsStore.SetBoolean(CollectionPath, "IsEnabled", Current.IsEnabled); }
internal static void WriteBoolean(this WritableSettingsStore settingsStore, string collectionName, string propertyName, bool value) { if (!settingsStore.CollectionExists(collectionName)) { settingsStore.CreateCollection(collectionName); } settingsStore.SetBoolean(collectionName, propertyName, value); }
internal VersionProvider(IServiceProvider serviceProvider) { var settingsManager = new ShellSettingsManager(serviceProvider); _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!_settingsStore.CollectionExists(CollectionName)) _settingsStore.CreateCollection(CollectionName); if (_settingsStore.PropertyExists(CollectionName, OldVersionPropertyName)) _settingsStore.DeleteProperty(CollectionName, OldVersionPropertyName); }
public Settings(SVsServiceProvider serviceProvider) { _vsSettingsProvider = GetWritableSettingsStore(serviceProvider); if (!_vsSettingsProvider.CollectionExists(collectionKey)) { _vsSettingsProvider.CreateCollection(collectionKey); } _mergeOperationDefaultValues = new[] { mergeOperationDefaultLast, mergeOperationDefaultMerge, mergeOperationDefaultMergeCheckin }; BranchNameMatches = BranchNameMatches ?? new BranchNameMatch[0]; }
public static void Initialize(IServiceProvider provider) { _manager = new ShellSettingsManager(provider); _readStore = _manager.GetReadOnlySettingsStore(SettingsScope.UserSettings); _writeStore = _manager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!_writeStore.CollectionExists(_name)) { _writeStore.CreateCollection(_name); string defaults = string.Join(_separator, PreEnabledExtensions.List); _writeStore.SetString(_name, _identifierKey, defaults); } }
public void Initialize() { userSettingsStore = _hostEnviromentConnection.SettingsManager .GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.CollectionExists(CollectionName)) { userSettingsStore.CreateCollection(CollectionName); } // if (!userSettingsStore.PropertyExists(CollectionName, "MutationResultsFilePath")) // { // this["MutationResultsFilePath"] = @"C:\results"; // } }
public PaketSettings(ShellSettingsManager settingsManager) { settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settingsStore.CollectionExists(StoreCollection)) settingsStore.CreateCollection(StoreCollection); }