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);
}