use explicit type declarations instead of LINQ Cast().

This commit is contained in:
morkt 2016-03-22 06:58:28 +04:00
parent 0a8454d95d
commit 65d04bc1c2
7 changed files with 7 additions and 9 deletions

View File

@ -179,7 +179,7 @@ namespace GameRes.Formats.Amaterasu
var file_table = new SortedDictionary<uint, PackedEntry>(); var file_table = new SortedDictionary<uint, PackedEntry>();
if (null != base_archive) if (null != base_archive)
{ {
foreach (var entry in base_archive.Dir.Cast<AmiEntry>()) foreach (AmiEntry entry in base_archive.Dir)
file_table[entry.Id] = entry; file_table[entry.Id] = entry;
} }
int update_count = UpdateFileTable (file_table, list); int update_count = UpdateFileTable (file_table, list);

View File

@ -27,7 +27,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.IO; using System.IO;
using System.Linq;
using GameRes.Utility; using GameRes.Utility;
namespace GameRes.Formats.Ankh namespace GameRes.Formats.Ankh
@ -78,7 +77,7 @@ namespace GameRes.Formats.Ankh
} }
if (0 == dir.Count) if (0 == dir.Count)
return null; return null;
foreach (var entry in dir.Cast<PackedEntry>()) foreach (PackedEntry entry in dir)
{ {
if (entry.Size < 4) if (entry.Size < 4)
continue; continue;

View File

@ -79,7 +79,7 @@ namespace GameRes.Formats.Ail
return null; return null;
byte[] preview = new byte[16]; byte[] preview = new byte[16];
byte[] sign_buf = new byte[4]; byte[] sign_buf = new byte[4];
foreach (var entry in dir.Cast<PackedEntry>()) foreach (PackedEntry entry in dir)
{ {
uint extra = 6; uint extra = 6;
if (extra > entry.Size) if (extra > entry.Size)

View File

@ -27,7 +27,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.IO; using System.IO;
using System.Linq;
using GameRes.Utility; using GameRes.Utility;
namespace GameRes.Formats.Propeller namespace GameRes.Formats.Propeller
@ -79,7 +78,7 @@ namespace GameRes.Formats.Propeller
{ {
dir.Add (new PackedEntry { Name = base_name+".bmp", Type = "image", Offset = current }); dir.Add (new PackedEntry { Name = base_name+".bmp", Type = "image", Offset = current });
} }
foreach (var entry in dir.Cast<PackedEntry>()) foreach (PackedEntry entry in dir)
{ {
entry.UnpackedSize = file.View.ReadUInt32 (entry.Offset); entry.UnpackedSize = file.View.ReadUInt32 (entry.Offset);
entry.Size = file.View.ReadUInt32 (entry.Offset+4); entry.Size = file.View.ReadUInt32 (entry.Offset+4);

View File

@ -77,7 +77,7 @@ namespace GameRes.Formats.SHSystem
static protected void DetectFileTypes (ArcView file, List<Entry> dir) static protected void DetectFileTypes (ArcView file, List<Entry> dir)
{ {
byte[] signature_buffer = new byte[4]; byte[] signature_buffer = new byte[4];
foreach (var entry in dir.Cast<PackedEntry>()) foreach (PackedEntry entry in dir)
{ {
uint packed_size = file.View.ReadUInt32 (entry.Offset); uint packed_size = file.View.ReadUInt32 (entry.Offset);
uint unpacked_size = file.View.ReadUInt32 (entry.Offset+4); uint unpacked_size = file.View.ReadUInt32 (entry.Offset+4);

View File

@ -79,7 +79,7 @@ namespace GameRes.Formats.Yuka
index_offset += 0x14; index_offset += 0x14;
} }
// read in two cycles to avoid memory mapped file page switching when accessing names // read in two cycles to avoid memory mapped file page switching when accessing names
foreach (var entry in dir.Cast<YukaEntry>()) foreach (YukaEntry entry in dir)
{ {
entry.Name = file.View.ReadString (entry.NameOffset, entry.NameLength); entry.Name = file.View.ReadString (entry.NameOffset, entry.NameLength);
entry.Type = FormatCatalog.Instance.GetTypeFromName (entry.Name); entry.Type = FormatCatalog.Instance.GetTypeFromName (entry.Name);

View File

@ -73,7 +73,7 @@ namespace GameRes.Formats.Zyx
} }
pixels = FirstFrame.Clone() as byte[]; pixels = FirstFrame.Clone() as byte[];
int i = 1; int i = 1;
foreach (var entry in Dir.Skip(1).Cast<BdfFrame>()) foreach (BdfFrame entry in Dir.Skip(1))
{ {
if (i++ > frame.Number) if (i++ > frame.Number)
break; break;