// 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 : IMessagePackFormatter> { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(1); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); } public ValueTuple 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().Deserialize(ref reader, options); return new ValueTuple(item1); } finally { reader.Depth--; } } } } public sealed class ValueTupleFormatter : IMessagePackFormatter> { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(2); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); } public ValueTuple 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().Deserialize(ref reader, options); T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); return new ValueTuple(item1, item2); } finally { reader.Depth--; } } } } public sealed class ValueTupleFormatter : IMessagePackFormatter> { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(3); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); } public ValueTuple 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().Deserialize(ref reader, options); T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); return new ValueTuple(item1, item2, item3); } finally { reader.Depth--; } } } } public sealed class ValueTupleFormatter : IMessagePackFormatter> { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(4); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); } public ValueTuple 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().Deserialize(ref reader, options); T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); return new ValueTuple(item1, item2, item3, item4); } finally { reader.Depth--; } } } } public sealed class ValueTupleFormatter : IMessagePackFormatter> { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(5); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); } public ValueTuple 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().Deserialize(ref reader, options); T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); return new ValueTuple(item1, item2, item3, item4, item5); } finally { reader.Depth--; } } } } public sealed class ValueTupleFormatter : IMessagePackFormatter> { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(6); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); } public ValueTuple 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().Deserialize(ref reader, options); T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); return new ValueTuple(item1, item2, item3, item4, item5, item6); } finally { reader.Depth--; } } } } public sealed class ValueTupleFormatter : IMessagePackFormatter> { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(7); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); } public ValueTuple 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().Deserialize(ref reader, options); T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T7 item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); return new ValueTuple(item1, item2, item3, item4, item5, item6, item7); } finally { reader.Depth--; } } } } public sealed class ValueTupleFormatter : IMessagePackFormatter> where TRest : struct { public void Serialize(ref MessagePackWriter writer, ValueTuple value, MessagePackSerializerOptions options) { writer.WriteArrayHeader(8); IFormatterResolver resolver = options.Resolver; resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item1, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item2, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item3, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item4, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item5, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item6, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Item7, options); resolver.GetFormatterWithVerify().Serialize(ref writer, value.Rest, options); } public ValueTuple 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().Deserialize(ref reader, options); T2 item2 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T3 item3 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T4 item4 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T5 item5 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T6 item6 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); T7 item7 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); TRest item8 = resolver.GetFormatterWithVerify().Deserialize(ref reader, options); return new ValueTuple(item1, item2, item3, item4, item5, item6, item7, item8); } finally { reader.Depth--; } } } } }