(MblOpener): added static shortcut to PrsFormat.

This commit is contained in:
morkt 2015-08-14 06:10:27 +04:00
parent 5830c0d8a2
commit 19b8c0015c

View File

@ -75,6 +75,8 @@ namespace GameRes.Formats.Marble
return arc; return arc;
} }
static readonly Lazy<ImageFormat> PrsFormat = new Lazy<ImageFormat> (() => FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == "PRS"));
private ArcFile ReadIndex (ArcView file, int count, uint filename_len, uint index_offset) private ArcFile ReadIndex (ArcView file, int count, uint filename_len, uint index_offset)
{ {
uint index_size = (8u + filename_len) * (uint)count; uint index_size = (8u + filename_len) * (uint)count;
@ -114,8 +116,11 @@ namespace GameRes.Formats.Marble
entry = new AutoEntry (name, () => { entry = new AutoEntry (name, () => {
uint signature = file.View.ReadUInt32 (offset); uint signature = file.View.ReadUInt32 (offset);
if (0x4259 == (0xffff & signature)) if (0x4259 == (0xffff & signature))
return FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == "PRS"); return PrsFormat.Value;
else if (0 != signature)
return FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault(); return FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault();
else
return null;
}); });
} }
else else