Files
Dec2017-Script-Dump/protobuf3/CodedInputStream.cs
T
2026-06-04 11:42:34 +02:00

937 lines
24 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
namespace Google.Protobuf
{
// Token: 0x02000004 RID: 4
public sealed class CodedInputStream : IDisposable
{
// Token: 0x0600001E RID: 30 RVA: 0x000022D5 File Offset: 0x000004D5
public CodedInputStream(byte[] buffer)
: this(null, ProtoPreconditions.CheckNotNull<byte[]>(buffer, "buffer"), 0, buffer.Length)
{
}
// Token: 0x0600001F RID: 31 RVA: 0x000022F0 File Offset: 0x000004F0
public CodedInputStream(byte[] buffer, int offset, int length)
: this(null, ProtoPreconditions.CheckNotNull<byte[]>(buffer, "buffer"), offset, offset + length)
{
if (offset < 0 || offset > buffer.Length)
{
throw new ArgumentOutOfRangeException("offset", "Offset must be within the buffer");
}
if (length < 0 || offset + length > buffer.Length)
{
throw new ArgumentOutOfRangeException("length", "Length must be non-negative and within the buffer");
}
}
// Token: 0x06000020 RID: 32 RVA: 0x00002349 File Offset: 0x00000549
public CodedInputStream(Stream input)
: this(input, false)
{
}
// Token: 0x06000021 RID: 33 RVA: 0x00002353 File Offset: 0x00000553
public CodedInputStream(Stream input, bool leaveOpen)
: this(ProtoPreconditions.CheckNotNull<Stream>(input, "input"), new byte[4096], 0, 0)
{
this.leaveOpen = leaveOpen;
}
// Token: 0x06000022 RID: 34 RVA: 0x0000237C File Offset: 0x0000057C
internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize)
{
this.input = input;
this.buffer = buffer;
this.bufferPos = bufferPos;
this.bufferSize = bufferSize;
this.sizeLimit = 67108864;
this.recursionLimit = 64;
}
// Token: 0x06000023 RID: 35 RVA: 0x000023CC File Offset: 0x000005CC
internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit)
: this(input, buffer, bufferPos, bufferSize)
{
if (sizeLimit <= 0)
{
throw new ArgumentOutOfRangeException("sizeLimit", "Size limit must be positive");
}
if (recursionLimit <= 0)
{
throw new ArgumentOutOfRangeException("recursionLimit!", "Recursion limit must be positive");
}
this.sizeLimit = sizeLimit;
this.recursionLimit = recursionLimit;
}
// Token: 0x06000024 RID: 36 RVA: 0x0000241E File Offset: 0x0000061E
public static CodedInputStream CreateWithLimits(Stream input, int sizeLimit, int recursionLimit)
{
return new CodedInputStream(input, new byte[4096], 0, 0, sizeLimit, recursionLimit);
}
// Token: 0x17000005 RID: 5
// (get) Token: 0x06000025 RID: 37 RVA: 0x00002434 File Offset: 0x00000634
public long Position
{
get
{
if (this.input != null)
{
return this.input.Position - (long)(this.bufferSize + this.bufferSizeAfterLimit - this.bufferPos);
}
return (long)this.bufferPos;
}
}
// Token: 0x17000006 RID: 6
// (get) Token: 0x06000026 RID: 38 RVA: 0x00002467 File Offset: 0x00000667
internal uint LastTag
{
get
{
return this.lastTag;
}
}
// Token: 0x17000007 RID: 7
// (get) Token: 0x06000027 RID: 39 RVA: 0x0000246F File Offset: 0x0000066F
public int SizeLimit
{
get
{
return this.sizeLimit;
}
}
// Token: 0x17000008 RID: 8
// (get) Token: 0x06000028 RID: 40 RVA: 0x00002477 File Offset: 0x00000677
public int RecursionLimit
{
get
{
return this.recursionLimit;
}
}
// Token: 0x06000029 RID: 41 RVA: 0x0000247F File Offset: 0x0000067F
public void Dispose()
{
if (!this.leaveOpen)
{
this.input.Dispose();
}
}
// Token: 0x0600002A RID: 42 RVA: 0x00002494 File Offset: 0x00000694
internal void CheckReadEndOfStreamTag()
{
if (this.lastTag != 0U)
{
throw InvalidProtocolBufferException.MoreDataAvailable();
}
}
// Token: 0x0600002B RID: 43 RVA: 0x000024A4 File Offset: 0x000006A4
public uint PeekTag()
{
if (this.hasNextTag)
{
return this.nextTag;
}
uint num = this.lastTag;
this.nextTag = this.ReadTag();
this.hasNextTag = true;
this.lastTag = num;
return this.nextTag;
}
// Token: 0x0600002C RID: 44 RVA: 0x000024E8 File Offset: 0x000006E8
public uint ReadTag()
{
if (this.hasNextTag)
{
this.lastTag = this.nextTag;
this.hasNextTag = false;
return this.lastTag;
}
if (this.bufferPos + 2 <= this.bufferSize)
{
byte[] array = this.buffer;
int num = this.bufferPos;
this.bufferPos = num + 1;
int num2 = array[num];
if (num2 < 128)
{
this.lastTag = (uint)num2;
}
else
{
int num3 = num2 & 127;
byte[] array2 = this.buffer;
num = this.bufferPos;
this.bufferPos = num + 1;
if ((num2 = array2[num]) < 128)
{
num3 |= num2 << 7;
this.lastTag = (uint)num3;
}
else
{
this.bufferPos -= 2;
this.lastTag = this.ReadRawVarint32();
}
}
}
else
{
if (this.IsAtEnd)
{
this.lastTag = 0U;
return 0U;
}
this.lastTag = this.ReadRawVarint32();
}
if (this.lastTag == 0U)
{
throw InvalidProtocolBufferException.InvalidTag();
}
return this.lastTag;
}
// Token: 0x0600002D RID: 45 RVA: 0x000025D4 File Offset: 0x000007D4
public void SkipLastField()
{
if (this.lastTag == 0U)
{
throw new InvalidOperationException("SkipLastField cannot be called at the end of a stream");
}
switch (WireFormat.GetTagWireType(this.lastTag))
{
case WireFormat.WireType.Varint:
this.ReadRawVarint32();
return;
case WireFormat.WireType.Fixed64:
this.ReadFixed64();
return;
case WireFormat.WireType.LengthDelimited:
{
int num = this.ReadLength();
this.SkipRawBytes(num);
return;
}
case WireFormat.WireType.StartGroup:
this.SkipGroup(this.lastTag);
return;
case WireFormat.WireType.EndGroup:
throw new InvalidProtocolBufferException("SkipLastField called on an end-group tag, indicating that the corresponding start-group was missing");
case WireFormat.WireType.Fixed32:
this.ReadFixed32();
return;
default:
return;
}
}
// Token: 0x0600002E RID: 46 RVA: 0x00002660 File Offset: 0x00000860
private void SkipGroup(uint startGroupTag)
{
this.recursionDepth++;
if (this.recursionDepth >= this.recursionLimit)
{
throw InvalidProtocolBufferException.RecursionLimitExceeded();
}
uint num;
for (;;)
{
num = this.ReadTag();
if (num == 0U)
{
break;
}
if (WireFormat.GetTagWireType(num) == WireFormat.WireType.EndGroup)
{
goto IL_43;
}
this.SkipLastField();
}
throw InvalidProtocolBufferException.TruncatedMessage();
IL_43:
int tagFieldNumber = WireFormat.GetTagFieldNumber(startGroupTag);
int tagFieldNumber2 = WireFormat.GetTagFieldNumber(num);
if (tagFieldNumber != tagFieldNumber2)
{
throw new InvalidProtocolBufferException(string.Format("Mismatched end-group tag. Started with field {0}; ended with field {1}", tagFieldNumber, tagFieldNumber2));
}
this.recursionDepth--;
}
// Token: 0x0600002F RID: 47 RVA: 0x000026EC File Offset: 0x000008EC
public double ReadDouble()
{
return BitConverter.Int64BitsToDouble((long)this.ReadRawLittleEndian64());
}
// Token: 0x06000030 RID: 48 RVA: 0x000026FC File Offset: 0x000008FC
public float ReadFloat()
{
if (BitConverter.IsLittleEndian && 4 <= this.bufferSize - this.bufferPos)
{
float num = BitConverter.ToSingle(this.buffer, this.bufferPos);
this.bufferPos += 4;
return num;
}
byte[] array = this.ReadRawBytes(4);
if (!BitConverter.IsLittleEndian)
{
ByteArray.Reverse(array);
}
return BitConverter.ToSingle(array, 0);
}
// Token: 0x06000031 RID: 49 RVA: 0x0000275C File Offset: 0x0000095C
public ulong ReadUInt64()
{
return this.ReadRawVarint64();
}
// Token: 0x06000032 RID: 50 RVA: 0x0000275C File Offset: 0x0000095C
public long ReadInt64()
{
return (long)this.ReadRawVarint64();
}
// Token: 0x06000033 RID: 51 RVA: 0x00002764 File Offset: 0x00000964
public int ReadInt32()
{
return (int)this.ReadRawVarint32();
}
// Token: 0x06000034 RID: 52 RVA: 0x0000276C File Offset: 0x0000096C
public ulong ReadFixed64()
{
return this.ReadRawLittleEndian64();
}
// Token: 0x06000035 RID: 53 RVA: 0x00002774 File Offset: 0x00000974
public uint ReadFixed32()
{
return this.ReadRawLittleEndian32();
}
// Token: 0x06000036 RID: 54 RVA: 0x0000277C File Offset: 0x0000097C
public bool ReadBool()
{
return this.ReadRawVarint32() > 0U;
}
// Token: 0x06000037 RID: 55 RVA: 0x00002788 File Offset: 0x00000988
public string ReadString()
{
int num = this.ReadLength();
if (num == 0)
{
return "";
}
if (num <= this.bufferSize - this.bufferPos)
{
string @string = CodedOutputStream.Utf8Encoding.GetString(this.buffer, this.bufferPos, num);
this.bufferPos += num;
return @string;
}
return CodedOutputStream.Utf8Encoding.GetString(this.ReadRawBytes(num), 0, num);
}
// Token: 0x06000038 RID: 56 RVA: 0x000027F0 File Offset: 0x000009F0
public void ReadMessage(IMessage builder)
{
int num = this.ReadLength();
if (this.recursionDepth >= this.recursionLimit)
{
throw InvalidProtocolBufferException.RecursionLimitExceeded();
}
int num2 = this.PushLimit(num);
this.recursionDepth++;
builder.MergeFrom(this);
this.CheckReadEndOfStreamTag();
if (!this.ReachedLimit)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
this.recursionDepth--;
this.PopLimit(num2);
}
// Token: 0x06000039 RID: 57 RVA: 0x00002860 File Offset: 0x00000A60
public ByteString ReadBytes()
{
int num = this.ReadLength();
if (num <= this.bufferSize - this.bufferPos && num > 0)
{
ByteString byteString = ByteString.CopyFrom(this.buffer, this.bufferPos, num);
this.bufferPos += num;
return byteString;
}
return ByteString.AttachBytes(this.ReadRawBytes(num));
}
// Token: 0x0600003A RID: 58 RVA: 0x00002764 File Offset: 0x00000964
public uint ReadUInt32()
{
return this.ReadRawVarint32();
}
// Token: 0x0600003B RID: 59 RVA: 0x00002764 File Offset: 0x00000964
public int ReadEnum()
{
return (int)this.ReadRawVarint32();
}
// Token: 0x0600003C RID: 60 RVA: 0x00002774 File Offset: 0x00000974
public int ReadSFixed32()
{
return (int)this.ReadRawLittleEndian32();
}
// Token: 0x0600003D RID: 61 RVA: 0x0000276C File Offset: 0x0000096C
public long ReadSFixed64()
{
return (long)this.ReadRawLittleEndian64();
}
// Token: 0x0600003E RID: 62 RVA: 0x000028B5 File Offset: 0x00000AB5
public int ReadSInt32()
{
return CodedInputStream.DecodeZigZag32(this.ReadRawVarint32());
}
// Token: 0x0600003F RID: 63 RVA: 0x000028C2 File Offset: 0x00000AC2
public long ReadSInt64()
{
return CodedInputStream.DecodeZigZag64(this.ReadRawVarint64());
}
// Token: 0x06000040 RID: 64 RVA: 0x00002764 File Offset: 0x00000964
public int ReadLength()
{
return (int)this.ReadRawVarint32();
}
// Token: 0x06000041 RID: 65 RVA: 0x000028CF File Offset: 0x00000ACF
public bool MaybeConsumeTag(uint tag)
{
if (this.PeekTag() == tag)
{
this.hasNextTag = false;
return true;
}
return false;
}
// Token: 0x06000042 RID: 66 RVA: 0x000028E4 File Offset: 0x00000AE4
private uint SlowReadRawVarint32()
{
int num = (int)this.ReadRawByte();
if (num < 128)
{
return (uint)num;
}
int num2 = num & 127;
if ((num = (int)this.ReadRawByte()) < 128)
{
num2 |= num << 7;
}
else
{
num2 |= (num & 127) << 7;
if ((num = (int)this.ReadRawByte()) < 128)
{
num2 |= num << 14;
}
else
{
num2 |= (num & 127) << 14;
if ((num = (int)this.ReadRawByte()) < 128)
{
num2 |= num << 21;
}
else
{
num2 |= (num & 127) << 21;
num2 |= (num = (int)this.ReadRawByte()) << 28;
if (num >= 128)
{
for (int i = 0; i < 5; i++)
{
if (this.ReadRawByte() < 128)
{
return (uint)num2;
}
}
throw InvalidProtocolBufferException.MalformedVarint();
}
}
}
}
return (uint)num2;
}
// Token: 0x06000043 RID: 67 RVA: 0x000029A8 File Offset: 0x00000BA8
internal uint ReadRawVarint32()
{
if (this.bufferPos + 5 > this.bufferSize)
{
return this.SlowReadRawVarint32();
}
byte[] array = this.buffer;
int num = this.bufferPos;
this.bufferPos = num + 1;
int num2 = array[num];
if (num2 < 128)
{
return (uint)num2;
}
int num3 = num2 & 127;
byte[] array2 = this.buffer;
num = this.bufferPos;
this.bufferPos = num + 1;
if ((num2 = array2[num]) < 128)
{
num3 |= num2 << 7;
}
else
{
num3 |= (num2 & 127) << 7;
byte[] array3 = this.buffer;
num = this.bufferPos;
this.bufferPos = num + 1;
if ((num2 = array3[num]) < 128)
{
num3 |= num2 << 14;
}
else
{
num3 |= (num2 & 127) << 14;
byte[] array4 = this.buffer;
num = this.bufferPos;
this.bufferPos = num + 1;
if ((num2 = array4[num]) < 128)
{
num3 |= num2 << 21;
}
else
{
num3 |= (num2 & 127) << 21;
int num4 = num3;
byte[] array5 = this.buffer;
num = this.bufferPos;
this.bufferPos = num + 1;
num3 = num4 | ((num2 = array5[num]) << 28);
if (num2 >= 128)
{
for (int i = 0; i < 5; i++)
{
if (this.ReadRawByte() < 128)
{
return (uint)num3;
}
}
throw InvalidProtocolBufferException.MalformedVarint();
}
}
}
}
return (uint)num3;
}
// Token: 0x06000044 RID: 68 RVA: 0x00002AE0 File Offset: 0x00000CE0
internal static uint ReadRawVarint32(Stream input)
{
int num = 0;
int i;
for (i = 0; i < 32; i += 7)
{
int num2 = input.ReadByte();
if (num2 == -1)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
num |= (num2 & 127) << i;
if ((num2 & 128) == 0)
{
return (uint)num;
}
}
while (i < 64)
{
int num3 = input.ReadByte();
if (num3 == -1)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
if ((num3 & 128) == 0)
{
return (uint)num;
}
i += 7;
}
throw InvalidProtocolBufferException.MalformedVarint();
}
// Token: 0x06000045 RID: 69 RVA: 0x00002B50 File Offset: 0x00000D50
internal ulong ReadRawVarint64()
{
int i = 0;
ulong num = 0UL;
while (i < 64)
{
byte b = this.ReadRawByte();
num |= (ulong)((ulong)((long)(b & 127)) << i);
if ((b & 128) == 0)
{
return num;
}
i += 7;
}
throw InvalidProtocolBufferException.MalformedVarint();
}
// Token: 0x06000046 RID: 70 RVA: 0x00002B94 File Offset: 0x00000D94
internal uint ReadRawLittleEndian32()
{
uint num = (uint)this.ReadRawByte();
uint num2 = (uint)this.ReadRawByte();
uint num3 = (uint)this.ReadRawByte();
uint num4 = (uint)this.ReadRawByte();
return num | (num2 << 8) | (num3 << 16) | (num4 << 24);
}
// Token: 0x06000047 RID: 71 RVA: 0x00002BCC File Offset: 0x00000DCC
internal ulong ReadRawLittleEndian64()
{
ulong num = (ulong)this.ReadRawByte();
ulong num2 = (ulong)this.ReadRawByte();
ulong num3 = (ulong)this.ReadRawByte();
ulong num4 = (ulong)this.ReadRawByte();
ulong num5 = (ulong)this.ReadRawByte();
ulong num6 = (ulong)this.ReadRawByte();
ulong num7 = (ulong)this.ReadRawByte();
ulong num8 = (ulong)this.ReadRawByte();
return num | (num2 << 8) | (num3 << 16) | (num4 << 24) | (num5 << 32) | (num6 << 40) | (num7 << 48) | (num8 << 56);
}
// Token: 0x06000048 RID: 72 RVA: 0x00002C40 File Offset: 0x00000E40
internal static int DecodeZigZag32(uint n)
{
return (int)((n >> 1) ^ -(int)(n & 1U));
}
// Token: 0x06000049 RID: 73 RVA: 0x00002C4A File Offset: 0x00000E4A
internal static long DecodeZigZag64(ulong n)
{
return (long)((n >> 1) ^ -(long)(n & 1UL));
}
// Token: 0x0600004A RID: 74 RVA: 0x00002C58 File Offset: 0x00000E58
internal int PushLimit(int byteLimit)
{
if (byteLimit < 0)
{
throw InvalidProtocolBufferException.NegativeSize();
}
byteLimit += this.totalBytesRetired + this.bufferPos;
int num = this.currentLimit;
if (byteLimit > num)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
this.currentLimit = byteLimit;
this.RecomputeBufferSizeAfterLimit();
return num;
}
// Token: 0x0600004B RID: 75 RVA: 0x00002CA0 File Offset: 0x00000EA0
private void RecomputeBufferSizeAfterLimit()
{
this.bufferSize += this.bufferSizeAfterLimit;
int num = this.totalBytesRetired + this.bufferSize;
if (num > this.currentLimit)
{
this.bufferSizeAfterLimit = num - this.currentLimit;
this.bufferSize -= this.bufferSizeAfterLimit;
return;
}
this.bufferSizeAfterLimit = 0;
}
// Token: 0x0600004C RID: 76 RVA: 0x00002D00 File Offset: 0x00000F00
internal void PopLimit(int oldLimit)
{
this.currentLimit = oldLimit;
this.RecomputeBufferSizeAfterLimit();
}
// Token: 0x17000009 RID: 9
// (get) Token: 0x0600004D RID: 77 RVA: 0x00002D0F File Offset: 0x00000F0F
internal bool ReachedLimit
{
get
{
return this.currentLimit != int.MaxValue && this.totalBytesRetired + this.bufferPos >= this.currentLimit;
}
}
// Token: 0x1700000A RID: 10
// (get) Token: 0x0600004E RID: 78 RVA: 0x00002D38 File Offset: 0x00000F38
public bool IsAtEnd
{
get
{
return this.bufferPos == this.bufferSize && !this.RefillBuffer(false);
}
}
// Token: 0x0600004F RID: 79 RVA: 0x00002D54 File Offset: 0x00000F54
private bool RefillBuffer(bool mustSucceed)
{
if (this.bufferPos < this.bufferSize)
{
throw new InvalidOperationException("RefillBuffer() called when buffer wasn't empty.");
}
if (this.totalBytesRetired + this.bufferSize == this.currentLimit)
{
if (mustSucceed)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
return false;
}
else
{
this.totalBytesRetired += this.bufferSize;
this.bufferPos = 0;
this.bufferSize = ((this.input == null) ? 0 : this.input.Read(this.buffer, 0, this.buffer.Length));
if (this.bufferSize < 0)
{
throw new InvalidOperationException("Stream.Read returned a negative count");
}
if (this.bufferSize == 0)
{
if (mustSucceed)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
return false;
}
else
{
this.RecomputeBufferSizeAfterLimit();
int num = this.totalBytesRetired + this.bufferSize + this.bufferSizeAfterLimit;
if (num > this.sizeLimit || num < 0)
{
throw InvalidProtocolBufferException.SizeLimitExceeded();
}
return true;
}
}
}
// Token: 0x06000050 RID: 80 RVA: 0x00002E38 File Offset: 0x00001038
internal byte ReadRawByte()
{
if (this.bufferPos == this.bufferSize)
{
this.RefillBuffer(true);
}
byte[] array = this.buffer;
int num = this.bufferPos;
this.bufferPos = num + 1;
return array[num];
}
// Token: 0x06000051 RID: 81 RVA: 0x00002E74 File Offset: 0x00001074
internal byte[] ReadRawBytes(int size)
{
if (size < 0)
{
throw InvalidProtocolBufferException.NegativeSize();
}
if (this.totalBytesRetired + this.bufferPos + size > this.currentLimit)
{
this.SkipRawBytes(this.currentLimit - this.totalBytesRetired - this.bufferPos);
throw InvalidProtocolBufferException.TruncatedMessage();
}
if (size <= this.bufferSize - this.bufferPos)
{
byte[] array = new byte[size];
ByteArray.Copy(this.buffer, this.bufferPos, array, 0, size);
this.bufferPos += size;
return array;
}
if (size < this.buffer.Length)
{
byte[] array2 = new byte[size];
int num = this.bufferSize - this.bufferPos;
ByteArray.Copy(this.buffer, this.bufferPos, array2, 0, num);
this.bufferPos = this.bufferSize;
this.RefillBuffer(true);
while (size - num > this.bufferSize)
{
Buffer.BlockCopy(this.buffer, 0, array2, num, this.bufferSize);
num += this.bufferSize;
this.bufferPos = this.bufferSize;
this.RefillBuffer(true);
}
ByteArray.Copy(this.buffer, 0, array2, num, size - num);
this.bufferPos = size - num;
return array2;
}
int num2 = this.bufferPos;
int num3 = this.bufferSize;
this.totalBytesRetired += this.bufferSize;
this.bufferPos = 0;
this.bufferSize = 0;
int i = size - (num3 - num2);
List<byte[]> list = new List<byte[]>();
while (i > 0)
{
byte[] array3 = new byte[Math.Min(i, this.buffer.Length)];
int num4;
for (int j = 0; j < array3.Length; j += num4)
{
num4 = ((this.input == null) ? (-1) : this.input.Read(array3, j, array3.Length - j));
if (num4 <= 0)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
this.totalBytesRetired += num4;
}
i -= array3.Length;
list.Add(array3);
}
byte[] array4 = new byte[size];
int num5 = num3 - num2;
ByteArray.Copy(this.buffer, num2, array4, 0, num5);
foreach (byte[] array5 in list)
{
Buffer.BlockCopy(array5, 0, array4, num5, array5.Length);
num5 += array5.Length;
}
return array4;
}
// Token: 0x06000052 RID: 82 RVA: 0x000030D8 File Offset: 0x000012D8
private void SkipRawBytes(int size)
{
if (size < 0)
{
throw InvalidProtocolBufferException.NegativeSize();
}
if (this.totalBytesRetired + this.bufferPos + size > this.currentLimit)
{
this.SkipRawBytes(this.currentLimit - this.totalBytesRetired - this.bufferPos);
throw InvalidProtocolBufferException.TruncatedMessage();
}
if (size <= this.bufferSize - this.bufferPos)
{
this.bufferPos += size;
return;
}
int num = this.bufferSize - this.bufferPos;
this.totalBytesRetired += this.bufferSize;
this.bufferPos = 0;
this.bufferSize = 0;
if (num < size)
{
if (this.input == null)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
this.SkipImpl(size - num);
this.totalBytesRetired += size - num;
}
}
// Token: 0x06000053 RID: 83 RVA: 0x000031A0 File Offset: 0x000013A0
private void SkipImpl(int amountToSkip)
{
if (this.input.CanSeek)
{
long position = this.input.Position;
this.input.Position += (long)amountToSkip;
if (this.input.Position != position + (long)amountToSkip)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
}
else
{
byte[] array = new byte[Math.Min(1024, amountToSkip)];
while (amountToSkip > 0)
{
int num = this.input.Read(array, 0, Math.Min(array.Length, amountToSkip));
if (num <= 0)
{
throw InvalidProtocolBufferException.TruncatedMessage();
}
amountToSkip -= num;
}
}
}
// Token: 0x04000004 RID: 4
private readonly bool leaveOpen;
// Token: 0x04000005 RID: 5
private readonly byte[] buffer;
// Token: 0x04000006 RID: 6
private int bufferSize;
// Token: 0x04000007 RID: 7
private int bufferSizeAfterLimit;
// Token: 0x04000008 RID: 8
private int bufferPos;
// Token: 0x04000009 RID: 9
private readonly Stream input;
// Token: 0x0400000A RID: 10
private uint lastTag;
// Token: 0x0400000B RID: 11
private uint nextTag;
// Token: 0x0400000C RID: 12
private bool hasNextTag;
// Token: 0x0400000D RID: 13
internal const int DefaultRecursionLimit = 64;
// Token: 0x0400000E RID: 14
internal const int DefaultSizeLimit = 67108864;
// Token: 0x0400000F RID: 15
internal const int BufferSize = 4096;
// Token: 0x04000010 RID: 16
private int totalBytesRetired;
// Token: 0x04000011 RID: 17
private int currentLimit = int.MaxValue;
// Token: 0x04000012 RID: 18
private int recursionDepth;
// Token: 0x04000013 RID: 19
private readonly int recursionLimit;
// Token: 0x04000014 RID: 20
private readonly int sizeLimit;
}
}