(FormatCatalog.LookupGame): look for archive name, too.

This commit is contained in:
morkt 2016-10-11 00:06:27 +04:00
parent f1d66206bc
commit a648aff032

View File

@ -214,10 +214,12 @@ namespace GameRes
/// <returns>Game title, or null if no match was found.</returns> /// <returns>Game title, or null if no match was found.</returns>
public string LookupGame (string arc_name, string pattern = "*.exe") public string LookupGame (string arc_name, string pattern = "*.exe")
{ {
string title;
if (m_game_map.TryGetValue (Path.GetFileName (arc_name), out title))
return title;
pattern = VFS.CombinePath (VFS.GetDirectoryName (arc_name), pattern); pattern = VFS.CombinePath (VFS.GetDirectoryName (arc_name), pattern);
foreach (var file in VFS.GetFiles (pattern).Select (e => Path.GetFileName (e.Name))) foreach (var file in VFS.GetFiles (pattern).Select (e => Path.GetFileName (e.Name)))
{ {
string title;
if (m_game_map.TryGetValue (file, out title)) if (m_game_map.TryGetValue (file, out title))
return title; return title;
} }