diff --git a/GameRes/ArcFile.cs b/GameRes/ArcFile.cs index 434666fe..1c1bd98f 100644 --- a/GameRes/ArcFile.cs +++ b/GameRes/ArcFile.cs @@ -58,18 +58,22 @@ namespace GameRes /// /// Try to open as archive. - /// Returns: ArcFile object if file is opened successfully, null otherwise. /// + /// + /// ArcFile object if file is opened successfully, null otherwise. + /// public static ArcFile TryOpen (string filename) { var file = new ArcView (filename); + string ext = Path.GetExtension (filename).TrimStart ('.').ToLower(); try { uint signature = file.View.ReadUInt32 (0); for (;;) { var range = FormatCatalog.Instance.LookupSignature (signature); - foreach (var impl in range) + // check formats that match filename extension first + foreach (var impl in range.OrderByDescending (f => f.Extensions.First() == ext)) { try {