Initial Client/Server Communication

#1
Followed the MagicOnion quickstart guide, borrowing code from the chat sample app to get something working
This commit is contained in:
hyperion51 2020-02-26 17:48:40 +00:00
commit a0c8dbee72
493 changed files with 57790 additions and 3 deletions

View file

@ -0,0 +1,793 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT.
* CHANGE THE .tt FILE INSTEAD. */
using System;
using System.Buffers;
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters
{
public sealed class ForceInt16BlockFormatter : IMessagePackFormatter<Int16>
{
public static readonly ForceInt16BlockFormatter Instance = new ForceInt16BlockFormatter();
private ForceInt16BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int16 value, MessagePackSerializerOptions options)
{
writer.WriteInt16(value);
}
public Int16 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadInt16();
}
}
public sealed class NullableForceInt16BlockFormatter : IMessagePackFormatter<Int16?>
{
public static readonly NullableForceInt16BlockFormatter Instance = new NullableForceInt16BlockFormatter();
private NullableForceInt16BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int16? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteInt16(value.Value);
}
}
public Int16? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadInt16();
}
}
}
public sealed class ForceInt16BlockArrayFormatter : IMessagePackFormatter<Int16[]>
{
public static readonly ForceInt16BlockArrayFormatter Instance = new ForceInt16BlockArrayFormatter();
private ForceInt16BlockArrayFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int16[] value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(value.Length);
for (int i = 0; i < value.Length; i++)
{
writer.WriteInt16(value[i]);
}
}
}
public Int16[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var len = reader.ReadArrayHeader();
var array = new Int16[len];
options.Security.DepthStep(ref reader);
try
{
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadInt16();
}
}
finally
{
reader.Depth--;
}
return array;
}
}
}
public sealed class ForceInt32BlockFormatter : IMessagePackFormatter<Int32>
{
public static readonly ForceInt32BlockFormatter Instance = new ForceInt32BlockFormatter();
private ForceInt32BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int32 value, MessagePackSerializerOptions options)
{
writer.WriteInt32(value);
}
public Int32 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadInt32();
}
}
public sealed class NullableForceInt32BlockFormatter : IMessagePackFormatter<Int32?>
{
public static readonly NullableForceInt32BlockFormatter Instance = new NullableForceInt32BlockFormatter();
private NullableForceInt32BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int32? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteInt32(value.Value);
}
}
public Int32? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadInt32();
}
}
}
public sealed class ForceInt32BlockArrayFormatter : IMessagePackFormatter<Int32[]>
{
public static readonly ForceInt32BlockArrayFormatter Instance = new ForceInt32BlockArrayFormatter();
private ForceInt32BlockArrayFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int32[] value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(value.Length);
for (int i = 0; i < value.Length; i++)
{
writer.WriteInt32(value[i]);
}
}
}
public Int32[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var len = reader.ReadArrayHeader();
var array = new Int32[len];
options.Security.DepthStep(ref reader);
try
{
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadInt32();
}
}
finally
{
reader.Depth--;
}
return array;
}
}
}
public sealed class ForceInt64BlockFormatter : IMessagePackFormatter<Int64>
{
public static readonly ForceInt64BlockFormatter Instance = new ForceInt64BlockFormatter();
private ForceInt64BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int64 value, MessagePackSerializerOptions options)
{
writer.WriteInt64(value);
}
public Int64 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadInt64();
}
}
public sealed class NullableForceInt64BlockFormatter : IMessagePackFormatter<Int64?>
{
public static readonly NullableForceInt64BlockFormatter Instance = new NullableForceInt64BlockFormatter();
private NullableForceInt64BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int64? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteInt64(value.Value);
}
}
public Int64? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadInt64();
}
}
}
public sealed class ForceInt64BlockArrayFormatter : IMessagePackFormatter<Int64[]>
{
public static readonly ForceInt64BlockArrayFormatter Instance = new ForceInt64BlockArrayFormatter();
private ForceInt64BlockArrayFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Int64[] value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(value.Length);
for (int i = 0; i < value.Length; i++)
{
writer.WriteInt64(value[i]);
}
}
}
public Int64[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var len = reader.ReadArrayHeader();
var array = new Int64[len];
options.Security.DepthStep(ref reader);
try
{
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadInt64();
}
}
finally
{
reader.Depth--;
}
return array;
}
}
}
public sealed class ForceUInt16BlockFormatter : IMessagePackFormatter<UInt16>
{
public static readonly ForceUInt16BlockFormatter Instance = new ForceUInt16BlockFormatter();
private ForceUInt16BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt16 value, MessagePackSerializerOptions options)
{
writer.WriteUInt16(value);
}
public UInt16 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadUInt16();
}
}
public sealed class NullableForceUInt16BlockFormatter : IMessagePackFormatter<UInt16?>
{
public static readonly NullableForceUInt16BlockFormatter Instance = new NullableForceUInt16BlockFormatter();
private NullableForceUInt16BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt16? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteUInt16(value.Value);
}
}
public UInt16? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadUInt16();
}
}
}
public sealed class ForceUInt16BlockArrayFormatter : IMessagePackFormatter<UInt16[]>
{
public static readonly ForceUInt16BlockArrayFormatter Instance = new ForceUInt16BlockArrayFormatter();
private ForceUInt16BlockArrayFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt16[] value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(value.Length);
for (int i = 0; i < value.Length; i++)
{
writer.WriteUInt16(value[i]);
}
}
}
public UInt16[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var len = reader.ReadArrayHeader();
var array = new UInt16[len];
options.Security.DepthStep(ref reader);
try
{
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadUInt16();
}
}
finally
{
reader.Depth--;
}
return array;
}
}
}
public sealed class ForceUInt32BlockFormatter : IMessagePackFormatter<UInt32>
{
public static readonly ForceUInt32BlockFormatter Instance = new ForceUInt32BlockFormatter();
private ForceUInt32BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt32 value, MessagePackSerializerOptions options)
{
writer.WriteUInt32(value);
}
public UInt32 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadUInt32();
}
}
public sealed class NullableForceUInt32BlockFormatter : IMessagePackFormatter<UInt32?>
{
public static readonly NullableForceUInt32BlockFormatter Instance = new NullableForceUInt32BlockFormatter();
private NullableForceUInt32BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt32? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteUInt32(value.Value);
}
}
public UInt32? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadUInt32();
}
}
}
public sealed class ForceUInt32BlockArrayFormatter : IMessagePackFormatter<UInt32[]>
{
public static readonly ForceUInt32BlockArrayFormatter Instance = new ForceUInt32BlockArrayFormatter();
private ForceUInt32BlockArrayFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt32[] value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(value.Length);
for (int i = 0; i < value.Length; i++)
{
writer.WriteUInt32(value[i]);
}
}
}
public UInt32[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var len = reader.ReadArrayHeader();
var array = new UInt32[len];
options.Security.DepthStep(ref reader);
try
{
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadUInt32();
}
}
finally
{
reader.Depth--;
}
return array;
}
}
}
public sealed class ForceUInt64BlockFormatter : IMessagePackFormatter<UInt64>
{
public static readonly ForceUInt64BlockFormatter Instance = new ForceUInt64BlockFormatter();
private ForceUInt64BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt64 value, MessagePackSerializerOptions options)
{
writer.WriteUInt64(value);
}
public UInt64 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadUInt64();
}
}
public sealed class NullableForceUInt64BlockFormatter : IMessagePackFormatter<UInt64?>
{
public static readonly NullableForceUInt64BlockFormatter Instance = new NullableForceUInt64BlockFormatter();
private NullableForceUInt64BlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt64? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteUInt64(value.Value);
}
}
public UInt64? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadUInt64();
}
}
}
public sealed class ForceUInt64BlockArrayFormatter : IMessagePackFormatter<UInt64[]>
{
public static readonly ForceUInt64BlockArrayFormatter Instance = new ForceUInt64BlockArrayFormatter();
private ForceUInt64BlockArrayFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, UInt64[] value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(value.Length);
for (int i = 0; i < value.Length; i++)
{
writer.WriteUInt64(value[i]);
}
}
}
public UInt64[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var len = reader.ReadArrayHeader();
var array = new UInt64[len];
options.Security.DepthStep(ref reader);
try
{
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadUInt64();
}
}
finally
{
reader.Depth--;
}
return array;
}
}
}
public sealed class ForceByteBlockFormatter : IMessagePackFormatter<Byte>
{
public static readonly ForceByteBlockFormatter Instance = new ForceByteBlockFormatter();
private ForceByteBlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Byte value, MessagePackSerializerOptions options)
{
writer.WriteUInt8(value);
}
public Byte Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadByte();
}
}
public sealed class NullableForceByteBlockFormatter : IMessagePackFormatter<Byte?>
{
public static readonly NullableForceByteBlockFormatter Instance = new NullableForceByteBlockFormatter();
private NullableForceByteBlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, Byte? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteUInt8(value.Value);
}
}
public Byte? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadByte();
}
}
}
public sealed class ForceSByteBlockFormatter : IMessagePackFormatter<SByte>
{
public static readonly ForceSByteBlockFormatter Instance = new ForceSByteBlockFormatter();
private ForceSByteBlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, SByte value, MessagePackSerializerOptions options)
{
writer.WriteInt8(value);
}
public SByte Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
return reader.ReadSByte();
}
}
public sealed class NullableForceSByteBlockFormatter : IMessagePackFormatter<SByte?>
{
public static readonly NullableForceSByteBlockFormatter Instance = new NullableForceSByteBlockFormatter();
private NullableForceSByteBlockFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, SByte? value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteInt8(value.Value);
}
}
public SByte? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
return reader.ReadSByte();
}
}
}
public sealed class ForceSByteBlockArrayFormatter : IMessagePackFormatter<SByte[]>
{
public static readonly ForceSByteBlockArrayFormatter Instance = new ForceSByteBlockArrayFormatter();
private ForceSByteBlockArrayFormatter()
{
}
public void Serialize(ref MessagePackWriter writer, SByte[] value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(value.Length);
for (int i = 0; i < value.Length; i++)
{
writer.WriteInt8(value[i]);
}
}
}
public SByte[] Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var len = reader.ReadArrayHeader();
var array = new SByte[len];
options.Security.DepthStep(ref reader);
try
{
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadSByte();
}
}
finally
{
reader.Depth--;
}
return array;
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7eebcdcfb5f87535cb2728f1c21072c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,440 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT.
* CHANGE THE .tt FILE INSTEAD. */
using System;
using System.Buffers;
namespace MessagePack
{
#pragma warning disable SA1205 // Partial elements should declare access
ref partial struct MessagePackReader
#pragma warning restore SA1205 // Partial elements should declare access
{
/// <summary>
/// Reads an <see cref="Byte"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public Byte ReadByte()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((Byte)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((Byte)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((Byte)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((Byte)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((Byte)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((Byte)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((Byte)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((Byte)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((Byte)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (Byte)code;
}
throw ThrowInvalidCode(code);
}
}
/// <summary>
/// Reads an <see cref="UInt16"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public UInt16 ReadUInt16()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((UInt16)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((UInt16)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((UInt16)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((UInt16)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((UInt16)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((UInt16)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((UInt16)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((UInt16)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((UInt16)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (UInt16)code;
}
throw ThrowInvalidCode(code);
}
}
/// <summary>
/// Reads an <see cref="UInt32"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public UInt32 ReadUInt32()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((UInt32)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((UInt32)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((UInt32)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((UInt32)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((UInt32)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((UInt32)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((UInt32)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((UInt32)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((UInt32)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (UInt32)code;
}
throw ThrowInvalidCode(code);
}
}
/// <summary>
/// Reads an <see cref="UInt64"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public UInt64 ReadUInt64()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((UInt64)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((UInt64)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((UInt64)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((UInt64)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((UInt64)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((UInt64)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((UInt64)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((UInt64)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((UInt64)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (UInt64)code;
}
throw ThrowInvalidCode(code);
}
}
/// <summary>
/// Reads an <see cref="SByte"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public SByte ReadSByte()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((SByte)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((SByte)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((SByte)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((SByte)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((SByte)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((SByte)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((SByte)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((SByte)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((SByte)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (SByte)code;
}
throw ThrowInvalidCode(code);
}
}
/// <summary>
/// Reads an <see cref="Int16"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public Int16 ReadInt16()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((Int16)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((Int16)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((Int16)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((Int16)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((Int16)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((Int16)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((Int16)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((Int16)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((Int16)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (Int16)code;
}
throw ThrowInvalidCode(code);
}
}
/// <summary>
/// Reads an <see cref="Int32"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public Int32 ReadInt32()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((Int32)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((Int32)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((Int32)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((Int32)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((Int32)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((Int32)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((Int32)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((Int32)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((Int32)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (Int32)code;
}
throw ThrowInvalidCode(code);
}
}
/// <summary>
/// Reads an <see cref="Int64"/> value from:
/// Some value between <see cref="MessagePackCode.MinNegativeFixInt"/> and <see cref="MessagePackCode.MaxNegativeFixInt"/>,
/// Some value between <see cref="MessagePackCode.MinFixInt"/> and <see cref="MessagePackCode.MaxFixInt"/>,
/// or any of the other MsgPack integer types.
/// </summary>
/// <returns>The value.</returns>
/// <exception cref="OverflowException">Thrown when the value exceeds what can be stored in the returned type.</exception>
public Int64 ReadInt64()
{
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte code));
switch (code)
{
case MessagePackCode.UInt8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out byte byteResult));
return checked((Int64)byteResult);
case MessagePackCode.Int8:
ThrowInsufficientBufferUnless(this.reader.TryRead(out sbyte sbyteResult));
return checked((Int64)sbyteResult);
case MessagePackCode.UInt16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ushort ushortResult));
return checked((Int64)ushortResult);
case MessagePackCode.Int16:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out short shortResult));
return checked((Int64)shortResult);
case MessagePackCode.UInt32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out uint uintResult));
return checked((Int64)uintResult);
case MessagePackCode.Int32:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out int intResult));
return checked((Int64)intResult);
case MessagePackCode.UInt64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out ulong ulongResult));
return checked((Int64)ulongResult);
case MessagePackCode.Int64:
ThrowInsufficientBufferUnless(this.reader.TryReadBigEndian(out long longResult));
return checked((Int64)longResult);
default:
if (code >= MessagePackCode.MinNegativeFixInt && code <= MessagePackCode.MaxNegativeFixInt)
{
return checked((Int64)unchecked((sbyte)code));
}
if (code >= MessagePackCode.MinFixInt && code <= MessagePackCode.MaxFixInt)
{
return (Int64)code;
}
throw ThrowInvalidCode(code);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9c9a5153765d7dad39b4cc6d78e16f2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1fcb53a5d362d2e38b66d0a88d35d78f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,445 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT.
* CHANGE THE .tt FILE INSTEAD. */
using System;
using System.Buffers;
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters
{
public sealed class TupleFormatter<T1> : IMessagePackFormatter<Tuple<T1>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(1);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
}
}
public Tuple<T1> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 1)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
return new Tuple<T1>(item1);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class TupleFormatter<T1, T2> : IMessagePackFormatter<Tuple<T1, T2>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1, T2> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(2);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
}
}
public Tuple<T1, T2> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 2)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
return new Tuple<T1, T2>(item1, item2);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class TupleFormatter<T1, T2, T3> : IMessagePackFormatter<Tuple<T1, T2, T3>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1, T2, T3> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(3);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
}
}
public Tuple<T1, T2, T3> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 3)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
return new Tuple<T1, T2, T3>(item1, item2, item3);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class TupleFormatter<T1, T2, T3, T4> : IMessagePackFormatter<Tuple<T1, T2, T3, T4>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1, T2, T3, T4> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(4);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
}
}
public Tuple<T1, T2, T3, T4> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 4)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
return new Tuple<T1, T2, T3, T4>(item1, item2, item3, item4);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class TupleFormatter<T1, T2, T3, T4, T5> : IMessagePackFormatter<Tuple<T1, T2, T3, T4, T5>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1, T2, T3, T4, T5> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(5);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
}
}
public Tuple<T1, T2, T3, T4, T5> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 5)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
return new Tuple<T1, T2, T3, T4, T5>(item1, item2, item3, item4, item5);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class TupleFormatter<T1, T2, T3, T4, T5, T6> : IMessagePackFormatter<Tuple<T1, T2, T3, T4, T5, T6>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1, T2, T3, T4, T5, T6> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(6);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
resolver.GetFormatterWithVerify<T6>().Serialize(ref writer, value.Item6, options);
}
}
public Tuple<T1, T2, T3, T4, T5, T6> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 6)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
T6 item6 = resolver.GetFormatterWithVerify<T6>().Deserialize(ref reader, options);
return new Tuple<T1, T2, T3, T4, T5, T6>(item1, item2, item3, item4, item5, item6);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class TupleFormatter<T1, T2, T3, T4, T5, T6, T7> : IMessagePackFormatter<Tuple<T1, T2, T3, T4, T5, T6, T7>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1, T2, T3, T4, T5, T6, T7> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(7);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
resolver.GetFormatterWithVerify<T6>().Serialize(ref writer, value.Item6, options);
resolver.GetFormatterWithVerify<T7>().Serialize(ref writer, value.Item7, options);
}
}
public Tuple<T1, T2, T3, T4, T5, T6, T7> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 7)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
T6 item6 = resolver.GetFormatterWithVerify<T6>().Deserialize(ref reader, options);
T7 item7 = resolver.GetFormatterWithVerify<T7>().Deserialize(ref reader, options);
return new Tuple<T1, T2, T3, T4, T5, T6, T7>(item1, item2, item3, item4, item5, item6, item7);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class TupleFormatter<T1, T2, T3, T4, T5, T6, T7, TRest> : IMessagePackFormatter<Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>>
{
public void Serialize(ref MessagePackWriter writer, Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> value, MessagePackSerializerOptions options)
{
if (value == null)
{
writer.WriteNil();
}
else
{
writer.WriteArrayHeader(8);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
resolver.GetFormatterWithVerify<T6>().Serialize(ref writer, value.Item6, options);
resolver.GetFormatterWithVerify<T7>().Serialize(ref writer, value.Item7, options);
resolver.GetFormatterWithVerify<TRest>().Serialize(ref writer, value.Rest, options);
}
}
public Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.TryReadNil())
{
return default;
}
else
{
var count = reader.ReadArrayHeader();
if (count != 8)
{
throw new MessagePackSerializationException("Invalid Tuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
T6 item6 = resolver.GetFormatterWithVerify<T6>().Deserialize(ref reader, options);
T7 item7 = resolver.GetFormatterWithVerify<T7>().Deserialize(ref reader, options);
TRest item8 = resolver.GetFormatterWithVerify<TRest>().Deserialize(ref reader, options);
return new Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, item8);
}
finally
{
reader.Depth--;
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 21aa85f0a0973185698eec9b4ef8f3ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,901 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT.
* CHANGE THE .tt FILE INSTEAD. */
#if !UNITY_2018_3_OR_NEWER
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using MessagePack.Formatters;
namespace MessagePack.Internal
{
public static partial class UnsafeMemory32
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw4(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw5(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 1) = *(int*)(pSrc + 1);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw6(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 2) = *(int*)(pSrc + 2);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw7(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 3) = *(int*)(pSrc + 3);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw8(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw9(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 5) = *(int*)(pSrc + 5);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw10(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 6) = *(int*)(pSrc + 6);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw11(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 7) = *(int*)(pSrc + 7);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw12(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw13(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 9) = *(int*)(pSrc + 9);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw14(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 10) = *(int*)(pSrc + 10);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw15(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 11) = *(int*)(pSrc + 11);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw16(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw17(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 13) = *(int*)(pSrc + 13);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw18(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 14) = *(int*)(pSrc + 14);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw19(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 15) = *(int*)(pSrc + 15);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw20(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw21(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 17) = *(int*)(pSrc + 17);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw22(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 18) = *(int*)(pSrc + 18);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw23(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 19) = *(int*)(pSrc + 19);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw24(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw25(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
*(int*)(pDst + 21) = *(int*)(pSrc + 21);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw26(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
*(int*)(pDst + 22) = *(int*)(pSrc + 22);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw27(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
*(int*)(pDst + 23) = *(int*)(pSrc + 23);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw28(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
*(int*)(pDst + 24) = *(int*)(pSrc + 24);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw29(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
*(int*)(pDst + 24) = *(int*)(pSrc + 24);
*(int*)(pDst + 25) = *(int*)(pSrc + 25);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw30(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
*(int*)(pDst + 24) = *(int*)(pSrc + 24);
*(int*)(pDst + 26) = *(int*)(pSrc + 26);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw31(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(int*)(pDst + 0) = *(int*)(pSrc + 0);
*(int*)(pDst + 4) = *(int*)(pSrc + 4);
*(int*)(pDst + 8) = *(int*)(pSrc + 8);
*(int*)(pDst + 12) = *(int*)(pSrc + 12);
*(int*)(pDst + 16) = *(int*)(pSrc + 16);
*(int*)(pDst + 20) = *(int*)(pSrc + 20);
*(int*)(pDst + 24) = *(int*)(pSrc + 24);
*(int*)(pDst + 27) = *(int*)(pSrc + 27);
}
writer.Advance(src.Length);
}
}
public static partial class UnsafeMemory64
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw8(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw9(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 1) = *(long*)(pSrc + 1);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw10(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 2) = *(long*)(pSrc + 2);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw11(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 3) = *(long*)(pSrc + 3);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw12(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 4) = *(long*)(pSrc + 4);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw13(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 5) = *(long*)(pSrc + 5);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw14(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 6) = *(long*)(pSrc + 6);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw15(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 7) = *(long*)(pSrc + 7);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw16(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw17(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 9) = *(long*)(pSrc + 9);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw18(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 10) = *(long*)(pSrc + 10);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw19(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 11) = *(long*)(pSrc + 11);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw20(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 12) = *(long*)(pSrc + 12);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw21(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 13) = *(long*)(pSrc + 13);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw22(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 14) = *(long*)(pSrc + 14);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw23(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 15) = *(long*)(pSrc + 15);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw24(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw25(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
*(long*)(pDst + 17) = *(long*)(pSrc + 17);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw26(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
*(long*)(pDst + 18) = *(long*)(pSrc + 18);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw27(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
*(long*)(pDst + 19) = *(long*)(pSrc + 19);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw28(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
*(long*)(pDst + 20) = *(long*)(pSrc + 20);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw29(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
*(long*)(pDst + 21) = *(long*)(pSrc + 21);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw30(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
*(long*)(pDst + 22) = *(long*)(pSrc + 22);
}
writer.Advance(src.Length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void WriteRaw31(ref MessagePackWriter writer, ReadOnlySpan<byte> src)
{
Span<byte> dst = writer.GetSpan(src.Length);
fixed (byte* pSrc = &src[0])
fixed (byte* pDst = &dst[0])
{
*(long*)(pDst + 0) = *(long*)(pSrc + 0);
*(long*)(pDst + 8) = *(long*)(pSrc + 8);
*(long*)(pDst + 16) = *(long*)(pSrc + 16);
*(long*)(pDst + 23) = *(long*)(pSrc + 23);
}
writer.Advance(src.Length);
}
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ba8adf167b655e2a5a091ac6af276bb3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,390 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/* THIS (.cs) FILE IS GENERATED. DO NOT CHANGE IT.
* CHANGE THE .tt FILE INSTEAD. */
using System;
using System.Buffers;
#pragma warning disable SA1649 // File name should match first type name
namespace MessagePack.Formatters
{
public sealed class ValueTupleFormatter<T1> : IMessagePackFormatter<ValueTuple<T1>>
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(1);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
}
public ValueTuple<T1> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 1)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
return new ValueTuple<T1>(item1);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class ValueTupleFormatter<T1, T2> : IMessagePackFormatter<ValueTuple<T1, T2>>
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1, T2> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(2);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
}
public ValueTuple<T1, T2> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 2)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
return new ValueTuple<T1, T2>(item1, item2);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class ValueTupleFormatter<T1, T2, T3> : IMessagePackFormatter<ValueTuple<T1, T2, T3>>
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1, T2, T3> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(3);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
}
public ValueTuple<T1, T2, T3> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 3)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
return new ValueTuple<T1, T2, T3>(item1, item2, item3);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class ValueTupleFormatter<T1, T2, T3, T4> : IMessagePackFormatter<ValueTuple<T1, T2, T3, T4>>
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1, T2, T3, T4> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(4);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
}
public ValueTuple<T1, T2, T3, T4> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 4)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
return new ValueTuple<T1, T2, T3, T4>(item1, item2, item3, item4);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class ValueTupleFormatter<T1, T2, T3, T4, T5> : IMessagePackFormatter<ValueTuple<T1, T2, T3, T4, T5>>
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1, T2, T3, T4, T5> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(5);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
}
public ValueTuple<T1, T2, T3, T4, T5> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 5)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
return new ValueTuple<T1, T2, T3, T4, T5>(item1, item2, item3, item4, item5);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class ValueTupleFormatter<T1, T2, T3, T4, T5, T6> : IMessagePackFormatter<ValueTuple<T1, T2, T3, T4, T5, T6>>
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1, T2, T3, T4, T5, T6> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(6);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
resolver.GetFormatterWithVerify<T6>().Serialize(ref writer, value.Item6, options);
}
public ValueTuple<T1, T2, T3, T4, T5, T6> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 6)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
T6 item6 = resolver.GetFormatterWithVerify<T6>().Deserialize(ref reader, options);
return new ValueTuple<T1, T2, T3, T4, T5, T6>(item1, item2, item3, item4, item5, item6);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class ValueTupleFormatter<T1, T2, T3, T4, T5, T6, T7> : IMessagePackFormatter<ValueTuple<T1, T2, T3, T4, T5, T6, T7>>
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1, T2, T3, T4, T5, T6, T7> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(7);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
resolver.GetFormatterWithVerify<T6>().Serialize(ref writer, value.Item6, options);
resolver.GetFormatterWithVerify<T7>().Serialize(ref writer, value.Item7, options);
}
public ValueTuple<T1, T2, T3, T4, T5, T6, T7> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 7)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
T6 item6 = resolver.GetFormatterWithVerify<T6>().Deserialize(ref reader, options);
T7 item7 = resolver.GetFormatterWithVerify<T7>().Deserialize(ref reader, options);
return new ValueTuple<T1, T2, T3, T4, T5, T6, T7>(item1, item2, item3, item4, item5, item6, item7);
}
finally
{
reader.Depth--;
}
}
}
}
public sealed class ValueTupleFormatter<T1, T2, T3, T4, T5, T6, T7, TRest> : IMessagePackFormatter<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>
where TRest : struct
{
public void Serialize(ref MessagePackWriter writer, ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> value, MessagePackSerializerOptions options)
{
writer.WriteArrayHeader(8);
IFormatterResolver resolver = options.Resolver;
resolver.GetFormatterWithVerify<T1>().Serialize(ref writer, value.Item1, options);
resolver.GetFormatterWithVerify<T2>().Serialize(ref writer, value.Item2, options);
resolver.GetFormatterWithVerify<T3>().Serialize(ref writer, value.Item3, options);
resolver.GetFormatterWithVerify<T4>().Serialize(ref writer, value.Item4, options);
resolver.GetFormatterWithVerify<T5>().Serialize(ref writer, value.Item5, options);
resolver.GetFormatterWithVerify<T6>().Serialize(ref writer, value.Item6, options);
resolver.GetFormatterWithVerify<T7>().Serialize(ref writer, value.Item7, options);
resolver.GetFormatterWithVerify<TRest>().Serialize(ref writer, value.Rest, options);
}
public ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
if (reader.IsNil)
{
throw new MessagePackSerializationException("Data is Nil, ValueTuple can not be null.");
}
else
{
var count = reader.ReadArrayHeader();
if (count != 8)
{
throw new MessagePackSerializationException("Invalid ValueTuple count");
}
IFormatterResolver resolver = options.Resolver;
options.Security.DepthStep(ref reader);
try
{
T1 item1 = resolver.GetFormatterWithVerify<T1>().Deserialize(ref reader, options);
T2 item2 = resolver.GetFormatterWithVerify<T2>().Deserialize(ref reader, options);
T3 item3 = resolver.GetFormatterWithVerify<T3>().Deserialize(ref reader, options);
T4 item4 = resolver.GetFormatterWithVerify<T4>().Deserialize(ref reader, options);
T5 item5 = resolver.GetFormatterWithVerify<T5>().Deserialize(ref reader, options);
T6 item6 = resolver.GetFormatterWithVerify<T6>().Deserialize(ref reader, options);
T7 item7 = resolver.GetFormatterWithVerify<T7>().Deserialize(ref reader, options);
TRest item8 = resolver.GetFormatterWithVerify<TRest>().Deserialize(ref reader, options);
return new ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, item8);
}
finally
{
reader.Depth--;
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7dd3287be759a5f388a0a1f53b283b7d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: