Пример #1
0
 /// <summary>
 /// Updates the tag instance's state from a block of tag data.
 /// </summary>
 /// <param name="data">The tag data.</param>
 /// <param name="dataOffset">The offset of the tag data relative to the tag instance's header.</param>
 internal void Update(CachedTagData data, uint dataOffset)
 {
     Group                = data.Group;
     Offset               = data.MainStructOffset + dataOffset;
     Dependencies         = new ReadOnlySet <int>(new HashSet <int>(data.Dependencies));
     _pointerOffsets      = data.PointerFixups.Select(fixup => fixup.WriteOffset + dataOffset).ToList();
     _resourceOffsets     = data.ResourcePointerOffsets.Select(offset => offset + dataOffset).ToList();
     _tagReferenceOffsets = data.TagReferenceOffsets.Select(offset => offset + dataOffset).ToList();
 }
Пример #2
0
 /// <summary>
 /// Calculates the header size that would be needed for a given block of tag data.
 /// </summary>
 /// <param name="data">The descriptor to use.</param>
 /// <returns>The size of the tag's header.</returns>
 internal static uint CalculateHeaderSize(CachedTagData data) =>
 (uint)(TagHeaderSize +
        data.Dependencies.Count * 4 +
        data.PointerFixups.Count * 4 +
        data.ResourcePointerOffsets.Count * 4 +
        data.TagReferenceOffsets.Count * 4);