GameRes refactoring.

(FormatCatalog.CreateEntry): method renamed to 'Create' and made generic
towards Entry type.
This commit is contained in:
morkt
2015-08-30 22:34:06 +04:00
parent 4bfdc502e4
commit 46dbf2b142
53 changed files with 75 additions and 99 deletions

View File

@@ -101,8 +101,7 @@ namespace GameRes.Formats.NitroPlus
if (name_length != header.Read (name_buf, 0, name_length))
return null;
var name = Encodings.cp932.GetString (name_buf, 0, name_length);
var entry = new PackedEntry { Name = name };
entry.Type = FormatCatalog.Instance.GetTypeFromName (name);
var entry = FormatCatalog.Instance.Create<PackedEntry> (name);
entry.Offset = base_offset + header.ReadUInt32();
entry.UnpackedSize = header.ReadUInt32();
entry.Size = header.ReadUInt32();

View File

@@ -85,7 +85,7 @@ namespace GameRes.Formats
Encoding enc = GuessEncoding (name_raw);
string filename = enc.GetString (name_raw);
var entry = FormatCatalog.Instance.CreateEntry (filename);
var entry = FormatCatalog.Instance.Create<Entry> (filename);
entry.Size = header.ReadUInt32();
entry.Offset = header.ReadInt64();
if (!entry.CheckPlacement (file.MaxOffset))