public UserSettingsContainer Load()
        {
            var result = new UserSettingsContainer();

            if (!_settingsStore.CollectionExists(SETTINGS_STORE_NAME))
            {
                Save(result);
            }

            if (_settingsStore.CollectionExists(SETTINGS_STORE_NAME))
            {
                try
                {
                    var content = _settingsStore.GetString(SETTINGS_STORE_NAME, "Settings");
                    result = UserSettingsContainer.DeserializeFromJson(content);
                    return(result);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex);
                }
            }

            return(result);
        }
示例#2
0
        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);
                }
            }
        }
        public static void SaveCurrent()
        {
            if (!settingsStore.CollectionExists(CollectionPath))
            {
                settingsStore.CreateCollection(CollectionPath);
            }

            settingsStore.SetBoolean(CollectionPath, "IsEnabled", Current.IsEnabled);
        }
        private void SaveFeedbackSettings(string collection, RoccatIskuFxFeedback settings)
        {
            if (!_writableSettingsStore.CollectionExists(collection))
            {
                _writableSettingsStore.CreateCollection(collection);
            }

            _writableSettingsStore.SetString(collection, "Effect", settings.Effect.ToString());
            _writableSettingsStore.SetString(collection, "Color", string.Join(",", new[] { settings.Color.R, settings.Color.G, settings.Color.B }));
        }
示例#5
0
        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 string LoadString(string name, string category)
 {
     var path = GetCollectionPath(category);
     if (!_settingsStore.CollectionExists(path)) {
         return null;
     }
     if (!_settingsStore.PropertyExists(path, name)) {
         return null;
     }
     return _settingsStore.GetString(path, name, "");
 }
示例#7
0
        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]);
            }
        }
示例#8
0
        /// <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);
        }
示例#9
0
        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;
        }
示例#10
0
        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");
            }
        }
示例#11
0
 public void DeleteCollection()
 {
     if (_settingsStore != null && _settingsStore.CollectionExists(CollectionPath))
     {
         _settingsStore.DeleteCollection(CollectionPath);
     }
 }
示例#12
0
        /// <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
        }
示例#13
0
 /// <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);
     }
 }
示例#14
0
        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);
            }
        }
        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);
                    }
                }
            }
        }
示例#16
0
        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);
            }
        }
示例#17
0
 private static void EnsureSettingsStoreCollectionExists(WritableSettingsStore userSettingsStore)
 {
     if (!userSettingsStore.CollectionExists(PathCollectionString))
     {
         userSettingsStore.CreateCollection(PathCollectionString);
     }
 }
示例#18
0
        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 SaveSetingsString(string settingsString)
        {
            try
            {
                if (!_writableSettingsStore.CollectionExists(CollectionPath))
                {
                    _writableSettingsStore.CreateCollection(CollectionPath);
                }

                _writableSettingsStore.SetString(CollectionPath, PropertyName, settingsString);
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.Message);
            }
        }
        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);
                }
            }
        }
示例#21
0
 private static void HandleCollection()
 {
     if (!_userSettingsStore.CollectionExists(CollectionName))
     {
         _userSettingsStore.CreateCollection(CollectionName);
     }
 }
示例#22
0
        /// <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);
        }
        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));
        }
        private void GitHubDialogWindowControl_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs args)
        {
            if ((bool)args.NewValue == false)
            {
                return;
            }

            SettingsManager       settingsManager   = new ShellSettingsManager(ServiceProvider.GlobalProvider);
            WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!userSettingsStore.CollectionExists("XamlToolkit"))
            {
                return;
            }

            var directory = userSettingsStore.GetString("XamlToolkit", "Directory");

            if (string.IsNullOrWhiteSpace(directory))
            {
                return;
            }

            try
            {
                GitHubDialogViewModel.UpdateDirectory(directory);
                GitHubDialogViewModel.Run(Path.Combine(directory, AppSettings.Default.ExePath));
                Window.GetWindow(this).Close();
            }
            catch (Exception)
            {
                GitHubDialogViewModel.SaveDirectorySettings("");
            }
        }
示例#25
0
        public static void SaveSettings(ISettings settings)
        {
            try
            {
                if (store.CollectionExists(settings.Key) != true)
                {
                    store.CreateCollection(settings.Key);
                }

                var anySaved = false;

                var type = settings.GetType();

                foreach (var prop in type.GetProperties().Where(p => Attribute.IsDefined(p, typeof(SettingAttribute))))
                {
                    if (prop.PropertyType == typeof(bool))
                    {
                        store.SetBoolean(settings.Key, prop.Name, ((bool)(prop.GetValue(settings))));
                        anySaved = true;
                    }
                    else if (prop.PropertyType == typeof(int))
                    {
                        store.SetInt32(settings.Key, prop.Name, ((int)(prop.GetValue(settings))));
                        anySaved = true;
                    }
                    else if (prop.PropertyType == typeof(double))
                    {
                        store.SetString(settings.Key, prop.Name, prop.GetValue(settings).ToString());
                        anySaved = true;
                    }
                    else if (prop.PropertyType == typeof(string))
                    {
                        store.SetString(settings.Key, prop.Name, ((string)(prop.GetValue(settings))));
                        anySaved = true;
                    }
                }

                if (anySaved)
                {
                    SettingsChanged?.Invoke();
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.Message);
            }
        }
示例#26
0
 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));
 }
示例#27
0
 private static void SaveBoolean(OptionName.SettingIds name, bool variableValue, WritableSettingsStore settingsStore)
 {
     if (!settingsStore.CollectionExists(defaultCollectionPath))
     {
         settingsStore.CreateCollection(defaultCollectionPath);
     }
     settingsStore.SetBoolean(defaultCollectionPath, name.ToString(), variableValue);
 }
        public UserSettings Load()
        {
            var result = new UserSettings();

            if (store.CollectionExists("MonoTools.Debugger"))
            {
                try {
                    string content = store.GetString("MonoTools.Debugger", "Settings");
                    result = JsonConvert.DeserializeObject <UserSettings>(content);
                    return(result);
                } catch (Exception ex) {
                    logger.Error(ex);
                }
            }

            return(result);
        }
 public PaketSettings(ShellSettingsManager settingsManager)
 {
     settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
     if (!settingsStore.CollectionExists(StoreCollection))
     {
         settingsStore.CreateCollection(StoreCollection);
     }
 }
示例#30
0
 public void Set(string propertyName, string propertyValue)
 {
     if (!userSettingsStore.CollectionExists(collection))
     {
         userSettingsStore.CreateCollection(collection);
     }
     userSettingsStore.SetString(collection, propertyName, propertyValue);
 }
 protected SettingStore()
 {
     SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);
      userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
     if (!userSettingsStore.CollectionExists(CollectionPath))
     {
         userSettingsStore.CreateCollection(CollectionPath);
     }
 }
        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);
        }
示例#33
0
        public Settings(SVsServiceProvider serviceProvider)
        {
            _vsSettingsProvider = GetWritableSettingsStore(serviceProvider);

            if (!_vsSettingsProvider.CollectionExists(collectionKey))
            {
                _vsSettingsProvider.CreateCollection(collectionKey);
            }

            _mergeOperationDefaultValues = new[] { mergeOperationDefaultLast, mergeOperationDefaultMerge, mergeOperationDefaultMergeCheckin };

            BranchNameMatches = BranchNameMatches ?? new BranchNameMatch[0];
        }
示例#34
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";
           // }
            


        }
示例#36
0
 public PaketSettings(ShellSettingsManager settingsManager)
 {
     settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
     if (!settingsStore.CollectionExists(StoreCollection))
         settingsStore.CreateCollection(StoreCollection);
 }