Exemplo n.º 1
0
        public Encouragements(SVsServiceProvider vsServiceProvider)
        {
            var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);
            writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            LoadSettings();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the settings
        /// </summary>
        /// <param name="configurationSettingsStore">The settings store</param>
        public Settings(WritableSettingsStore configurationSettingsStore)
        {
            _store = configurationSettingsStore;

            _showLinesColored = _store.GetBoolean(SETTINGS_PATH, SettingNames.ShowLinesColored, false);
            _showCoverageGlyphs = _store.GetBoolean(SETTINGS_PATH, SettingNames.ShowCoverageGlyphs, true);
        }
Exemplo n.º 3
0
        private SavedOptions()
        {
            var shellSettingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);
            _store = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            LoadOptions();
        }
Exemplo n.º 4
0
 public SettingsStore(WritableSettingsStore store, string root)
 {
     Guard.ArgumentNotNull(store, nameof(store));
     Guard.ArgumentNotNull(root, nameof(root));
     Guard.ArgumentNotEmptyString(root, nameof(root));
     this.store = store;
     this.root = root;
 }
Exemplo n.º 5
0
        public WhereAmISettings(SVsServiceProvider vsServiceProvider)
            : this()
        {
            var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);
            writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            LoadSettings();
        }
 protected SettingStore()
 {
     SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);
      userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
     if (!userSettingsStore.CollectionExists(CollectionPath))
     {
         userSettingsStore.CreateCollection(CollectionPath);
     }
 }
Exemplo n.º 7
0
			public void Initialize()
			{
				var shellManager = new ShellSettingsManager(Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider);
				this.settingsStore = shellManager.GetWritableSettingsStore(SettingsScope.UserSettings);

				var collection = SettingsManager.GetSettingsCollectionName(typeof(Foo));
				if (this.settingsStore.CollectionExists(collection))
					this.settingsStore.DeleteCollection(collection);
			}
        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);
        }
Exemplo n.º 9
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];
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
0
        internal VimApplicationSettings(VisualStudioVersion visualStudioVersion, WritableSettingsStore settingsStore, IProtectedOperations protectedOperations)
        {
            _settingsStore = settingsStore;
            _protectedOperations = protectedOperations;

            // Legacy settings were only supported on Visual Studio 2010 and 2012.  For any other version there is no
            // need to modify the legacy settings
            switch (visualStudioVersion)
            {
                case VisualStudioVersion.Vs2010:
                case VisualStudioVersion.Vs2012:
                    _legacySettingsSupported = true;
                    break;
                default:
                    // Intentionally do nothing
                    break;
            }
        }
        internal /* for testing purposes */ IntegrationSettings(IServiceProvider serviceProvider, SettingsManager settingsManager)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (settingsManager == null)
            {
                throw new ArgumentNullException(nameof(settingsManager));
            }

            this.store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            Debug.Assert(this.store != null, "Could not get WritableSettingsStore, no settings will be persisted!");
            if (this.store != null)
            {
                this.Initialize();
            }
        }
        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";
           // }
            


        }
        protected override void Initialize()
        {
            base.Initialize();

            OleMenuCommandService menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (menuCommandService != null)
            {
                // This is the drop down combo box itself
                CommandID comboBoxCommandID = new DebugCommandLineCommandID(DebugCommandLineCommand.DebugCommandLineCombo);
                OleMenuCommand comboBoxCommand = new OleMenuCommand(HandleInvokeCombo, HandleChangeCombo, HandleBeforeQueryStatusCombo, comboBoxCommandID);
                menuCommandService.AddCommand(comboBoxCommand);

                // This is the special command to get the list of drop down items
                CommandID comboBoxGetListCommandID = new DebugCommandLineCommandID(DebugCommandLineCommand.DebugCommandLineComboGetList);
                OleMenuCommand comboBoxGetListCommand = new OleMenuCommand(HandleInvokeComboGetList, comboBoxGetListCommandID);
                menuCommandService.AddCommand(comboBoxGetListCommand);
            }

            var shellSettingsManager = new ShellSettingsManager(this);
            SettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            LoadSettings();
        }
        /// <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())
            {
                string output = SerializeValue(property.GetValue(this));
                settingsStore.SetString(CollectionName, property.Name, output);
            }

            T liveModel = await GetLiveInstanceAsync();

            if (this != liveModel)
            {
                await liveModel.LoadAsync();
            }
        }
        protected override void Initialize()
        {
            base.Initialize();

            OleMenuCommandService menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (menuCommandService != null)
            {
                // This is the drop down combo box itself
                CommandID      comboBoxCommandID = new DebugCommandLineCommandID(DebugCommandLineCommand.DebugCommandLineCombo);
                OleMenuCommand comboBoxCommand   = new OleMenuCommand(HandleInvokeCombo, HandleChangeCombo, HandleBeforeQueryStatusCombo, comboBoxCommandID);
                menuCommandService.AddCommand(comboBoxCommand);

                // This is the special command to get the list of drop down items
                CommandID      comboBoxGetListCommandID = new DebugCommandLineCommandID(DebugCommandLineCommand.DebugCommandLineComboGetList);
                OleMenuCommand comboBoxGetListCommand   = new OleMenuCommand(HandleInvokeComboGetList, comboBoxGetListCommandID);
                menuCommandService.AddCommand(comboBoxGetListCommand);
            }

            var shellSettingsManager = new ShellSettingsManager(this);

            SettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            LoadSettings();
        }
Exemplo n.º 17
0
        /// <summary>
        /// Saves the settings to the settings store
        /// </summary>
        /// <param name="indentSize">The indent size specifiyng the number of spaces for indentation detection</param>
        /// <param name="colors">The colors as string</param>
        public static void SaveSettings(int indentSize, string fileExtensionsString, string colors, double opacityMultiplier, HighlightingMode highlightingmode, string errorColor, bool detectError)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            WritableSettingsStore settingsStore = GetWritableSettingsStore();

            settingsStore.SaveIndentSize(indentSize);
            settingsStore.SaveFileExtensionsIndentSizes(fileExtensionsString);
            settingsStore.SaveColors(colors);
            settingsStore.SaveOpacityMultiplier(opacityMultiplier);
            settingsStore.SaveHighlightingMode(highlightingmode);
            settingsStore.SaveDetectErrorsFlag(detectError);
            settingsStore.SaveErrorColor(errorColor);

            OptionsManager.indentSize.Set(indentSize);
            OptionsManager.fileExtensionsString.Set(fileExtensionsString);
            fileExtensionsDictionary.Set(LanguageParser.CreateDictionaryFromString(fileExtensionsString));
            OptionsManager.colors.Set(colors);
            brushes.Set(ColorParser.ConvertStringToBrushArray(colors, opacityMultiplier));
            OptionsManager.opacityMultiplier.Set(opacityMultiplier);
            OptionsManager.highlightingMode.Set(highlightingmode);
            OptionsManager.errorColor.Set(errorColor);
            detectErrors.Set(detectError);
            errorBrush.Set(ColorParser.ConvertStringToBrush(errorColor, opacityMultiplier));
        }
        public ConfiguredSettings(IServiceProvider vsServiceProvider)
        {
            try
            {
                var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);
                this.store = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

                if (this.store.PropertyExists(SettingCollectionName, nameof(this.ActualSettings)))
                {
                    var settingsString = this.store.GetString(SettingCollectionName, nameof(this.ActualSettings));

                    this.actualSettings = DeserializeOrDefault(settingsString);
                }
                else
                {
                    this.actualSettings = GetDefaultSettings();
                }
            }
            catch (Exception exc)
            {
                RapidXamlPackage.Logger?.RecordException(exc);
                throw;  // Remove for launch. see issue #90
            }
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
 public AvaloniaDesignerSettings(SVsServiceProvider vsServiceProvider)
 {
     _store = vsServiceProvider.GetWritableSettingsStore(SettingsScope.UserSettings);
     LoadSettings();
 }
Exemplo n.º 21
0
            public ShellSettingsStore(IServiceProvider serviceProvider)
            {
                var manager = new ShellSettingsManager(serviceProvider);

                this.store = manager.GetWritableSettingsStore(SettingsScope.UserSettings);
            }
Exemplo n.º 22
0
 public SettingsService(WritableSettingsStore settings)
 {
     _settings = settings;
 }
        public OptionsService(IServiceProvider serviceProvider)
        {
            var settingsManager = SettingsManagerCreator.GetSettingsManager(serviceProvider);

            _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
        }
Exemplo n.º 24
0
 public SettingsHelper()
 {
     settings        = GetSettings();
     resourceManager = new ComponentResourceManager(typeof(DoxygenToolsOptionsBase));
 }
Exemplo n.º 25
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");
            }

            if (_settingsStore.PropertyExists("DebugAttachManagerProcesses", "RemotePort"))
            {
                RemotePort = _settingsStore.GetString("DebugAttachManagerProcesses", "RemotePort");
            }

            if (_settingsStore.PropertyExists("DebugAttachManagerProcesses", "RemoteUserName"))
            {
                RemoteUserName = _settingsStore.GetString("DebugAttachManagerProcesses", "RemoteUserName");
            }

            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;
                    }
                }
            }
        }
        public VsUserSettings([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
        {
            var shellSettingsManager = new ShellSettingsManager(serviceProvider);

            settingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
        }
Exemplo n.º 27
0
        protected void WriteInt32(string settingsRoot, string property, int value)
        {
            WritableSettingsStore userSettingsStore = GetWritableSettingsStore(settingsRoot);

            userSettingsStore.SetInt32(settingsRoot, property, value);
        }
Exemplo n.º 28
0
 internal static Settings Initialize(WritableSettingsStore settings)
 {
     return(Instance = new Settings(settings));
 }
Exemplo n.º 29
0
 /// <summary>
 /// Saves the given string (representing the colors)
 /// </summary>
 /// <param name="store">The writable settings store</param>
 /// <param name="colors">The colors to save</param>
 public static void SaveColors(this WritableSettingsStore store, string colors)
 {
     store.SetString(collectionName, colorsPropertyName, colors);
 }
Exemplo n.º 30
0
 private PythonToolsOptionsService(IServiceProvider serviceProvider) {
     var settingsManager = SettingsManagerCreator.GetSettingsManager(serviceProvider);
     _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
 }
        /// <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);
        }
Exemplo n.º 32
0
 public AlpaOptionsService(IServiceProvider serviceProvider)
 {
     var settingsManager = AlpaPackage.GetSettings(serviceProvider);
     _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
 }
 public void CheckSettingsStore()
 {
     SettingsManager       settingsManager   = new ShellSettingsManager(ServiceProvider);
     WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
 }
Exemplo n.º 34
0
        /// <summary>
        /// Called when the window has loaded
        /// </summary>
        private void OnLoad(object sender, RoutedEventArgs e)
        {
            // Window icon
            var icon = WindowExtensions.ImageSourceFromIcon(Properties.Resources.oof);

            if (icon != null)
            {
                Icon = icon;
            }

            // Hide/disable minimize button
            WindowExtensions.HideMinimizeAndMaximizeButtons(this, hideMaximize: false);

            // Restore window size and position, if any
            try
            {
                var settingsManager = new ShellSettingsManager(Package);

                WritableSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

                if (WritableSettingsStore.CollectionExists(SS_Collection) == true)
                {
                    // These two are required from now on
                    WindowStartupLocation = WindowStartupLocation.Manual;
                    SizeToContent         = SizeToContent.Manual;

                    // Window size and position
                    Top         = WritableSettingsStore.GetInt32(SS_Collection, SS_WindowTop);
                    Left        = WritableSettingsStore.GetInt32(SS_Collection, SS_WindowLeft);
                    Height      = WritableSettingsStore.GetInt32(SS_Collection, SS_WindowHeight);
                    Width       = WritableSettingsStore.GetInt32(SS_Collection, SS_WindowWidth);
                    WindowState = (WindowState)WritableSettingsStore.GetInt32(SS_Collection, SS_WindowState);

                    // Other settings
                    chActiveItem.IsChecked = WritableSettingsStore.GetBoolean(SS_Collection, SS_ActiveItem);

                    rbLeftPanelTC.IsChecked  = WritableSettingsStore.GetBoolean(SS_Collection, SS_LeftPanelTC);
                    rbRightPanelTC.IsChecked = WritableSettingsStore.GetBoolean(SS_Collection, SS_RightPanelTC);

                    if (rbLeftPanelTC.IsChecked == rbRightPanelTC.IsChecked)
                    {
                        // Impossible case that should not be possible but has somehow happened, so here is the fix
                        rbLeftPanelTC.IsChecked  = true;
                        rbRightPanelTC.IsChecked = false;
                    }
                }
                else
                {
                    // Create collection now to be able to check for other settings the 1st time around
                    WritableSettingsStore.CreateCollection(SS_Collection);

                    // Must have a default
                    rbLeftPanelTC.IsChecked = true;
                }
            }
            catch (Exception)
            {
                // Ignore quietly
            }

            // Load configurations and active path
#pragma warning disable VSTHRD010

            if (Paths.ListSolutionConfigurations(Dte, lbConfigurations, ref _activePath) == false)
            {
                // Something went wrong so abort
                // Error reporting, if any, is to be done in the calling method above
                Close();
            }

#pragma warning restore VSTHRD010

            // Double-click on an item brings up TotalCommander without further ado
            lbConfigurations.MouseDoubleClick += LbConfigurations_MouseDoubleClick;
        }
Exemplo n.º 35
0
 public SettingsHelper(String collectionRootPathArg, WritableSettingsStore storeArg)
 {
     collectionRootPath = collectionRootPathArg;
     store = storeArg;
 }
 public void SetUp()
 {
     mocks = new MockRepository();
     store = mocks.StrictMock<WritableSettingsStore>();
 }
        public BoilerplateSettings()
        {
            SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);

            this.store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            this.store.CreateCollection(CollectionPath);

            // Setting upgrade if needed
            if (this.store.PropertyExists(CollectionPath, VersionKey))
            {
                int storedVersion = this.store.GetInt32(CollectionPath, VersionKey);
                if (storedVersion < LatestVersion)
                {
                    this.SetVersionToLatest();
                }
            }
            else
            {
                if (this.store.PropertyExists(CollectionPath, TestProjectsKey))
                {
                    // We are upgrading from an old version (v0), as we didn't have version tracked, but had a test projects dictionary

                    var mockFrameworks = new List <string> {
                        "Moq", "AutoMoq", "SimpleStubs", "NSubstitute"
                    };
                    var templateTypes = new List <TemplateType> {
                        TemplateType.File, TemplateType.MockFieldDeclaration, TemplateType.MockFieldInitialization, TemplateType.MockObjectReference
                    };
                    foreach (string mockFrameworkName in mockFrameworks)
                    {
                        MockFramework mockFramework = MockFrameworks.Get(mockFrameworkName);

                        foreach (TemplateType templateType in templateTypes)
                        {
                            string templateKey = $"Template_{mockFrameworkName}_{templateType}";

                            if (this.store.PropertyExists(CollectionPath, templateKey))
                            {
                                string oldTemplate = this.store.GetString(CollectionPath, templateKey);

                                this.CreateEntryForTestFramework(oldTemplate, templateType, TestFrameworks.Get("VisualStudio"), mockFramework);
                                this.CreateEntryForTestFramework(oldTemplate, templateType, TestFrameworks.Get("NUnit"), mockFramework);

                                this.store.DeleteProperty(CollectionPath, templateKey);
                            }
                        }
                    }
                }

                this.SetVersionToLatest();
            }

            if (this.store.PropertyExists(CollectionPath, TestProjectsKey))
            {
                string dictionaryString = this.store.GetString(CollectionPath, TestProjectsKey);

                if (string.IsNullOrEmpty(dictionaryString))
                {
                    this.testProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                }
                else
                {
                    this.testProjectsDictionary = new Dictionary <string, string>(JsonConvert.DeserializeObject <Dictionary <string, string> >(dictionaryString), StringComparer.OrdinalIgnoreCase);
                }
            }
            else
            {
                this.testProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            }
        }
Exemplo n.º 38
0
 internal VimApplicationSettings(SVsServiceProvider vsServiceProvider, [EditorUtilsImport] IProtectedOperations protectedOperations)
 {
     var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);
     _settingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
     _protectedOperations = protectedOperations;
 }
Exemplo n.º 39
0
 public PythonToolsOptionsService(IServiceProvider serviceProvider)
 {
     var settingsManager = PythonToolsPackage.GetSettings(serviceProvider);
     _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
 }
Exemplo n.º 40
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private async void Execute(object sender, EventArgs e)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            string                message           = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName);
            SettingsManager       settingsManager   = new ShellSettingsManager((IServiceProvider)ServiceProvider);
            WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            String                serverUrl         = userSettingsStore.GetString("ScantistSCA", "ServerURL", "https://api.scantist.io/");
            String                token             = userSettingsStore.GetString("ScantistSCA", "Token", "");
            String                projectName       = userSettingsStore.GetString("ScantistSCA", "ProjectName", "");

            ProjectDetailWindow projectDetailWindow = new ProjectDetailWindow();

            projectDetailWindow.ServerUrl   = serverUrl;
            projectDetailWindow.Token       = token;
            projectDetailWindow.ProjectName = projectName;
            projectDetailWindow.ShowModal();

            String ServerUrl   = projectDetailWindow.ServerUrl;
            String Token       = projectDetailWindow.Token;
            String ProjectName = projectDetailWindow.ProjectName;
            String FilePath    = projectDetailWindow.txtFileName.Text;

            if (projectDetailWindow.DialogResult.GetValueOrDefault(false))
            {
                var dialogFactory = await ServiceProvider.GetServiceAsync(typeof(SVsThreadedWaitDialogFactory)).ConfigureAwait(false) as IVsThreadedWaitDialogFactory;

                IVsThreadedWaitDialog2 dialog = null;
                if (dialogFactory != null)
                {
                    dialogFactory.CreateInstance(out dialog);
                }

                if (dialog != null && dialog.StartWaitDialog(
                        "Scantist SCA", "Retrieving the project dependency",
                        "We are getting there soon...", null,
                        "ScantistSCA is running...",
                        0, false,
                        true) == VSConstants.S_OK)
                {
                    if (!userSettingsStore.CollectionExists("ScantistSCA"))
                    {
                        userSettingsStore.CreateCollection("ScantistSCA");
                    }

                    userSettingsStore.SetString("ScantistSCA", "ServerURL", ServerUrl);
                    userSettingsStore.SetString("ScantistSCA", "Token", Token);
                    userSettingsStore.SetString("ScantistSCA", "ProjectName", ProjectName);

                    CommandParameters commandParameters = new CommandParameters();
                    commandParameters.parseCommandLine(new string[11] {
                        "-t", Token, "-serverUrl",
                        ServerUrl, "-scanType", "source_code", "-f", Path.GetDirectoryName(FilePath),
                        "-project_name", ProjectName, "--debug"
                    });
                    int scanID = new Application().run(commandParameters);

                    if (scanID == 0)
                    {
                        VsShellUtilities.ShowMessageBox(
                            this.package,
                            "Cannot trigger SCA scan. Please check log file for detail.",
                            "Error",
                            OLEMSGICON.OLEMSGICON_INFO,
                            OLEMSGBUTTON.OLEMSGBUTTON_OK,
                            OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
                    }
                    else
                    {
                        VsShellUtilities.ShowMessageBox(
                            this.package,
                            "Scan " + scanID + " is successfully created.",
                            "Completed",
                            OLEMSGICON.OLEMSGICON_INFO,
                            OLEMSGBUTTON.OLEMSGBUTTON_OK,
                            OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                        userSettingsStore.SetString("ScantistSCA", "ScanID", scanID.ToString());

                        await this.package.JoinableTaskFactory.RunAsync(async delegate
                        {
                            ToolWindowPane window = await this.package.ShowToolWindowAsync(typeof(ComponentResult), 0, true, this.package.DisposalToken);
                            if ((null == window) || (null == window.Frame))
                            {
                                throw new NotSupportedException("Cannot create tool window");
                            }
                        });
                    }
                }
                int usercancel;
                dialog.EndWaitDialog(out usercancel);
            }
        }
Exemplo n.º 41
0
 internal VimApplicationSettings(VisualStudioVersion visualStudioVersion, WritableSettingsStore settingsStore, IVimProtectedOperations protectedOperations)
 {
     _settingsStore       = settingsStore;
     _protectedOperations = protectedOperations;
 }
 public VsUserSettings([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
 {
     var shellSettingsManager = new ShellSettingsManager(serviceProvider);
     settingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
 }
Exemplo n.º 43
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
        /// <param name="progress">A provider for progress updates.</param>
        /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // When initialized asynchronously, the current thread may be a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            try
            {
                SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider);

                configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

                configurationSettingsStore.CreateCollection("LuaDkmDebugger");

                attachOnLaunch   = configurationSettingsStore.GetBoolean("LuaDkmDebugger", "AttachOnLaunch", true);
                breakOnError     = configurationSettingsStore.GetBoolean("LuaDkmDebugger", "BreakOnError", true);
                releaseDebugLogs = configurationSettingsStore.GetBoolean("LuaDkmDebugger", "ReleaseDebugLogs", false);
                showHiddenFrames = configurationSettingsStore.GetBoolean("LuaDkmDebugger", "ShowHiddenFrames", false);
                useSchema        = configurationSettingsStore.GetBoolean("LuaDkmDebugger", "UseSchema", false);

                LuaDkmDebuggerComponent.LocalComponent.attachOnLaunch   = attachOnLaunch;
                LuaDkmDebuggerComponent.LocalComponent.breakOnError     = breakOnError;
                LuaDkmDebuggerComponent.LocalComponent.releaseDebugLogs = releaseDebugLogs;
                LuaDkmDebuggerComponent.LocalComponent.showHiddenFrames = showHiddenFrames;
                LuaDkmDebuggerComponent.LocalComponent.useSchema        = useSchema;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Failed to setup setting with " + e.Message);
            }

            OleMenuCommandService commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                {
                    CommandID menuCommandID = new CommandID(CommandSet, LuaInitializeCommandId);

                    OleMenuCommand menuItem = new OleMenuCommand((object sender, EventArgs args) =>
                    {
                        if (sender is OleMenuCommand command)
                        {
                            command.Visible = false;
                        }
                    }, menuCommandID);

                    menuItem.BeforeQueryStatus += (object sender, EventArgs args) =>
                    {
                        if (sender is OleMenuCommand command)
                        {
                            command.Visible = false;
                        }
                    };

                    menuItem.Visible = false;

                    commandService.AddCommand(menuItem);
                }

                {
                    CommandID menuCommandID = new CommandID(CommandSet, LuaAttachOnLaunchCommandId);

                    OleMenuCommand menuItem = new OleMenuCommand((object sender, EventArgs args) =>
                    {
                        HandleToggleMenuItem(sender, args, "AttachOnLaunch", ref LuaDkmDebuggerComponent.LocalComponent.attachOnLaunch, ref attachOnLaunch);
                    }, menuCommandID);

                    menuItem.BeforeQueryStatus += (object sender, EventArgs args) =>
                    {
                        if (sender is OleMenuCommand command)
                        {
                            command.Checked = attachOnLaunch;
                        }
                    };

                    menuItem.Enabled = true;
                    menuItem.Checked = attachOnLaunch;

                    commandService.AddCommand(menuItem);
                }

                {
                    CommandID menuCommandID = new CommandID(CommandSet, LuaBreakOnErrorCommandId);

                    OleMenuCommand menuItem = new OleMenuCommand((object sender, EventArgs args) =>
                    {
                        HandleToggleMenuItem(sender, args, "BreakOnError", ref LuaDkmDebuggerComponent.LocalComponent.breakOnError, ref breakOnError);
                    }, menuCommandID);

                    menuItem.BeforeQueryStatus += (object sender, EventArgs args) =>
                    {
                        if (sender is OleMenuCommand command)
                        {
                            command.Checked = breakOnError;
                        }
                    };

                    menuItem.Enabled = true;
                    menuItem.Checked = breakOnError;

                    commandService.AddCommand(menuItem);
                }

                {
                    CommandID menuCommandID = new CommandID(CommandSet, LoggingCommandId);

                    OleMenuCommand menuItem = new OleMenuCommand((object sender, EventArgs args) =>
                    {
                        HandleToggleMenuItem(sender, args, "ReleaseDebugLogs", ref LuaDkmDebuggerComponent.LocalComponent.releaseDebugLogs, ref releaseDebugLogs);
                    }, menuCommandID);

                    menuItem.BeforeQueryStatus += (object sender, EventArgs args) =>
                    {
                        if (sender is OleMenuCommand command)
                        {
                            command.Checked = releaseDebugLogs;
                        }
                    };

                    menuItem.Enabled = true;
                    menuItem.Checked = releaseDebugLogs;

                    commandService.AddCommand(menuItem);
                }

                {
                    CommandID menuCommandID = new CommandID(CommandSet, LuaShowHiddenFramesCommandId);

                    OleMenuCommand menuItem = new OleMenuCommand((object sender, EventArgs args) =>
                    {
                        HandleToggleMenuItem(sender, args, "ShowHiddenFrames", ref LuaDkmDebuggerComponent.LocalComponent.showHiddenFrames, ref showHiddenFrames);
                    }, menuCommandID);

                    menuItem.BeforeQueryStatus += (object sender, EventArgs args) =>
                    {
                        if (sender is OleMenuCommand command)
                        {
                            command.Checked = showHiddenFrames;
                        }
                    };

                    menuItem.Enabled = true;
                    menuItem.Checked = showHiddenFrames;

                    commandService.AddCommand(menuItem);
                }

                {
                    CommandID menuCommandID = new CommandID(CommandSet, LuaUseSchemaCommandId);

                    OleMenuCommand menuItem = new OleMenuCommand((object sender, EventArgs args) =>
                    {
                        HandleToggleMenuItem(sender, args, "UseSchema", ref LuaDkmDebuggerComponent.LocalComponent.useSchema, ref useSchema);
                    }, menuCommandID);

                    menuItem.BeforeQueryStatus += (object sender, EventArgs args) =>
                    {
                        if (sender is OleMenuCommand command)
                        {
                            command.Checked = useSchema;
                        }
                    };

                    menuItem.Enabled = true;
                    menuItem.Checked = useSchema;

                    commandService.AddCommand(menuItem);
                }

                {
                    CommandID menuCommandID = new CommandID(CommandSet, LuaShowScriptListCommandId);

                    MenuCommand menuItem = new MenuCommand((object sender, EventArgs args) =>
                    {
                        JoinableTaskFactory.RunAsync(async() =>
                        {
                            ToolWindowPane window = await ShowToolWindowAsync(
                                typeof(ScriptListWindow),
                                0,
                                create: true,
                                cancellationToken: DisposalToken);
                        });
                    }, menuCommandID);

                    commandService.AddCommand(menuItem);
                }
            }

            try
            {
                DTE2 dte = (DTE2)ServiceProvider.GetService(typeof(SDTE));

                scriptListWindowState.dte = dte;

                Debugger5 debugger = dte?.Debugger as Debugger5;

                var debuggerEventHandler = new LuaDebuggerEventHandler(this, debugger);

                ServiceContainer.AddService(debuggerEventHandler.GetType(), debuggerEventHandler, promote: true);
            }
            catch (Exception e)
            {
                Debug.WriteLine("Failed to setup debuggerEventHandler with " + e.Message);
            }
        }
Exemplo n.º 44
0
 public VsWritableSettingsStore(WritableSettingsStore writableSettingsStore)
 {
     this.writableSettingsStore = writableSettingsStore;
 }
Exemplo n.º 45
0
 public static void Initialize(WritableSettingsStore configurationSettingsStore)
 {
     Instance.store = configurationSettingsStore;
 }
Exemplo n.º 46
0
        /// <summary>
        /// Creates new SettingsStoreDexterInfoProvider
        /// </summary>
        /// <param name="serviceProvider"> service provider from the owner package</param>
        public SettingsStoreDexterInfoProvider(IServiceProvider serviceProvider)
        {
            SettingsManager settingsManager = new ShellSettingsManager(serviceProvider);

            settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
        }
 /// <summary>
 /// Creates new SettingsStoreDexterInfoProvider
 /// </summary>
 /// <param name="serviceProvider"> service provider from the owner package</param>
 public SettingsStoreDexterInfoProvider(IServiceProvider serviceProvider)
 {
     SettingsManager settingsManager = new ShellSettingsManager(serviceProvider);
     settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
 }
 public ConfigurableSettingsManager(WritableSettingsStore store)
 {
     this.WritableSettingsStore = store;
 }
Exemplo n.º 49
0
 public SettingsManager(Package settingProvider)
 {
     ShellSettingsManager settingsManager = new ShellSettingsManager(settingProvider as IServiceProvider);
     _settings = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
     LoadSettings();
 }
Exemplo n.º 50
0
 public MediatRSettingsStoreManager(WritableSettingsStore store)
 {
     this.store = store ?? throw new ArgumentNullException(nameof(store));
 }
Exemplo n.º 51
0
 public SettingStoreProvider(string collection)
 {
     this.collection = collection;
     SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);
     userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
 }
Exemplo n.º 52
0
        protected bool DeleteProperty(string settingsRoot, string property)
        {
            WritableSettingsStore userSettingsStore = GetWritableSettingsStore(settingsRoot);

            return(userSettingsStore.DeleteProperty(settingsRoot, property));
        }
Exemplo n.º 53
0
 public SettingsHelper()
 {
     settings        = GetSettings();
     resourceManager = new ResourceManager("DoxygenComments.Settings.DoxygenToolsOptionsBase", typeof(DoxygenToolsOptionsBase).Assembly);
 }
 public ConfigurableSettingsManager(WritableSettingsStore store)
 {
     this.WritableSettingsStore = store;
 }
Exemplo n.º 55
0
        protected void WriteString(string settingsRoot, string property, string value)
        {
            WritableSettingsStore userSettingsStore = GetWritableSettingsStore(settingsRoot);

            userSettingsStore.SetString(settingsRoot, property, value);
        }
Exemplo n.º 56
0
 protected virtual void SaveProperty(WritableSettingsStore store)
 {
 }
Exemplo n.º 57
0
        protected void ClearAllSettings(string settingsRoot)
        {
            WritableSettingsStore userSettingsStore = _settingsManager.Value.GetWritableSettingsStore(SettingsScope.UserSettings);

            userSettingsStore.DeleteCollection(settingsRoot);
        }
Exemplo n.º 58
0
 public PaketSettings(ShellSettingsManager settingsManager)
 {
     settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
     if (!settingsStore.CollectionExists(StoreCollection))
         settingsStore.CreateCollection(StoreCollection);
 }
Exemplo n.º 59
0
 public Settings(WritableSettingsStore settingsStore)
 {
     this.settingsStore = settingsStore;
     LoadSettings();
     CreateApplicationFolderIfNotExist();
 }