From 6b28055bd8f50c6d018fdeab42f968a769975bf3 Mon Sep 17 00:00:00 2001 From: morkt Date: Thu, 5 Jan 2017 04:13:45 +0400 Subject: [PATCH] (LpkOpener): added FormatCatalog.LookupGame call. --- ArcFormats/Lucifen/ArcLPK.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ArcFormats/Lucifen/ArcLPK.cs b/ArcFormats/Lucifen/ArcLPK.cs index 2293156f..577ba83d 100644 --- a/ArcFormats/Lucifen/ArcLPK.cs +++ b/ArcFormats/Lucifen/ArcLPK.cs @@ -2,7 +2,7 @@ //! \date Mon Feb 16 17:21:47 2015 //! \brief Lucifen Easy Game System archive implementation. // -// Copyright (C) 2015-2016 by morkt +// Copyright (C) 2015-2017 by morkt // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to @@ -132,7 +132,7 @@ namespace GameRes.Formats.Lucifen return arc; } catch { /* unknown encryption, ignore parse errors */ } - var new_scheme = QueryEncryptionScheme(); + var new_scheme = QueryEncryptionScheme (file.Name); if (new_scheme == CurrentScheme && !CurrentScheme.ImportGameInit) return null; CurrentScheme = new_scheme; @@ -354,14 +354,21 @@ namespace GameRes.Formats.Lucifen return new GUI.WidgetLPK(); } - EncryptionScheme QueryEncryptionScheme () + EncryptionScheme QueryEncryptionScheme (string arc_name) { CurrentFileMap.Clear(); + string title = FormatCatalog.Instance.LookupGame (arc_name); + Dictionary file_map; + if (!string.IsNullOrEmpty (title) && KnownSchemes.ContainsKey (title)) + { + if (KnownKeys.TryGetValue (title, out file_map)) + CurrentFileMap = new Dictionary (file_map); + return KnownSchemes[title]; + } var options = Query (arcStrings.ArcEncryptedNotice); if (null == options) return DefaultScheme; - string title = options.Scheme; - Dictionary file_map; + title = options.Scheme; if (KnownKeys.TryGetValue (title, out file_map)) CurrentFileMap = new Dictionary (file_map); return KnownSchemes[title];