From 5830c0d8a264ad03b97c76e742024282dd7305dc Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 14 Aug 2015 06:09:04 +0400 Subject: [PATCH] use FirstOrDefault() in linq query instead of Where(). --- ArcFormats/ArcMAI.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ArcFormats/ArcMAI.cs b/ArcFormats/ArcMAI.cs index 7946f989..60c23630 100644 --- a/ArcFormats/ArcMAI.cs +++ b/ArcFormats/ArcMAI.cs @@ -101,18 +101,18 @@ namespace GameRes.Formats.MAI var offset = file.View.ReadUInt32 (index_offset+0x10); var entry = new AutoEntry (Path.Combine (current_folder, name), () => { uint signature = file.View.ReadUInt32 (offset); - IEnumerable res; if (is_mask_arc) - res = FormatCatalog.Instance.ImageFormats.Where (x => x.Tag == "MSK/MAI"); + return FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == "MSK/MAI"); else if (0x4d43 == (signature & 0xffff)) // 'CM' - res = FormatCatalog.Instance.ImageFormats.Where (x => x.Tag == "CMP/MAI"); + return FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == "CMP/MAI"); else if (0x4d41 == (signature & 0xffff)) // 'AM' - res = FormatCatalog.Instance.ImageFormats.Where (x => x.Tag == "AM/MAI"); + return FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == "AM/MAI"); else if (0x4d42 == (signature & 0xffff)) // 'BM' - res = FormatCatalog.Instance.ImageFormats.Where (x => x.Tag == "BMP"); + return ImageFormat.Bmp; + else if (signature != 0) + return FormatCatalog.Instance.LookupSignature (signature).FirstOrDefault(); else - res = FormatCatalog.Instance.LookupSignature (signature); - return res.FirstOrDefault(); + return null; }); entry.Offset = offset; entry.Size = file.View.ReadUInt32 (index_offset+0x14);