diff --git a/ArcFormats/Emote/ArcPSB.cs b/ArcFormats/Emote/ArcPSB.cs index 6f91ea97..30756050 100644 --- a/ArcFormats/Emote/ArcPSB.cs +++ b/ArcFormats/Emote/ArcPSB.cs @@ -77,30 +77,28 @@ namespace GameRes.Formats.Emote try { if (reader.Parse (key)) - { - var dir = reader.GetTextures(); - if (null == dir) - dir = reader.GetLayers(); - if (null == dir || 0 == dir.Count) - return null; - return new ArcFile (file, this, dir); - } + return OpenArcFile (reader, file); if (!reader.IsEncrypted) break; } catch { /* ignore parse errors caused by invalid key */ } } if (reader.ParseNonEncrypted()) - { - var dir = reader.GetLayers(); - if (null == dir) - return null; - return new ArcFile (file, this, dir); - } + return OpenArcFile (reader, file); return null; } } + ArcFile OpenArcFile (PsbReader reader, ArcView file) + { + var dir = reader.GetTextures(); + if (null == dir) + dir = reader.GetLayers(); + if (null == dir || 0 == dir.Count) + return null; + return new ArcFile (file, this, dir); + } + public override IImageDecoder OpenImage (ArcFile arc, Entry entry) { var tex = (TexEntry)entry;