ReadFromRegistry() private method

Reads settings from Windows policy registry keys and transfers them to properties.
private ReadFromRegistry ( ) : void
return void
Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public static Config Load()
        {
            var config = new Config();

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

            return(config);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 4
0
        public static Config Load()
        {
            var config = new Config();

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

            return config;
        }