/// <summary> /// Reads the header for the tag instance from a stream. /// </summary> /// <param name="reader">The stream to read from.</param> internal void ReadHeader(BinaryReader reader) { Checksum = reader.ReadUInt32(); // 0x00 uint32 checksum TotalSize = reader.ReadUInt32(); // 0x04 uint32 total size var numDependencies = reader.ReadInt16(); // 0x08 int16 dependencies count var numDataFixups = reader.ReadInt16(); // 0x0A int16 data fixup count var numResourceFixups = reader.ReadInt16(); // 0x0C int16 resource fixup count reader.BaseStream.Position += 2; // 0x0E int16 (padding) MainStructOffset = reader.ReadUInt32(); // 0x10 uint32 main struct offset var groupTag = new Tag(reader.ReadInt32()); // 0x14 int32 group tag var parentGroupTag = new Tag(reader.ReadInt32()); // 0x18 int32 parent group tag var grandparentGroupTag = new Tag(reader.ReadInt32()); // 0x1C int32 grandparent group tag var groupName = new StringID(reader.ReadUInt32()); // 0x20 uint32 group name stringid Group = new TagGroup(groupTag, parentGroupTag, grandparentGroupTag, groupName); // Read dependencies var dependencies = new HashSet <int>(); for (var j = 0; j < numDependencies; j++) { dependencies.Add(reader.ReadInt32()); } Dependencies = new ReadOnlySet <int>(dependencies); // Read offsets _pointerOffsets = new List <uint>(numDataFixups); for (var j = 0; j < numDataFixups; j++) { _pointerOffsets.Add(PointerToOffset(reader.ReadUInt32())); } _resourceOffsets = new List <uint>(numResourceFixups); for (var j = 0; j < numResourceFixups; j++) { _resourceOffsets.Add(PointerToOffset(reader.ReadUInt32())); } }
internal TagInstance(int index, TagGroup group) { Index = index; Group = group; }
/// <summary> /// Determines whether the tag belongs to a tag group. /// </summary> /// <param name="group">The tag group.</param> /// <returns><c>true</c> if the tag belongs to the group.</returns> public bool IsInGroup(TagGroup group) { return(Group.BelongsTo(group)); }