ReadFromRegistry() приватный Метод

Reads settings from Windows policy registry keys and transfers them to properties.
private ReadFromRegistry ( ) : void
Результат void
Пример #1
0
        public static Config Load()
        {
            // Locate all applicable config files
            var paths = Locations.GetLoadConfigPaths("0install.net", true, "injector", "global");

            // Accumulate values from all files
            var config = new Config();

            foreach (var path in paths.Reverse()) // Read least important first
            {
                config.ReadFromIniFile(path);
            }

            // Apply Windows registry policies (override existing config)
            if (WindowsUtils.IsWindowsNT)
            {
                using (var registryKey = Registry.LocalMachine.OpenSubKey(RegistryPolicyPath, writable: false))
                    if (registryKey != null)
                    {
                        config.ReadFromRegistry(registryKey);
                    }
                using (var registryKey = Registry.CurrentUser.OpenSubKey(RegistryPolicyPath, writable: false))
                    if (registryKey != null)
                    {
                        config.ReadFromRegistry(registryKey);
                    }
            }

            return(config);
        }
Пример #2
0
        public static Config Load()
        {
            var config = new Config();

            config.ReadFromAppSettings();
            config.ReadFromIniFiles();
            if (WindowsUtils.IsWindowsNT)
            {
                config.ReadFromRegistry();
            }

            return(config);
        }
Пример #3
0
        public static Config Load()
        {
            // Locate all applicable config files
            var paths = Locations.GetLoadConfigPaths("0install.net", true, "injector", "global");

            // Accumulate values from all files
            var config = new Config();
            foreach (var path in paths.Reverse()) // Read least important first
                config.ReadFromIniFile(path);

            // Apply Windows registry policies (override existing config)
            if (WindowsUtils.IsWindowsNT)
            {
                using (var registryKey = Registry.LocalMachine.OpenSubKey(RegistryPolicyPath, writable: false))
                    if (registryKey != null) config.ReadFromRegistry(registryKey);
                using (var registryKey = Registry.CurrentUser.OpenSubKey(RegistryPolicyPath, writable: false))
                    if (registryKey != null) config.ReadFromRegistry(registryKey);
            }

            return config;
        }
Пример #4
0
        public static Config Load()
        {
            var config = new Config();

            config.ReadFromAppSettings();
            config.ReadFromIniFiles();
            if (WindowsUtils.IsWindowsNT)
                config.ReadFromRegistry();

            return config;
        }