(INT): added scheme lookup by executable name.

This commit is contained in:
morkt 2017-07-28 16:53:34 +04:00
parent c499d4c707
commit 8724e8131c
2 changed files with 6 additions and 3 deletions

View File

@ -128,7 +128,7 @@ namespace GameRes.Formats.CatSystem
return null;
if (file.View.AsciiEqual (8, "__key__.dat\x00"))
{
uint? key = QueryEncryptionInfo();
uint? key = QueryEncryptionInfo (file.Name);
if (null == key)
throw new UnknownEncryptionScheme();
return OpenEncrypted (file, entry_count, key.Value);
@ -274,8 +274,11 @@ namespace GameRes.Formats.CatSystem
return new GUI.CreateINTWidget();
}
uint? QueryEncryptionInfo ()
uint? QueryEncryptionInfo (string arc_name)
{
var title = FormatCatalog.Instance.LookupGame (arc_name);
if (!string.IsNullOrEmpty (title) && KnownSchemes.ContainsKey (title))
return KnownSchemes[title].Key;
var options = Query<IntOptions> (arcStrings.INTNotice);
return options.EncryptionInfo.GetKey();
}

View File

@ -86,7 +86,7 @@ namespace GameRes.Formats.GUI
CheckPathExists = true,
Multiselect = false,
Title = arcStrings.INTChooseExe,
Filter = arcStrings.INTExeFiles+"|*.exe",
Filter = arcStrings.INTExeFiles+"|*.exe;*.bin",
FilterIndex = 1,
InitialDirectory = Directory.GetCurrentDirectory(),
};