ZeroInstall.Store.Config.ReadFromRegistry C# (CSharp) Method

ReadFromRegistry() private method

Reads settings from Windows policy registry keys and transfers them to properties.
private ReadFromRegistry ( ) : void
return void
        private void ReadFromRegistry()
        {
            using (var registryKey = Registry.LocalMachine.OpenSubKey(RegistryPolicyPath, writable: false))
                if (registryKey != null) ReadFromRegistry(registryKey);
            using (var registryKey = Registry.CurrentUser.OpenSubKey(RegistryPolicyPath, writable: false))
                if (registryKey != null) ReadFromRegistry(registryKey);
        }

Same methods

Config::ReadFromRegistry ( [ registryKey ) : void

Usage Example

示例#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);
        }
All Usage Examples Of ZeroInstall.Store.Config::ReadFromRegistry