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; public readonly SourceType Type = SourceType.Disc;
// Used to find installation locations for SourceType.Install // Used to find installation locations for SourceType.Install
public readonly string[] RegistryPrefixes = { string.Empty };
public readonly string RegistryKey; public readonly string RegistryKey;
public readonly string RegistryValue; public readonly string RegistryValue;

View File

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