public GameLump(BinaryReader reader) { LumpCount = reader.ReadInt32(); for (int i = 0; i < LumpCount; i++) { var lump = SubLump.Read(reader); Lumps[lump.IdName] = lump; } }
public static SubLump Read(BinaryReader reader) { var lump = new SubLump(); lump.Id = reader.ReadInt32(); lump.Flags = reader.ReadUInt16(); lump.Version = reader.ReadUInt16(); lump.FileOffset = reader.ReadInt32(); lump.FileLength = reader.ReadInt32(); var position = reader.BaseStream.Position; reader.BaseStream.Position = lump.FileOffset; switch (lump.IdName) { case "sprp": lump.Data = new StaticProps(reader, lump.FileLength, lump.Version); break; } reader.BaseStream.Position = position; return(lump); }