Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PackageSettings"/> class.
        /// </summary>
        /// <param name="serviceProvider">The <see cref="ServiceProvider"/> to use.</param>
        /// <param name="machineSettingsRegistryKey">
        /// Relative registry path to machine-level settings. The path is relative to the Visual Studio registry root.
        /// </param>
        protected PackageSettings(ServiceProvider serviceProvider, string machineSettingsRegistryKey)
        {
            Tracer.VerifyNonNullArgument(serviceProvider, "serviceProvider");

            // Read in the Visual Studio registry root.
            IVsShell vsShell = serviceProvider.GetVsShell(classType, Tracer.ConstructorMethodName);
            object rootPathObj;
            int hr = vsShell.GetProperty((int)__VSSPROPID.VSSPROPID_VirtualRegistryRoot, out rootPathObj);
            this.visualStudioRegistryRoot = (string)rootPathObj;
            this.machineRootPath = this.RegistryPathCombine(this.visualStudioRegistryRoot, machineSettingsRegistryKey);

            // Initialize all of the machine settings.
            this.traceLevel = new MachineSettingEnum(this.MachineRootPath, KeyNames.TraceLevel, Tracer.Level.Critical, typeof(Tracer.Level));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PackageSettings"/> class.
        /// </summary>
        /// <param name="serviceProvider">The <see cref="ServiceProvider"/> to use.</param>
        /// <param name="machineSettingsRegistryKey">
        /// Relative registry path to machine-level settings. The path is relative to the Visual Studio registry root.
        /// </param>
        protected PackageSettings(ServiceProvider serviceProvider, string machineSettingsRegistryKey)
        {
            Tracer.VerifyNonNullArgument(serviceProvider, "serviceProvider");

            // Read in the Visual Studio registry root.
            IVsShell vsShell = serviceProvider.GetVsShell(classType, Tracer.ConstructorMethodName);
            object   rootPathObj;
            int      hr = vsShell.GetProperty((int)__VSSPROPID.VSSPROPID_VirtualRegistryRoot, out rootPathObj);

            this.visualStudioRegistryRoot = (string)rootPathObj;
            this.machineRootPath          = this.RegistryPathCombine(this.visualStudioRegistryRoot, machineSettingsRegistryKey);

            // Initialize all of the machine settings.
            this.traceLevel = new MachineSettingEnum(this.MachineRootPath, KeyNames.TraceLevel, Tracer.Level.Critical, typeof(Tracer.Level));
        }