Support multiple registry path prefixes.

This commit is contained in:
Paul Chote
2016-12-17 17:13:27 +00:00
parent f46a3e2d16
commit d3db66a8af
2 changed files with 10 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ namespace OpenRA
public readonly SourceType Type = SourceType.Disc;
// Used to find installation locations for SourceType.Install
public readonly string[] RegistryPrefixes = { string.Empty };
public readonly string RegistryKey;
public readonly string RegistryValue;

View File

@@ -481,13 +481,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (Platform.CurrentPlatform != PlatformType.Windows)
return null;
var path = Microsoft.Win32.Registry.GetValue(source.RegistryKey, source.RegistryValue, null) as string;
foreach (var prefix in source.RegistryPrefixes)
{
var path = Microsoft.Win32.Registry.GetValue(prefix + source.RegistryKey, source.RegistryValue, null) as string;
if (path == null)
return null;
continue;
return IsValidSourcePath(path, source) ? path : null;
}
return null;
}
if (source.Type == ModContent.SourceType.Disc)
foreach (var volume in volumes)
if (IsValidSourcePath(volume, source))