public override int Read(byte[] buffer, int offset, int count)
{
long bytesToRead = Math.Min(count, RemainingSize);
if (bytesToRead <= 0)
return 0;
bytesToRead = Math.Min(bytesToRead, int.MaxValue);
int result = base.Read(buffer, offset, (int)bytesToRead);
_currentPosition += result;
return result;
}