Esempio n. 1
0
 public bool GetOption(string optionName, IServiceProvider serviceProvider)
 {
     var shellSettingsManager = new ShellSettingsManager(serviceProvider);
     var store = shellSettingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
     var option = store?.GetBoolean(CollectionPath, optionName, false);
     return option ?? false;
 }
        private void LoadSettings()
        {
            _hasLoaded = true;

            SettingsManager settingsManager = new ShellSettingsManager(serviceProvider);
            SettingsStore store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);

            LogoAdornment.VisibilityChanged += (sender, isVisible) =>
            {
                WritableSettingsStore wstore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
                _isVisible = isVisible;

                if (!wstore.CollectionExists(Globals.VsixName))
                    wstore.CreateCollection(Globals.VsixName);

                wstore.SetBoolean(Globals.VsixName, _propertyName, isVisible);
            };

            _isVisible = store.GetBoolean(Globals.VsixName, _propertyName, true);
        }
Esempio n. 3
0
        private static int? GetValueFromPrivateSettingsTextEditor(IServiceProvider serviceProvider, string languageName, string propertyName)
        {
            if (serviceProvider == null) return null;
            if (string.IsNullOrWhiteSpace(languageName)) return null;

            SettingsManager settingsManager = new ShellSettingsManager(serviceProvider);
            var userSettingsStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);

            var privateSettingsTextEditorLanguage = $@"ApplicationPrivateSettings\TextEditor\{languageName}";

            if (userSettingsStore.CollectionExists(privateSettingsTextEditorLanguage) &&
                userSettingsStore.PropertyExists(privateSettingsTextEditorLanguage, propertyName))
            {
                var value = userSettingsStore.GetString(privateSettingsTextEditorLanguage, propertyName);

                int buff;
                if (int.TryParse(value?.Split('*').Last(), out buff))
                    return buff;
            }
            return null;
        }
Esempio n. 4
0
        private static int? GetValueFromTextEditor(IServiceProvider serviceProvider, string languageName, string propertyName)
        {
            if (serviceProvider == null) return null;
            if (string.IsNullOrWhiteSpace(languageName)) return null;

            SettingsManager settingsManager = new ShellSettingsManager(serviceProvider);
            var userSettingsStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);

            var textEditorLanguage = $@"Text Editor\{languageName}";

            if (userSettingsStore.CollectionExists(textEditorLanguage) &&
                userSettingsStore.PropertyExists(textEditorLanguage, propertyName))
            {
                return userSettingsStore.GetInt32(textEditorLanguage, propertyName);
            }
            return null;
        }
Esempio n. 5
0
        /// <summary>
        /// Sets the verbosity level.
        /// </summary>
        private void SetVerbosity()
        {
            if (!this.haveCachedVerbosity) {
                this.Verbosity = LoggerVerbosity.Normal;

                try {
                    var settings = new ShellSettingsManager(serviceProvider);
                    var store = settings.GetReadOnlySettingsStore(SettingsScope.UserSettings);
                    if (store.CollectionExists(GeneralCollection) && store.PropertyExists(GeneralCollection, BuildVerbosityProperty)) {
                        this.Verbosity = (LoggerVerbosity)store.GetInt32(GeneralCollection, BuildVerbosityProperty, (int)LoggerVerbosity.Normal);
                    }
                } catch (Exception ex) {
                    var message = string.Format(
                        "Unable to read verbosity option from the registry.{0}{1}",
                        Environment.NewLine,
                        ex.ToString()
                    );
                    this.QueueOutputText(MessageImportance.High, message);
                }

                this.haveCachedVerbosity = true;
            }
        }
Esempio n. 6
0
        //=====================================================================

        /// <summary>
        /// This is used to load the MEF provider configuration settings
        /// </summary>
        /// <returns>True if loaded successfully or false if the settings collection does not exist</returns>
        /// <remarks>The settings are loaded using the <see cref="ShellSettingsManager"/> from the
        /// <see cref="CollectionPath"/> collection.</remarks>
        private bool LoadConfiguration()
        {
            ShellSettingsManager settingsManager = new ShellSettingsManager(_serviceProvider);
            SettingsStore settingsStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
            if (!settingsStore.CollectionExists(CollectionPath))
                return false;

            EnableExtendedXmlCommentsCompletion = settingsStore.GetBoolean(CollectionPath, "EnableExtendedXmlCommentsCompletion", true);
            EnableGoToDefinition = settingsStore.GetBoolean(CollectionPath, "EnableGoToDefinition", true);
            EnableGoToDefinitionInCRef = settingsStore.GetBoolean(CollectionPath, "EnableGoToDefinitionInCRef", DefaultEnableGoToDefinitionInCRef);
            return true;
        }
        /// <summary>
        /// Initializes properties in the package
        /// </summary>
        /// <param name="package">The package</param>
        private void Initialize(ShelvesetComparerPackage package)
        {
            SettingsManager settingsManager = new ShellSettingsManager(package);
            this.writableSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            if (!this.writableSettingsStore.CollectionExists("ShelveSetComparer"))
            {
                this.writableSettingsStore.CreateCollection("ShelveSetComparer");
                this.ShowAsButton = true;
                this.TwoUsersView = true;
            }

            this.readableSettingStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
        }
Esempio n. 8
0
        private List<DocumentGroup> LoadGroupsForSolution()
        {
            var solution = SolutionName;
            if (!string.IsNullOrWhiteSpace(solution))
            {
                try
                {
                    var settingsMgr = new ShellSettingsManager(ServiceProvider);
                    var store = settingsMgr.GetReadOnlySettingsStore(SettingsScope.UserSettings);

                    var propertyName = String.Format(SavedTabsStoragePropertyFormat, solution);
                    if (store.PropertyExists(StorageCollectionPath, propertyName))
                    {
                        var tabs = store.GetString(StorageCollectionPath, propertyName);
                        return JsonConvert.DeserializeObject<List<DocumentGroup>>(tabs);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Assert(false, "LoadGroupsForSolution", ex.ToString());
                }
            }
            return new List<DocumentGroup>();
        }
Esempio n. 9
0
        //=====================================================================

        /// <summary>
        /// This is used to load the MEF provider configuration settings
        /// </summary>
        /// <returns>True if loaded successfully or false if the settings could not be loaded</returns>
        /// <remarks>The settings are loaded from Visual Studio user setting store</remarks>
        private bool LoadConfiguration()
        {
            bool success = false;

            try
            {
                var settingsManager = new ShellSettingsManager(serviceProvider);
                var settingsStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);

                if(settingsStore.CollectionExists(CollectionPath))
                {
                    EnableExtendedXmlCommentsCompletion = settingsStore.GetBoolean(CollectionPath,
                        "EnableExtendedXmlCommentsCompletion", true);
                    EnableGoToDefinition = settingsStore.GetBoolean(CollectionPath, "EnableGoToDefinition", true);
                    EnableCtrlClickGoToDefinition = settingsStore.GetBoolean(CollectionPath,
                        "EnableCtrlClickGoToDefinition", true);
                    EnableGoToDefinitionInCRef = settingsStore.GetBoolean(CollectionPath,
                        "EnableGoToDefinitionInCRef", !IntelliSense.RoslynHacks.RoslynUtilities.IsFinalRoslyn);
                    success = true;
                }
            }
            catch(Exception ex)
            {
                // Ignore exceptions.  We'll just use the defaults.
                System.Diagnostics.Debug.WriteLine(ex);
            }

            return success;
        }