protected override Stream UnParse() { long posn; MemoryStream s = new MemoryStream(); BinaryWriter w = new BinaryWriter(s); w.Write(version); posn = s.Position; w.Write((uint)0); w.Write((uint)0); BigEndianUnicodeString.Write(s, partName); w.Write(unknown1); if (version >= 8) { if (blendGeometry == null) { blendGeometry = new TGIBlock(requestedApiVersion, OnResourceChanged); } blendGeometry.UnParse(s); } if (tgiBlocks == null) { tgiBlocks = new TGIBlockList(OnResourceChanged, true); } if (casEntries == null) { casEntries = new CASEntryList(OnResourceChanged, tgiBlocks); } casEntries.UnParse(s); tgiBlocks.UnParse(s, posn); s.Flush(); return(s); }
void Parse(Stream s) { long tgiPosn, tgiSize; BinaryReader r = new BinaryReader(s); version = r.ReadUInt32(); tgiPosn = r.ReadUInt32() + s.Position; tgiSize = r.ReadUInt32(); partName = BigEndianUnicodeString.Read(s); unknown1 = r.ReadUInt32(); if (version >= 8) { blendGeometry = new TGIBlock(requestedApiVersion, OnResourceChanged, s); } casEntries = new CASEntryList(OnResourceChanged, s); tgiBlocks = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize, addEight: version >= 8); casEntries.ParentTGIBlocks = tgiBlocks; }