public override void Load(BinaryReaderEx reader) { BasePosition = reader.BaseStream.Position; Type = reader.ReadInt16(); Unk1 = reader.ReadInt16(); Unk2 = reader.ReadInt16(); NumOffsets = reader.ReadInt16(); StringTableOffset = reader.ReadInt32(); for (var i = 0; i < NumOffsets; i++) { Offsets.Add(reader.ReadInt32()); } if (StringTableOffset != 0) { reader.BaseStream.Position = BasePosition + StringTableOffset; StringTableBase = BasePosition + StringTableOffset; NumStrings = reader.ReadInt32(); for (var i = 0; i < NumStrings; i++) { StringOffsets.Add(reader.ReadInt32()); } for (var i = 0; i < NumStrings; i++) { reader.BaseStream.Position = StringTableBase + StringOffsets[i] + 4; Strings.Add(reader.ReadNullTerminatedString()); } } for (var i = 0; i < NumOffsets; i++) { reader.BaseStream.Position = BasePosition + this.Offsets[i]; short type = reader.ReadInt16(); SparkleChunkBase c; switch (type) { case 1: c = new SparkleChunk1(); break; case 2: c = new SparkleChunk2(); break; case 3: c = new SparkleChunk3(); break; default: throw new InvalidOperationException("Unexpected Sparkle Chunk Type: " + type); } reader.BaseStream.Position = BasePosition + this.Offsets[i]; c.Load(reader); this.Chunks.Add(c); } }