public override void EndSegment() { var segment = Segments.Pop(); if (_binaryReader.BaseStream.Position != segment.End) { throw new InvalidStateException($"Stream position expected to be at 0x{segment.End:X8} but was at 0x{_binaryReader.BaseStream.Position:X8} while reading {segment.Name}"); } }
public override void EndSegment() { var segment = Segments.Pop(); var currentPosition = _binaryWriter.BaseStream.Position; var segmentLength = currentPosition - segment.Start; _binaryWriter.BaseStream.Position = segment.Start - 4; _binaryWriter.Write((uint)segmentLength); _binaryWriter.BaseStream.Position = currentPosition; }