static private CreateException ( |
||
writer | ||
리턴 |
// Token: 0x0600015A RID: 346 RVA: 0x0000DA5C File Offset: 0x0000BC5C public static void WriteUInt32(uint value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } WireType wireType = writer.wireType; if (wireType == WireType.Variant) { ProtoWriter.WriteUInt32Variant(value, writer); writer.wireType = WireType.None; return; } if (wireType == WireType.Fixed64) { ProtoWriter.WriteInt64((long)value, writer); return; } if (wireType == WireType.Fixed32) { ProtoWriter.WriteInt32((int)value, writer); return; } throw ProtoWriter.CreateException(writer); }
public static void WriteDouble(double value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } WireType wireType = writer.wireType; if (wireType == WireType.Fixed64) { ProtoWriter.WriteInt64(BitConverter.ToInt64(BitConverter.GetBytes(value), 0), writer); return; } if (wireType != WireType.Fixed32) { throw ProtoWriter.CreateException(writer); } float value2 = (float)value; if (Helpers.IsInfinity(value2) && !Helpers.IsInfinity(value)) { throw new OverflowException(); } ProtoWriter.WriteSingle(value2, writer); }
public static void AppendExtensionData(IExtensible instance, ProtoWriter writer) { if (instance == null) { throw new ArgumentNullException("instance"); } if (writer == null) { throw new ArgumentNullException("writer"); } if (writer.wireType != ProtoBuf.WireType.None) { throw ProtoWriter.CreateException(writer); } IExtension extensionObject = instance.GetExtensionObject(false); if (extensionObject != null) { Stream stream = extensionObject.BeginQuery(); try { ProtoWriter.CopyRawFromStream(stream, writer); } finally { extensionObject.EndQuery(stream); } } }
public static void WriteString(string value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } if (writer.wireType != ProtoBuf.WireType.String) { throw ProtoWriter.CreateException(writer); } if (value == null) { throw new ArgumentNullException("value"); } if (value.Length == 0) { ProtoWriter.WriteUInt32Variant(0, writer); writer.wireType = ProtoBuf.WireType.None; return; } int byteCount = ProtoWriter.encoding.GetByteCount(value); ProtoWriter.WriteUInt32Variant((uint)byteCount, writer); ProtoWriter.DemandSpace(byteCount, writer); int bytes = ProtoWriter.encoding.GetBytes(value, 0, value.Length, writer.ioBuffer, writer.ioIndex); ProtoWriter.IncrementedAndReset(bytes, writer); }
internal static void WriteObject(object value, int key, ProtoWriter writer, PrefixStyle style, int fieldNumber) { #if FEAT_IKVM throw new NotSupportedException(); #else if (writer.model == null) { throw new InvalidOperationException("Cannot serialize sub-objects unless a model is provided"); } if (writer.wireType != WireType.None) { throw ProtoWriter.CreateException(writer); } switch (style) { case PrefixStyle.Base128: writer.wireType = WireType.String; writer.fieldNumber = fieldNumber; if (fieldNumber > 0) { WriteHeaderCore(fieldNumber, WireType.String, writer); } break; case PrefixStyle.Fixed32: case PrefixStyle.Fixed32BigEndian: writer.fieldNumber = 0; writer.wireType = WireType.Fixed32; break; default: throw new ArgumentOutOfRangeException("style"); } SubItemToken token = StartSubItem(value, writer, true); if (key < 0) { if ( !writer.model.TrySerializeAuxiliaryType(writer, value.GetType(), DataFormat.Default, Serializer.ListItemTag, value, false)) { TypeModel.ThrowUnexpectedType(value.GetType()); } } else { writer.model.Serialize(key, value, writer); } EndSubItem(token, writer, style); #endif }
internal static void WriteObject(object value, int key, ProtoWriter writer, PrefixStyle style, int fieldNumber) { if (writer.model == null) { throw new InvalidOperationException("Cannot serialize sub-objects unless a model is provided"); } if (writer.wireType != ProtoBuf.WireType.None) { throw ProtoWriter.CreateException(writer); } switch (style) { case PrefixStyle.Base128: { writer.wireType = ProtoBuf.WireType.String; writer.fieldNumber = fieldNumber; if (fieldNumber <= 0) { break; } ProtoWriter.WriteHeaderCore(fieldNumber, ProtoBuf.WireType.String, writer); break; } case PrefixStyle.Fixed32: case PrefixStyle.Fixed32BigEndian: { writer.fieldNumber = 0; writer.wireType = ProtoBuf.WireType.Fixed32; break; } default: { throw new ArgumentOutOfRangeException("style"); } } SubItemToken subItemToken = ProtoWriter.StartSubItem(value, writer, true); if (key >= 0) { writer.model.Serialize(key, value, writer); } else if (!writer.model.TrySerializeAuxiliaryType(writer, value.GetType(), DataFormat.Default, 1, value, false)) { TypeModel.ThrowUnexpectedType(value.GetType()); } ProtoWriter.EndSubItem(subItemToken, writer, style); }
public static void WriteBytes(byte[] data, int offset, int length, ProtoWriter writer) { if (data == null) { throw new ArgumentNullException("data"); } if (writer == null) { throw new ArgumentNullException("writer"); } switch (writer.wireType) { case WireType.Fixed64: if (length != 8) { throw new ArgumentException("length"); } goto IL_D5; case WireType.String: ProtoWriter.WriteUInt32Variant((uint)length, writer); writer.wireType = WireType.None; if (length == 0) { return; } if (writer.flushLock != 0 || length <= writer.ioBuffer.Length) { goto IL_D5; } ProtoWriter.Flush(writer); writer.dest.Write(data, offset, length); writer.position += length; return; case WireType.Fixed32: if (length != 4) { throw new ArgumentException("length"); } goto IL_D5; } throw ProtoWriter.CreateException(writer); IL_D5: ProtoWriter.DemandSpace(length, writer); Helpers.BlockCopy(data, offset, writer.ioBuffer, writer.ioIndex, length); ProtoWriter.IncrementedAndReset(length, writer); }
// Token: 0x06000146 RID: 326 RVA: 0x0000D348 File Offset: 0x0000B548 private static SubItemToken StartSubItem(object instance, ProtoWriter writer, bool allowFixed) { if (writer == null) { throw new ArgumentNullException("writer"); } int num = writer.depth + 1; writer.depth = num; if (num > 25) { writer.CheckRecursionStackAndPush(instance); } if (writer.packedFieldNumber != 0) { throw new InvalidOperationException("Cannot begin a sub-item while performing packed encoding"); } switch (writer.wireType) { case WireType.String: writer.wireType = WireType.None; ProtoWriter.DemandSpace(32, writer); writer.flushLock++; writer.position++; num = writer.ioIndex; writer.ioIndex = num + 1; return(new SubItemToken(num)); case WireType.StartGroup: writer.wireType = WireType.None; return(new SubItemToken(-writer.fieldNumber)); case WireType.Fixed32: { if (!allowFixed) { throw ProtoWriter.CreateException(writer); } ProtoWriter.DemandSpace(32, writer); writer.flushLock++; SubItemToken result = new SubItemToken(writer.ioIndex); ProtoWriter.IncrementedAndReset(4, writer); return(result); } } throw ProtoWriter.CreateException(writer); }
// Token: 0x060034C3 RID: 13507 RVA: 0x001320A0 File Offset: 0x001304A0 public static void WriteBytes(byte[] data, int offset, int length, ProtoWriter writer) { if (data == null) { throw new ArgumentNullException("data"); } if (writer == null) { throw new ArgumentNullException("writer"); } WireType wireType = writer.wireType; if (wireType != WireType.Fixed32) { if (wireType != WireType.Fixed64) { if (wireType != WireType.String) { throw ProtoWriter.CreateException(writer); } ProtoWriter.WriteUInt32Variant((uint)length, writer); writer.wireType = WireType.None; if (length == 0) { return; } if (writer.flushLock == 0 && length > writer.ioBuffer.Length) { ProtoWriter.Flush(writer); writer.dest.Write(data, offset, length); writer.position += length; return; } } else if (length != 8) { throw new ArgumentException("length"); } } else if (length != 4) { throw new ArgumentException("length"); } ProtoWriter.DemandSpace(length, writer); Helpers.BlockCopy(data, offset, writer.ioBuffer, writer.ioIndex, length); ProtoWriter.IncrementedAndReset(length, writer); }
public static void WriteSingle(float value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } ProtoBuf.WireType wireType = writer.wireType; if (wireType == ProtoBuf.WireType.Fixed64) { ProtoWriter.WriteDouble((double)value, writer); return; } if (wireType != ProtoBuf.WireType.Fixed32) { throw ProtoWriter.CreateException(writer); } ProtoWriter.WriteInt32(BitConverter.ToInt32(BitConverter.GetBytes(value), 0), writer); }
// Token: 0x060034E4 RID: 13540 RVA: 0x00132E38 File Offset: 0x00131238 public static void WriteSingle(float value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } WireType wireType = writer.wireType; if (wireType == WireType.Fixed32) { ProtoWriter.WriteInt32((int)value, writer); return; } if (wireType != WireType.Fixed64) { throw ProtoWriter.CreateException(writer); } ProtoWriter.WriteDouble((double)value, writer); }
public static void WriteUInt64(ulong value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } switch (writer.wireType) { case WireType.Variant: ProtoWriter.WriteUInt64Variant(value, writer); writer.wireType = WireType.None; return; case WireType.Fixed64: ProtoWriter.WriteInt64((long)value, writer); return; case WireType.Fixed32: ProtoWriter.WriteUInt32(checked ((uint)value), writer); return; } throw ProtoWriter.CreateException(writer); }
public static void WriteUInt32(uint value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } ProtoBuf.WireType wireType = writer.wireType; switch (wireType) { case ProtoBuf.WireType.Variant: { ProtoWriter.WriteUInt32Variant(value, writer); writer.wireType = ProtoBuf.WireType.None; return; } case ProtoBuf.WireType.Fixed64: { ProtoWriter.WriteInt64((long)value, writer); return; } default: { if (wireType != ProtoBuf.WireType.Fixed32) { break; } else { ProtoWriter.WriteInt32((int)value, writer); return; } } } throw ProtoWriter.CreateException(writer); }
internal static void WriteObject(object value, int key, ProtoWriter writer, PrefixStyle style, int fieldNumber) { if (writer.model == null) { throw new InvalidOperationException("Cannot serialize sub-objects unless a model is provided"); } if (writer.wireType != WireType.None) { throw ProtoWriter.CreateException(writer); } switch (style) { case PrefixStyle.Base128: writer.wireType = WireType.String; writer.fieldNumber = fieldNumber; if (fieldNumber > 0) { WriteHeaderCore(fieldNumber, WireType.String, writer); } break; case PrefixStyle.Fixed32: case PrefixStyle.Fixed32BigEndian: writer.fieldNumber = 0; writer.wireType = WireType.Fixed32; break; default: throw new ArgumentOutOfRangeException("style"); } SubItemToken token = StartSubItem(value, writer, true); writer.model.Serialize(key, value, writer); EndSubItem(token, writer, style); }
public static void WriteInt32(int value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } WireType wireType = writer.wireType; switch (wireType) { case WireType.Variant: if (value >= 0) { ProtoWriter.WriteUInt32Variant((uint)value, writer); writer.wireType = WireType.None; } else { ProtoWriter.DemandSpace(10, writer); byte[] array = writer.ioBuffer; int num = writer.ioIndex; array[num] = (byte)(value | 128); array[num + 1] = (byte)(value >> 7 | 128); array[num + 2] = (byte)(value >> 14 | 128); array[num + 3] = (byte)(value >> 21 | 128); array[num + 4] = (byte)(value >> 28 | 128); array[num + 5] = (array[num + 6] = (array[num + 7] = (array[num + 8] = 255))); array[num + 9] = 1; ProtoWriter.IncrementedAndReset(10, writer); } return; case WireType.Fixed64: { ProtoWriter.DemandSpace(8, writer); byte[] array = writer.ioBuffer; int num = writer.ioIndex; array[num] = (byte)value; array[num + 1] = (byte)(value >> 8); array[num + 2] = (byte)(value >> 16); array[num + 3] = (byte)(value >> 24); array[num + 4] = (array[num + 5] = (array[num + 6] = (array[num + 7] = 0))); ProtoWriter.IncrementedAndReset(8, writer); return; } case WireType.String: case WireType.StartGroup: case WireType.EndGroup: IL_36: if (wireType != WireType.SignedVariant) { throw ProtoWriter.CreateException(writer); } ProtoWriter.WriteUInt32Variant(ProtoWriter.Zig(value), writer); writer.wireType = WireType.None; return; case WireType.Fixed32: ProtoWriter.DemandSpace(4, writer); ProtoWriter.WriteInt32ToBuffer(value, writer.ioBuffer, writer.ioIndex); ProtoWriter.IncrementedAndReset(4, writer); return; } goto IL_36; }
private static void EndSubItem(SubItemToken token, ProtoWriter writer, PrefixStyle style) { if (writer == null) { throw new ArgumentNullException("writer"); } if (writer.wireType != WireType.None) { throw ProtoWriter.CreateException(writer); } int value = token.value; if (writer.depth <= 0) { throw ProtoWriter.CreateException(writer); } if (writer.depth-- > 25) { writer.PopRecursionStack(); } writer.packedFieldNumber = 0; if (value < 0) { ProtoWriter.WriteHeaderCore(-value, WireType.EndGroup, writer); writer.wireType = WireType.None; return; } switch (style) { case PrefixStyle.Base128: { int num = writer.ioIndex - value - 1; int num2 = 0; uint num3 = (uint)num; while ((num3 >>= 7) != 0u) { num2++; } if (num2 == 0) { writer.ioBuffer[value] = (byte)(num & 127); } else { ProtoWriter.DemandSpace(num2, writer); byte[] array = writer.ioBuffer; Helpers.BlockCopy(array, value + 1, array, value + 1 + num2, num); num3 = (uint)num; do { array[value++] = (byte)((num3 & 127u) | 128u); }while ((num3 >>= 7) != 0u); array[value - 1] = (byte)((int)array[value - 1] & -129); writer.position += num2; writer.ioIndex += num2; } break; } case PrefixStyle.Fixed32: { int num = writer.ioIndex - value - 4; ProtoWriter.WriteInt32ToBuffer(num, writer.ioBuffer, value); break; } case PrefixStyle.Fixed32BigEndian: { int num = writer.ioIndex - value - 4; byte[] array2 = writer.ioBuffer; ProtoWriter.WriteInt32ToBuffer(num, array2, value); byte b = array2[value]; array2[value] = array2[value + 3]; array2[value + 3] = b; b = array2[value + 1]; array2[value + 1] = array2[value + 2]; array2[value + 2] = b; break; } default: throw new ArgumentOutOfRangeException("style"); } if (--writer.flushLock == 0 && writer.ioIndex >= 1024) { ProtoWriter.Flush(writer); } }
public static void WriteInt32(int value, ProtoWriter writer) { byte[] numArray; int num; if (writer == null) { throw new ArgumentNullException("writer"); } ProtoBuf.WireType wireType = writer.wireType; switch (wireType) { case ProtoBuf.WireType.Variant: { if (value >= 0) { ProtoWriter.WriteUInt32Variant((uint)value, writer); writer.wireType = ProtoBuf.WireType.None; return; } ProtoWriter.DemandSpace(10, writer); numArray = writer.ioBuffer; num = writer.ioIndex; numArray[num] = (byte)(value | 128); numArray[num + 1] = (byte)(value >> 7 | 128); numArray[num + 2] = (byte)(value >> 14 | 128); numArray[num + 3] = (byte)(value >> 21 | 128); numArray[num + 4] = (byte)(value >> 28 | 128); int num1 = 255; byte num2 = (byte)num1; numArray[num + 8] = (byte)num1; byte num3 = num2; byte num4 = num3; numArray[num + 7] = num3; byte num5 = num4; byte num6 = num5; numArray[num + 6] = num5; numArray[num + 5] = num6; numArray[num + 9] = 1; ProtoWriter.IncrementedAndReset(10, writer); return; } case ProtoBuf.WireType.Fixed64: { ProtoWriter.DemandSpace(8, writer); numArray = writer.ioBuffer; num = writer.ioIndex; numArray[num] = (byte)value; numArray[num + 1] = (byte)(value >> 8); numArray[num + 2] = (byte)(value >> 16); numArray[num + 3] = (byte)(value >> 24); int num7 = 0; byte num8 = (byte)num7; numArray[num + 7] = (byte)num7; byte num9 = num8; byte num10 = num9; numArray[num + 6] = num9; byte num11 = num10; byte num12 = num11; numArray[num + 5] = num11; numArray[num + 4] = num12; ProtoWriter.IncrementedAndReset(8, writer); return; } default: { if (wireType == ProtoBuf.WireType.Fixed32) { break; } else { if (wireType != ProtoBuf.WireType.SignedVariant) { throw ProtoWriter.CreateException(writer); } ProtoWriter.WriteUInt32Variant(ProtoWriter.Zig(value), writer); writer.wireType = ProtoBuf.WireType.None; return; } } } ProtoWriter.DemandSpace(4, writer); ProtoWriter.WriteInt32ToBuffer(value, writer.ioBuffer, writer.ioIndex); ProtoWriter.IncrementedAndReset(4, writer); }
public static void WriteInt64(long value, ProtoWriter writer) { byte[] numArray; int num; if (writer == null) { throw new ArgumentNullException("writer"); } ProtoBuf.WireType wireType = writer.wireType; switch (wireType) { case ProtoBuf.WireType.Variant: { if (value >= (long)0) { ProtoWriter.WriteUInt64Variant((ulong)value, writer); writer.wireType = ProtoBuf.WireType.None; return; } ProtoWriter.DemandSpace(10, writer); numArray = writer.ioBuffer; num = writer.ioIndex; numArray[num] = (byte)(value | (long)128); numArray[num + 1] = (byte)((int)(value >> 7) | 128); numArray[num + 2] = (byte)((int)(value >> 14) | 128); numArray[num + 3] = (byte)((int)(value >> 21) | 128); numArray[num + 4] = (byte)((int)(value >> 28) | 128); numArray[num + 5] = (byte)((int)(value >> 35) | 128); numArray[num + 6] = (byte)((int)(value >> 42) | 128); numArray[num + 7] = (byte)((int)(value >> 49) | 128); numArray[num + 8] = (byte)((int)(value >> 56) | 128); numArray[num + 9] = 1; ProtoWriter.IncrementedAndReset(10, writer); return; } case ProtoBuf.WireType.Fixed64: { ProtoWriter.DemandSpace(8, writer); numArray = writer.ioBuffer; num = writer.ioIndex; numArray[num] = (byte)value; numArray[num + 1] = (byte)(value >> 8); numArray[num + 2] = (byte)(value >> 16); numArray[num + 3] = (byte)(value >> 24); numArray[num + 4] = (byte)(value >> 32); numArray[num + 5] = (byte)(value >> 40); numArray[num + 6] = (byte)(value >> 48); numArray[num + 7] = (byte)(value >> 56); ProtoWriter.IncrementedAndReset(8, writer); return; } default: { if (wireType == ProtoBuf.WireType.Fixed32) { break; } else { if (wireType != ProtoBuf.WireType.SignedVariant) { throw ProtoWriter.CreateException(writer); } ProtoWriter.WriteUInt64Variant(ProtoWriter.Zig(value), writer); writer.wireType = ProtoBuf.WireType.None; return; } } } ProtoWriter.WriteInt32(checked ((int)value), writer); }
public static void WriteBytes(byte[] data, int offset, int length, ProtoWriter writer) { if (data == null) { throw new ArgumentNullException("data"); } if (writer == null) { throw new ArgumentNullException("writer"); } switch (writer.wireType) { case ProtoBuf.WireType.Fixed64: { if (length == 8) { break; } throw new ArgumentException("length"); } case ProtoBuf.WireType.String: { ProtoWriter.WriteUInt32Variant((uint)length, writer); writer.wireType = ProtoBuf.WireType.None; if (length == 0) { return; } if (writer.flushLock != 0 || length <= (int)writer.ioBuffer.Length) { break; } ProtoWriter.Flush(writer); writer.dest.Write(data, offset, length); writer.position += length; return; } case ProtoBuf.WireType.StartGroup: case ProtoBuf.WireType.EndGroup: { throw ProtoWriter.CreateException(writer); } case ProtoBuf.WireType.Fixed32: { if (length == 4) { break; } throw new ArgumentException("length"); } default: { throw ProtoWriter.CreateException(writer); } } ProtoWriter.DemandSpace(length, writer); Helpers.BlockCopy(data, offset, writer.ioBuffer, writer.ioIndex, length); ProtoWriter.IncrementedAndReset(length, writer); }
private static SubItemToken StartSubItem(object instance, ProtoWriter writer, bool allowFixed) { if (writer == null) { throw new ArgumentNullException("writer"); } ProtoWriter protoWriter = writer; int num = protoWriter.depth + 1; int num1 = num; protoWriter.depth = num; if (num1 > 25) { writer.CheckRecursionStackAndPush(instance); } if (writer.packedFieldNumber != 0) { throw new InvalidOperationException("Cannot begin a sub-item while performing packed encoding"); } switch (writer.wireType) { case ProtoBuf.WireType.String: { writer.wireType = ProtoBuf.WireType.None; ProtoWriter.DemandSpace(32, writer); writer.flushLock++; writer.position++; ProtoWriter protoWriter1 = writer; int num2 = protoWriter1.ioIndex; int num3 = num2; protoWriter1.ioIndex = num2 + 1; return(new SubItemToken(num3)); } case ProtoBuf.WireType.StartGroup: { writer.wireType = ProtoBuf.WireType.None; return(new SubItemToken(-writer.fieldNumber)); } case ProtoBuf.WireType.EndGroup: { throw ProtoWriter.CreateException(writer); } case ProtoBuf.WireType.Fixed32: { if (!allowFixed) { throw ProtoWriter.CreateException(writer); } ProtoWriter.DemandSpace(32, writer); writer.flushLock++; SubItemToken subItemToken = new SubItemToken(writer.ioIndex); ProtoWriter.IncrementedAndReset(4, writer); return(subItemToken); } default: { throw ProtoWriter.CreateException(writer); } } }
private static void EndSubItem(SubItemToken token, ProtoWriter writer, PrefixStyle style) { int num; UInt32 num1; if (writer == null) { throw new ArgumentNullException("writer"); } if (writer.wireType != ProtoBuf.WireType.None) { throw ProtoWriter.CreateException(writer); } int num2 = token.@value; if (writer.depth <= 0) { throw ProtoWriter.CreateException(writer); } ProtoWriter protoWriter = writer; int num3 = protoWriter.depth; int num4 = num3; protoWriter.depth = num3 - 1; if (num4 > 25) { writer.PopRecursionStack(); } writer.packedFieldNumber = 0; if (num2 < 0) { ProtoWriter.WriteHeaderCore(-num2, ProtoBuf.WireType.EndGroup, writer); writer.wireType = ProtoBuf.WireType.None; return; } switch (style) { case PrefixStyle.Base128: { num = writer.ioIndex - num2 - 1; int num5 = 0; uint num6 = (uint)num; while (true) { UInt32 num7 = num6 >> 7; num6 = num7; if (num7 == 0) { break; } num5++; } if (num5 != 0) { ProtoWriter.DemandSpace(num5, writer); byte[] numArray = writer.ioBuffer; Helpers.BlockCopy(numArray, num2 + 1, numArray, num2 + 1 + num5, num); num6 = (uint)num; do { int num8 = num2; num2 = num8 + 1; numArray[num8] = (byte)(num6 & 127 | 128); num1 = num6 >> 7; num6 = num1; }while (num1 != 0); numArray[num2 - 1] = (byte)(numArray[num2 - 1] & -129); writer.position += num5; writer.ioIndex += num5; break; } else { writer.ioBuffer[num2] = (byte)(num & 127); break; } } case PrefixStyle.Fixed32: { num = writer.ioIndex - num2 - 4; ProtoWriter.WriteInt32ToBuffer(num, writer.ioBuffer, num2); break; } case PrefixStyle.Fixed32BigEndian: { num = writer.ioIndex - num2 - 4; byte[] numArray1 = writer.ioBuffer; ProtoWriter.WriteInt32ToBuffer(num, numArray1, num2); byte num9 = numArray1[num2]; numArray1[num2] = numArray1[num2 + 3]; numArray1[num2 + 3] = num9; num9 = numArray1[num2 + 1]; numArray1[num2 + 1] = numArray1[num2 + 2]; numArray1[num2 + 2] = num9; break; } default: { throw new ArgumentOutOfRangeException("style"); } } ProtoWriter protoWriter1 = writer; int num10 = protoWriter1.flushLock - 1; int num11 = num10; protoWriter1.flushLock = num10; if (num11 == 0 && writer.ioIndex >= 1024) { ProtoWriter.Flush(writer); } }
// Token: 0x06000160 RID: 352 RVA: 0x0000DAB0 File Offset: 0x0000BCB0 public static void WriteInt32(int value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } WireType wireType = writer.wireType; if (wireType <= WireType.Fixed64) { if (wireType != WireType.Variant) { if (wireType == WireType.Fixed64) { ProtoWriter.DemandSpace(8, writer); byte[] array = writer.ioBuffer; int num = writer.ioIndex; array[num] = (byte)value; array[num + 1] = (byte)(value >> 8); array[num + 2] = (byte)(value >> 16); array[num + 3] = (byte)(value >> 24); array[num + 4] = (array[num + 5] = (array[num + 6] = (array[num + 7] = 0))); ProtoWriter.IncrementedAndReset(8, writer); return; } } else { if (value >= 0) { ProtoWriter.WriteUInt32Variant((uint)value, writer); writer.wireType = WireType.None; return; } ProtoWriter.DemandSpace(10, writer); byte[] array = writer.ioBuffer; int num = writer.ioIndex; array[num] = (byte)(value | 128); array[num + 1] = (byte)(value >> 7 | 128); array[num + 2] = (byte)(value >> 14 | 128); array[num + 3] = (byte)(value >> 21 | 128); array[num + 4] = (byte)(value >> 28 | 128); array[num + 5] = (array[num + 6] = (array[num + 7] = (array[num + 8] = byte.MaxValue))); array[num + 9] = 1; ProtoWriter.IncrementedAndReset(10, writer); return; } } else { if (wireType == WireType.Fixed32) { ProtoWriter.DemandSpace(4, writer); ProtoWriter.WriteInt32ToBuffer(value, writer.ioBuffer, writer.ioIndex); ProtoWriter.IncrementedAndReset(4, writer); return; } if (wireType == WireType.SignedVariant) { ProtoWriter.WriteUInt32Variant(ProtoWriter.Zig(value), writer); writer.wireType = WireType.None; return; } } throw ProtoWriter.CreateException(writer); }
// Token: 0x06000159 RID: 345 RVA: 0x0000D8C4 File Offset: 0x0000BAC4 public static void WriteInt64(long value, ProtoWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } WireType wireType = writer.wireType; if (wireType <= WireType.Fixed64) { if (wireType != WireType.Variant) { if (wireType == WireType.Fixed64) { ProtoWriter.DemandSpace(8, writer); byte[] array = writer.ioBuffer; int num = writer.ioIndex; array[num] = (byte)value; array[num + 1] = (byte)(value >> 8); array[num + 2] = (byte)(value >> 16); array[num + 3] = (byte)(value >> 24); array[num + 4] = (byte)(value >> 32); array[num + 5] = (byte)(value >> 40); array[num + 6] = (byte)(value >> 48); array[num + 7] = (byte)(value >> 56); ProtoWriter.IncrementedAndReset(8, writer); return; } } else { if (value >= 0L) { ProtoWriter.WriteUInt64Variant((ulong)value, writer); writer.wireType = WireType.None; return; } ProtoWriter.DemandSpace(10, writer); byte[] array2 = writer.ioBuffer; int num = writer.ioIndex; array2[num] = (byte)(value | 128L); array2[num + 1] = (byte)((int)(value >> 7) | 128); array2[num + 2] = (byte)((int)(value >> 14) | 128); array2[num + 3] = (byte)((int)(value >> 21) | 128); array2[num + 4] = (byte)((int)(value >> 28) | 128); array2[num + 5] = (byte)((int)(value >> 35) | 128); array2[num + 6] = (byte)((int)(value >> 42) | 128); array2[num + 7] = (byte)((int)(value >> 49) | 128); array2[num + 8] = (byte)((int)(value >> 56) | 128); array2[num + 9] = 1; ProtoWriter.IncrementedAndReset(10, writer); return; } } else { if (wireType == WireType.Fixed32) { ProtoWriter.WriteInt32(checked ((int)value), writer); return; } if (wireType == WireType.SignedVariant) { ProtoWriter.WriteUInt64Variant(ProtoWriter.Zig(value), writer); writer.wireType = WireType.None; return; } } throw ProtoWriter.CreateException(writer); }