// public MTST(int APIversion, EventHandler handler, uint nameHash, GenericRCOLResource.ChunkReference index, IEnumerable<Type300Entry> list) // : base(APIversion, handler, null) // { // this.nameHash = nameHash; // this.index = new GenericRCOLResource.ChunkReference(requestedApiVersion, handler, index); // this.matdList200 = list == null ? null : new Type200EntryList(OnRCOLChanged, list); // } #endregion #region ARCOLBlock protected override void Parse(Stream s) { BinaryReader r = new BinaryReader(s); tag = r.ReadUInt32(); if (checking) { if (tag != (uint)FOURCC("MTST")) { throw new InvalidDataException(String.Format("Invalid Tag read: '{0}'; expected: 'MTST'; at 0x{1:X8}", FOURCC(tag), s.Position)); } } version = r.ReadUInt32(); //if (checking) if (version != 0x00000200) // throw new InvalidDataException(String.Format("Invalid Version read: 0x{0:X8}; expected 0x00000200; at 0x{1:X8}", version, s.Position)); nameHash = r.ReadUInt32(); index = new GenericRCOLResource.ChunkReference(requestedApiVersion, handler, s); if (this.version < 768U) { matdList200 = new Type200EntryList(OnRCOLChanged, s); } else { matdList300 = new Type300EntryList(OnRCOLChanged, s); } }
public override Stream UnParse() { MemoryStream ms = new MemoryStream(); BinaryWriter w = new BinaryWriter(ms); w.Write(tag); w.Write(version); w.Write(nameHash); if (index == null) { this.index = new GenericRCOLResource.ChunkReference(requestedApiVersion, handler, 0); } index.UnParse(ms); if (matdList200 == null) { this.matdList200 = new Type200EntryList(OnRCOLChanged); } if (matdList300 == null) { this.matdList300 = new Type300EntryList(OnRCOLChanged); } if (this.version < 768U) { this.matdList200.UnParse(ms); } else { this.matdList300.UnParse(ms); } return(ms); }
public MTST(int APIversion, EventHandler handler, MTST basis) : base(APIversion, handler, null) { this.version = basis.version; this.nameHash = basis.nameHash; this.index = new GenericRCOLResource.ChunkReference(requestedApiVersion, handler, basis.index); this.matdList200 = basis.matdList200 == null ? null : new Type200EntryList(OnRCOLChanged, basis.matdList200); this.matdList300 = basis.matdList300 == null ? null : new Type300EntryList(OnRCOLChanged, basis.matdList300); }