From 08f39850c5927d962707a8f99d46e7be5bf1baa0 Mon Sep 17 00:00:00 2001 From: Cedric Decoster Date: Sat, 14 Sep 2024 09:10:00 +0200 Subject: [PATCH] added basetuple with arguments up to 39 in again added reconenctivity on json rpc disconnect --- Substrate.NetApi.Console/Program.cs | 60 + .../Substrate.NetApi.Console.csproj | 18 + .../Model/Types/Base/BaseTuple.cs | 6871 +++++++++++++++++ Substrate.NetApi/Substrate.NetApi.csproj | 2 +- Substrate.NetApi/SubstrateClient.cs | 192 +- SubstrateNetApi.sln | 10 + 6 files changed, 7116 insertions(+), 37 deletions(-) create mode 100644 Substrate.NetApi.Console/Program.cs create mode 100644 Substrate.NetApi.Console/Substrate.NetApi.Console.csproj diff --git a/Substrate.NetApi.Console/Program.cs b/Substrate.NetApi.Console/Program.cs new file mode 100644 index 0000000..ecf632d --- /dev/null +++ b/Substrate.NetApi.Console/Program.cs @@ -0,0 +1,60 @@ +using Serilog; +using Substrate.NetApi; +using Substrate.NetApi.Model.Extrinsics; + +internal class Program +{ + private static async Task Main(string[] args) + { + // Configure Serilog for logging + Log.Logger = new LoggerConfiguration() + .WriteTo.Console() + .MinimumLevel.Debug() + .CreateLogger(); + + // Set up a cancellation token for graceful shutdown + CancellationTokenSource cts = new CancellationTokenSource(); + + await MainAsync(cts.Token); + + // Keep the application alive to continue monitoring the connection + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + + // Cleanup logging resources + await Log.CloseAndFlushAsync(); + } + + private static async Task MainAsync(CancellationToken token) + { + // Create the client + string substrateNodeUrl = "wss://rpc-parachain.bajun.network"; + var client = new SubstrateClient(new Uri(substrateNodeUrl), ChargeTransactionPayment.Default()); + + while (!token.IsCancellationRequested) + { + // Ensure the client is connected + if (!client.IsConnected) + { + Log.Information("Attempting to connect to the client..."); + await client.ConnectAsync( + useMetaData: true, + standardSubstrate: true, + maxRetryAttempts: 5, + delayRetryMilliseconds: 5000, + token: token + ); + Log.Information("Client connected successfully."); + } + + var currentBlocknumber = await client.State.GetStorageAsync(Utils.HexToByteArray("0x26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"), (string)null, token); + Log.Information("MainAsync running... block: {blocknumber}", currentBlocknumber.ToString()); + + // Wait before next call + await Task.Delay(12000); + } + + // Gracefully shut down + await client.CloseAsync(); + } +} \ No newline at end of file diff --git a/Substrate.NetApi.Console/Substrate.NetApi.Console.csproj b/Substrate.NetApi.Console/Substrate.NetApi.Console.csproj new file mode 100644 index 0000000..d28447d --- /dev/null +++ b/Substrate.NetApi.Console/Substrate.NetApi.Console.csproj @@ -0,0 +1,18 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + diff --git a/Substrate.NetApi/Model/Types/Base/BaseTuple.cs b/Substrate.NetApi/Model/Types/Base/BaseTuple.cs index 3751d19..b03a932 100644 --- a/Substrate.NetApi/Model/Types/Base/BaseTuple.cs +++ b/Substrate.NetApi/Model/Types/Base/BaseTuple.cs @@ -13,11 +13,13 @@ public override string TypeName() { return "(" + ")"; } + /// public override byte[] Encode() { return new byte[0]; } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -50,12 +52,14 @@ public BaseTuple(T1 t1) { Create(t1); } + /// public override string TypeName() { return "(" + new T1().TypeName() + ")"; } + /// public override byte[] Encode() { @@ -66,6 +70,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -123,6 +128,7 @@ public BaseTuple(T1 t1, T2 t2) { Create(t1, t2); } + /// public override string TypeName() { @@ -130,6 +136,7 @@ public override string TypeName() new T1().TypeName() + "," + new T2().TypeName() + ")"; } + /// public override byte[] Encode() { @@ -140,6 +147,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -202,6 +210,7 @@ public BaseTuple(T1 t1, T2 t2, T3 t3) { Create(t1, t2, t3); } + /// public override string TypeName() { @@ -210,6 +219,7 @@ public override string TypeName() new T2().TypeName() + "," + new T3().TypeName() + ")"; } + /// public override byte[] Encode() { @@ -220,6 +230,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -309,6 +320,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -380,6 +392,7 @@ public override string TypeName() new T4().TypeName() + "," + new T5().TypeName() + ")"; } + /// public override byte[] Encode() { @@ -390,6 +403,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -468,6 +482,7 @@ public override string TypeName() new T5().TypeName() + "," + new T6().TypeName() + ")"; } + /// public override byte[] Encode() { @@ -478,6 +493,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -563,6 +579,7 @@ public override string TypeName() new T6().TypeName() + "," + new T7().TypeName() + ")"; } + /// public override byte[] Encode() { @@ -573,6 +590,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -665,6 +683,7 @@ public override string TypeName() new T7().TypeName() + "," + new T8().TypeName() + ")"; } + /// public override byte[] Encode() { @@ -675,6 +694,7 @@ public override byte[] Encode() } return result.ToArray(); } + /// public override void Decode(byte[] byteArray, ref int p) { @@ -745,4 +765,6855 @@ public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) /// public IType[] Value { get; internal set; } } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[9]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); byteList.ToArray(); + + Value = new IType[9]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[10]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); byteList.ToArray(); + + Value = new IType[10]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[11]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); byteList.ToArray(); + + Value = new IType[11]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[12]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); byteList.ToArray(); + + Value = new IType[12]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[13]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); byteList.ToArray(); + + Value = new IType[13]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[14]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); byteList.ToArray(); + + Value = new IType[14]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[15]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); byteList.ToArray(); + + Value = new IType[15]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[16]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); byteList.ToArray(); + + Value = new IType[16]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[17]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); byteList.ToArray(); + + Value = new IType[17]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[18]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); byteList.ToArray(); + + Value = new IType[18]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[19]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); byteList.ToArray(); + + Value = new IType[19]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[20]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); byteList.ToArray(); + + Value = new IType[20]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[21]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); byteList.ToArray(); + + Value = new IType[21]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[22]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); byteList.ToArray(); + + Value = new IType[22]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[23]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); byteList.ToArray(); + + Value = new IType[23]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[24]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); byteList.ToArray(); + + Value = new IType[24]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[25]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); byteList.ToArray(); + + Value = new IType[25]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[26]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); byteList.ToArray(); + + Value = new IType[26]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[27]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); byteList.ToArray(); + + Value = new IType[27]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[28]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); byteList.ToArray(); + + Value = new IType[28]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[29]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); byteList.ToArray(); + + Value = new IType[29]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[30]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); byteList.ToArray(); + + Value = new IType[30]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[31]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); byteList.ToArray(); + + Value = new IType[31]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[32]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); byteList.ToArray(); + + Value = new IType[32]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + where T33 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + "," + + new T33().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[33]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; + var t33 = new T33(); + t33.Decode(byteArray, ref p); + Value[32] = t33; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); + byteList.AddRange(t33.Encode()); byteList.ToArray(); + + Value = new IType[33]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + Value[32] = t33; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + where T33 : IType, new() + where T34 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + "," + + new T33().TypeName() + "," + + new T34().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[34]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; + var t33 = new T33(); + t33.Decode(byteArray, ref p); + Value[32] = t33; + var t34 = new T34(); + t34.Decode(byteArray, ref p); + Value[33] = t34; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); + byteList.AddRange(t33.Encode()); + byteList.AddRange(t34.Encode()); byteList.ToArray(); + + Value = new IType[34]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + Value[32] = t33; + Value[33] = t34; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + where T33 : IType, new() + where T34 : IType, new() + where T35 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + "," + + new T33().TypeName() + "," + + new T34().TypeName() + "," + + new T35().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[35]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; + var t33 = new T33(); + t33.Decode(byteArray, ref p); + Value[32] = t33; + var t34 = new T34(); + t34.Decode(byteArray, ref p); + Value[33] = t34; + var t35 = new T35(); + t35.Decode(byteArray, ref p); + Value[34] = t35; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34, T35 t35) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); + byteList.AddRange(t33.Encode()); + byteList.AddRange(t34.Encode()); + byteList.AddRange(t35.Encode()); byteList.ToArray(); + + Value = new IType[35]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + Value[32] = t33; + Value[33] = t34; + Value[34] = t35; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + where T33 : IType, new() + where T34 : IType, new() + where T35 : IType, new() + where T36 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + "," + + new T33().TypeName() + "," + + new T34().TypeName() + "," + + new T35().TypeName() + "," + + new T36().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[36]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; + var t33 = new T33(); + t33.Decode(byteArray, ref p); + Value[32] = t33; + var t34 = new T34(); + t34.Decode(byteArray, ref p); + Value[33] = t34; + var t35 = new T35(); + t35.Decode(byteArray, ref p); + Value[34] = t35; + var t36 = new T36(); + t36.Decode(byteArray, ref p); + Value[35] = t36; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34, T35 t35, T36 t36) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); + byteList.AddRange(t33.Encode()); + byteList.AddRange(t34.Encode()); + byteList.AddRange(t35.Encode()); + byteList.AddRange(t36.Encode()); byteList.ToArray(); + + Value = new IType[36]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + Value[32] = t33; + Value[33] = t34; + Value[34] = t35; + Value[35] = t36; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + where T33 : IType, new() + where T34 : IType, new() + where T35 : IType, new() + where T36 : IType, new() + where T37 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + "," + + new T33().TypeName() + "," + + new T34().TypeName() + "," + + new T35().TypeName() + "," + + new T36().TypeName() + "," + + new T37().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[37]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; + var t33 = new T33(); + t33.Decode(byteArray, ref p); + Value[32] = t33; + var t34 = new T34(); + t34.Decode(byteArray, ref p); + Value[33] = t34; + var t35 = new T35(); + t35.Decode(byteArray, ref p); + Value[34] = t35; + var t36 = new T36(); + t36.Decode(byteArray, ref p); + Value[35] = t36; + var t37 = new T37(); + t37.Decode(byteArray, ref p); + Value[36] = t37; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34, T35 t35, T36 t36, T37 t37) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); + byteList.AddRange(t33.Encode()); + byteList.AddRange(t34.Encode()); + byteList.AddRange(t35.Encode()); + byteList.AddRange(t36.Encode()); + byteList.AddRange(t37.Encode()); byteList.ToArray(); + + Value = new IType[37]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + Value[32] = t33; + Value[33] = t34; + Value[34] = t35; + Value[35] = t36; + Value[36] = t37; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + where T33 : IType, new() + where T34 : IType, new() + where T35 : IType, new() + where T36 : IType, new() + where T37 : IType, new() + where T38 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + "," + + new T33().TypeName() + "," + + new T34().TypeName() + "," + + new T35().TypeName() + "," + + new T36().TypeName() + "," + + new T37().TypeName() + "," + + new T38().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[38]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; + var t33 = new T33(); + t33.Decode(byteArray, ref p); + Value[32] = t33; + var t34 = new T34(); + t34.Decode(byteArray, ref p); + Value[33] = t34; + var t35 = new T35(); + t35.Decode(byteArray, ref p); + Value[34] = t35; + var t36 = new T36(); + t36.Decode(byteArray, ref p); + Value[35] = t36; + var t37 = new T37(); + t37.Decode(byteArray, ref p); + Value[36] = t37; + var t38 = new T38(); + t38.Decode(byteArray, ref p); + Value[37] = t38; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34, T35 t35, T36 t36, T37 t37, T38 t38) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); + byteList.AddRange(t33.Encode()); + byteList.AddRange(t34.Encode()); + byteList.AddRange(t35.Encode()); + byteList.AddRange(t36.Encode()); + byteList.AddRange(t37.Encode()); + byteList.AddRange(t38.Encode()); byteList.ToArray(); + + Value = new IType[38]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + Value[32] = t33; + Value[33] = t34; + Value[34] = t35; + Value[35] = t36; + Value[36] = t37; + Value[37] = t38; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } + + /// + /// Base class for multiple tuples type + /// + public class BaseTuple : BaseType + where T1 : IType, new() + where T2 : IType, new() + where T3 : IType, new() + where T4 : IType, new() + where T5 : IType, new() + where T6 : IType, new() + where T7 : IType, new() + where T8 : IType, new() + where T9 : IType, new() + where T10 : IType, new() + where T11 : IType, new() + where T12 : IType, new() + where T13 : IType, new() + where T14 : IType, new() + where T15 : IType, new() + where T16 : IType, new() + where T17 : IType, new() + where T18 : IType, new() + where T19 : IType, new() + where T20 : IType, new() + where T21 : IType, new() + where T22 : IType, new() + where T23 : IType, new() + where T24 : IType, new() + where T25 : IType, new() + where T26 : IType, new() + where T27 : IType, new() + where T28 : IType, new() + where T29 : IType, new() + where T30 : IType, new() + where T31 : IType, new() + where T32 : IType, new() + where T33 : IType, new() + where T34 : IType, new() + where T35 : IType, new() + where T36 : IType, new() + where T37 : IType, new() + where T38 : IType, new() + where T39 : IType, new() + { + /// + public override string TypeName() + { + return "(" + + new T1().TypeName() + "," + + new T2().TypeName() + "," + + new T3().TypeName() + "," + + new T4().TypeName() + "," + + new T5().TypeName() + "," + + new T6().TypeName() + "," + + new T7().TypeName() + "," + + new T8().TypeName() + "," + + new T9().TypeName() + "," + + new T10().TypeName() + "," + + new T11().TypeName() + "," + + new T12().TypeName() + "," + + new T13().TypeName() + "," + + new T14().TypeName() + "," + + new T15().TypeName() + "," + + new T16().TypeName() + "," + + new T17().TypeName() + "," + + new T18().TypeName() + "," + + new T19().TypeName() + "," + + new T20().TypeName() + "," + + new T21().TypeName() + "," + + new T22().TypeName() + "," + + new T23().TypeName() + "," + + new T24().TypeName() + "," + + new T25().TypeName() + "," + + new T26().TypeName() + "," + + new T27().TypeName() + "," + + new T28().TypeName() + "," + + new T29().TypeName() + "," + + new T30().TypeName() + "," + + new T31().TypeName() + "," + + new T32().TypeName() + "," + + new T33().TypeName() + "," + + new T34().TypeName() + "," + + new T35().TypeName() + "," + + new T36().TypeName() + "," + + new T37().TypeName() + "," + + new T38().TypeName() + "," + + new T39().TypeName() + ")"; + } + + /// + public override byte[] Encode() + { + var result = new List(); + foreach (var v in Value) + { + result.AddRange(v.Encode()); + } + return result.ToArray(); + } + + /// + public override void Decode(byte[] byteArray, ref int p) + { + var start = p; + + Value = new IType[39]; + + var t1 = new T1(); + t1.Decode(byteArray, ref p); + Value[0] = t1; + var t2 = new T2(); + t2.Decode(byteArray, ref p); + Value[1] = t2; + var t3 = new T3(); + t3.Decode(byteArray, ref p); + Value[2] = t3; + var t4 = new T4(); + t4.Decode(byteArray, ref p); + Value[3] = t4; + var t5 = new T5(); + t5.Decode(byteArray, ref p); + Value[4] = t5; + var t6 = new T6(); + t6.Decode(byteArray, ref p); + Value[5] = t6; + var t7 = new T7(); + t7.Decode(byteArray, ref p); + Value[6] = t7; + var t8 = new T8(); + t8.Decode(byteArray, ref p); + Value[7] = t8; + var t9 = new T9(); + t9.Decode(byteArray, ref p); + Value[8] = t9; + var t10 = new T10(); + t10.Decode(byteArray, ref p); + Value[9] = t10; + var t11 = new T11(); + t11.Decode(byteArray, ref p); + Value[10] = t11; + var t12 = new T12(); + t12.Decode(byteArray, ref p); + Value[11] = t12; + var t13 = new T13(); + t13.Decode(byteArray, ref p); + Value[12] = t13; + var t14 = new T14(); + t14.Decode(byteArray, ref p); + Value[13] = t14; + var t15 = new T15(); + t15.Decode(byteArray, ref p); + Value[14] = t15; + var t16 = new T16(); + t16.Decode(byteArray, ref p); + Value[15] = t16; + var t17 = new T17(); + t17.Decode(byteArray, ref p); + Value[16] = t17; + var t18 = new T18(); + t18.Decode(byteArray, ref p); + Value[17] = t18; + var t19 = new T19(); + t19.Decode(byteArray, ref p); + Value[18] = t19; + var t20 = new T20(); + t20.Decode(byteArray, ref p); + Value[19] = t20; + var t21 = new T21(); + t21.Decode(byteArray, ref p); + Value[20] = t21; + var t22 = new T22(); + t22.Decode(byteArray, ref p); + Value[21] = t22; + var t23 = new T23(); + t23.Decode(byteArray, ref p); + Value[22] = t23; + var t24 = new T24(); + t24.Decode(byteArray, ref p); + Value[23] = t24; + var t25 = new T25(); + t25.Decode(byteArray, ref p); + Value[24] = t25; + var t26 = new T26(); + t26.Decode(byteArray, ref p); + Value[25] = t26; + var t27 = new T27(); + t27.Decode(byteArray, ref p); + Value[26] = t27; + var t28 = new T28(); + t28.Decode(byteArray, ref p); + Value[27] = t28; + var t29 = new T29(); + t29.Decode(byteArray, ref p); + Value[28] = t29; + var t30 = new T30(); + t30.Decode(byteArray, ref p); + Value[29] = t30; + var t31 = new T31(); + t31.Decode(byteArray, ref p); + Value[30] = t31; + var t32 = new T32(); + t32.Decode(byteArray, ref p); + Value[31] = t32; + var t33 = new T33(); + t33.Decode(byteArray, ref p); + Value[32] = t33; + var t34 = new T34(); + t34.Decode(byteArray, ref p); + Value[33] = t34; + var t35 = new T35(); + t35.Decode(byteArray, ref p); + Value[34] = t35; + var t36 = new T36(); + t36.Decode(byteArray, ref p); + Value[35] = t36; + var t37 = new T37(); + t37.Decode(byteArray, ref p); + Value[36] = t37; + var t38 = new T38(); + t38.Decode(byteArray, ref p); + Value[37] = t38; + var t39 = new T39(); + t39.Decode(byteArray, ref p); + Value[38] = t39; TypeSize = p - start; + + Bytes = new byte[TypeSize]; + Array.Copy(byteArray, start, Bytes, 0, TypeSize); + } + + /// + /// Create tuple + /// + public void Create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34, T35 t35, T36 t36, T37 t37, T38 t38, T39 t39) + { + var byteList = new List(); + byteList.AddRange(t1.Encode()); + byteList.AddRange(t2.Encode()); + byteList.AddRange(t3.Encode()); + byteList.AddRange(t4.Encode()); + byteList.AddRange(t5.Encode()); + byteList.AddRange(t6.Encode()); + byteList.AddRange(t7.Encode()); + byteList.AddRange(t8.Encode()); + byteList.AddRange(t9.Encode()); + byteList.AddRange(t10.Encode()); + byteList.AddRange(t11.Encode()); + byteList.AddRange(t12.Encode()); + byteList.AddRange(t13.Encode()); + byteList.AddRange(t14.Encode()); + byteList.AddRange(t15.Encode()); + byteList.AddRange(t16.Encode()); + byteList.AddRange(t17.Encode()); + byteList.AddRange(t18.Encode()); + byteList.AddRange(t19.Encode()); + byteList.AddRange(t20.Encode()); + byteList.AddRange(t21.Encode()); + byteList.AddRange(t22.Encode()); + byteList.AddRange(t23.Encode()); + byteList.AddRange(t24.Encode()); + byteList.AddRange(t25.Encode()); + byteList.AddRange(t26.Encode()); + byteList.AddRange(t27.Encode()); + byteList.AddRange(t28.Encode()); + byteList.AddRange(t29.Encode()); + byteList.AddRange(t30.Encode()); + byteList.AddRange(t31.Encode()); + byteList.AddRange(t32.Encode()); + byteList.AddRange(t33.Encode()); + byteList.AddRange(t34.Encode()); + byteList.AddRange(t35.Encode()); + byteList.AddRange(t36.Encode()); + byteList.AddRange(t37.Encode()); + byteList.AddRange(t38.Encode()); + byteList.AddRange(t39.Encode()); byteList.ToArray(); + + Value = new IType[39]; + Value[0] = t1; + Value[1] = t2; + Value[2] = t3; + Value[3] = t4; + Value[4] = t5; + Value[5] = t6; + Value[6] = t7; + Value[7] = t8; + Value[8] = t9; + Value[9] = t10; + Value[10] = t11; + Value[11] = t12; + Value[12] = t13; + Value[13] = t14; + Value[14] = t15; + Value[15] = t16; + Value[16] = t17; + Value[17] = t18; + Value[18] = t19; + Value[19] = t20; + Value[20] = t21; + Value[21] = t22; + Value[22] = t23; + Value[23] = t24; + Value[24] = t25; + Value[25] = t26; + Value[26] = t27; + Value[27] = t28; + Value[28] = t29; + Value[29] = t30; + Value[30] = t31; + Value[31] = t32; + Value[32] = t33; + Value[33] = t34; + Value[34] = t35; + Value[35] = t36; + Value[36] = t37; + Value[37] = t38; + Value[38] = t39; + + Bytes = byteList.ToArray(); + TypeSize = Bytes.Length; + } + + /// + /// Value of tuple + /// + public IType[] Value { get; internal set; } + } } \ No newline at end of file diff --git a/Substrate.NetApi/Substrate.NetApi.csproj b/Substrate.NetApi/Substrate.NetApi.csproj index 722348e..7163616 100644 --- a/Substrate.NetApi/Substrate.NetApi.csproj +++ b/Substrate.NetApi/Substrate.NetApi.csproj @@ -3,7 +3,7 @@ Substrate.NET.API netstandard2.0;netstandard2.1;net6.0 - 0.9.24-rc5 + 0.9.24-rc6 Substrate Gaming Substrate Gaming true diff --git a/Substrate.NetApi/SubstrateClient.cs b/Substrate.NetApi/SubstrateClient.cs index 9feb73f..8aa05fb 100644 --- a/Substrate.NetApi/SubstrateClient.cs +++ b/Substrate.NetApi/SubstrateClient.cs @@ -26,12 +26,14 @@ namespace Substrate.NetApi { - /// A substrate client. - /// 19.09.2020. - /// + /// + /// Substrate client + /// public class SubstrateClient : IDisposable { - /// The logger. + /// + /// The logger. + /// private static readonly ILogger Logger = new LoggerConfiguration().CreateLogger(); private readonly ExtrinsicJsonConverter _extrinsicJsonConverter; @@ -40,23 +42,33 @@ public class SubstrateClient : IDisposable private readonly TransactionEventJsonConverter _transactionEventJsonConverter; - /// The request token sources. + /// + /// The request token sources + /// private readonly ConcurrentDictionary _requestTokenSourceDict; - /// _URI of the resource. + /// + /// _URI of the resource + /// private readonly Uri _uri; - /// The connect token source. + /// + /// The connect token source + /// private CancellationTokenSource _connectTokenSource; - /// The JSON RPC. + /// + /// The JSON RPC + /// private JsonRpc _jsonRpc; - /// The socket. + /// + /// The socket + /// private ClientWebSocket _socket; /// - /// Bypass Remote Certificate Validation. Useful when testing with self-signed SSL certificates. + /// Bypass Remote Certificate Validation. Useful when testing with self-signed SSL certificates. /// private readonly bool _bypassRemoteCertificateValidation; @@ -86,11 +98,12 @@ public SubstrateClient(Uri uri, ChargeType chargeType, bool bypassRemoteCertific _requestTokenSourceDict = new ConcurrentDictionary(); } - /// Gets or sets information describing the meta. - /// Information describing the meta. + /// + /// Gets or sets information describing the meta + /// public MetaData MetaData { get; private set; } - /// + /// /// Network runtime version /// public RuntimeVersion RuntimeVersion { get; private set; } @@ -100,28 +113,34 @@ public SubstrateClient(Uri uri, ChargeType chargeType, bool bypassRemoteCertific /// public Properties Properties { get; private set; } - /// Gets or sets the genesis hash. - /// The genesis hash. + /// + /// Gets or sets the genesis hash + /// public Hash GenesisHash { get; private set; } - /// Gets the system. - /// The system. + /// + /// Gets the system. + /// public Modules.System System { get; } - /// Gets the chain. - /// The chain. + /// + /// Gets the chain. + /// public Chain Chain { get; } - /// Gets the payment. - /// The payment. + /// + /// Gets the payment. + /// public Payment Payment { get; } - /// Gets the state. - /// The state. + /// + /// Gets the state. + /// public State State { get; } - /// Gets the author. - /// The author. + /// + /// Gets the author. + /// public Author Author { get; } public RuntimeCall RuntimeCall { get; } @@ -136,10 +155,21 @@ public SubstrateClient(Uri uri, ChargeType chargeType, bool bypassRemoteCertific /// public SubscriptionListener Listener { get; } = new SubscriptionListener(); - /// Gets a value indicating whether this object is connected. - /// True if this object is connected, false if not. + /// + /// Gets a value indicating whether this object is connected. + /// public bool IsConnected => _socket?.State == WebSocketState.Open && _jsonRpc != null; + /// + /// Maximum number of retry attempts to connect to the node. + /// + private int _maxRetryAttempts; + + /// + /// Delay in milliseconds before retrying to connect to the node. + /// + private int _delayRetryMilliseconds; + /// /// Sets the JSON-RPC logging level. /// @@ -165,7 +195,7 @@ public async Task ConnectAsync() } /// - /// Asynchronously connects to the node. + /// Connect to the node asynchronously. /// /// Cancellation token. /// @@ -175,7 +205,7 @@ public async Task ConnectAsync(CancellationToken token) } /// - /// Asynchronously connects to the node. + /// Connect to the node asynchronously. /// /// Parse metadata on connect. /// Cancellation token. @@ -186,21 +216,41 @@ public async Task ConnectAsync(bool useMetaData, CancellationToken token) } /// - /// Asynchronously connects to the node. + /// Connect to the node asynchronously. /// - /// Parse metadata on connect. - /// Get blocknumber and runtime information from standard susbtrate node. - /// Cancellation token. + /// + /// + /// /// public async Task ConnectAsync(bool useMetaData, bool standardSubstrate, CancellationToken token) { + await ConnectAsync(useMetaData, standardSubstrate, 5, 2000, token); + } + + /// + /// Connect to the node asynchronously. + /// + /// + /// + /// + /// + /// + /// + public async Task ConnectAsync(bool useMetaData, bool standardSubstrate, int maxRetryAttempts, int delayRetryMilliseconds, CancellationToken token) + { + _maxRetryAttempts = maxRetryAttempts; + _delayRetryMilliseconds = delayRetryMilliseconds; + if (_socket != null && _socket.State == WebSocketState.Open) + { return; + } if (_socket == null || _socket.State != WebSocketState.None) { _jsonRpc?.Dispose(); _socket?.Dispose(); + _socket = new ClientWebSocket(); // Set RemoteCertificateValidationCallback to return true @@ -209,7 +259,7 @@ public async Task ConnectAsync(bool useMetaData, bool standardSubstrate, Cancell #if NETSTANDARD2_0 throw new NotSupportedException("Bypass remote certification validation not supported in NETStandard2.0"); #elif NETSTANDARD2_1_OR_GREATER - _socket.Options.RemoteCertificateValidationCallback = (sender, certificate, chain, errors) => true; + _socket.Options.RemoteCertificateValidationCallback = (sender, certificate, chain, errors) => true; #endif } } @@ -220,6 +270,7 @@ public async Task ConnectAsync(bool useMetaData, bool standardSubstrate, Cancell linkedTokenSource.Dispose(); _connectTokenSource.Dispose(); _connectTokenSource = null; + Logger.Debug("Connected to Websocket."); var formatter = new JsonMessageFormatter(); @@ -235,10 +286,12 @@ public async Task ConnectAsync(bool useMetaData, bool standardSubstrate, Cancell formatter.JsonSerializer.Converters.Add(_transactionEventJsonConverter); _jsonRpc = new JsonRpc(new WebSocketMessageHandler(_socket, formatter)); + _jsonRpc.Disconnected += OnJsonRpcDisconnected; _jsonRpc.TraceSource.Listeners.Add(new SerilogTraceListener.SerilogTraceListener()); _jsonRpc.TraceSource.Switch.Level = SourceLevels.Warning; _jsonRpc.AddLocalRpcTarget(Listener, new JsonRpcTargetOptions { AllowNonPublicInvocation = false }); _jsonRpc.StartListening(); + Logger.Debug("Listening to websocket."); if (useMetaData) @@ -277,6 +330,64 @@ public async Task ConnectAsync(bool useMetaData, bool standardSubstrate, Cancell //_jsonRpc.TraceSource.Switch.Level = SourceLevels.All; } + private void OnJsonRpcDisconnected(object sender, JsonRpcDisconnectedEventArgs e) + { + Logger.Error(e.Exception, $"JsonRpc disconnected: {e.Reason}"); + + // Attempt to reconnect asynchronously + _ = Task.Run(async () => + { + Console.WriteLine("JsonRpc disconnected attempting to reconnect..."); + await ReconnectAsync(); + }); + } + + private readonly SemaphoreSlim _reconnectSemaphore = new SemaphoreSlim(1, 1); + + private async Task ReconnectAsync() + { + if (!await _reconnectSemaphore.WaitAsync(0)) + { + // Another reconnection attempt is already in progress + return; + } + + for (int retry = 1; retry <= _maxRetryAttempts; retry++) + { + try + { + Logger.Information("Attempting to reconnect..."); + + // You may need to store the parameters used during the initial connection + await ConnectAsync( + useMetaData: true, + standardSubstrate: true, + maxRetryAttempts: _maxRetryAttempts, + delayRetryMilliseconds: _delayRetryMilliseconds, + token: CancellationToken.None + ); + + Logger.Information("Reconnected successfully."); + } + catch (Exception ex) + { + Logger.Warning(ex, $"Reconnection attempt {retry} failed."); + if (retry == _maxRetryAttempts) + { + Logger.Error("Max reconnection attempts reached. Unable to reconnect."); + throw; + } + + await Task.Delay(_delayRetryMilliseconds * retry, CancellationToken.None); + } + finally + { + _reconnectSemaphore.Release(); + + } + } + } + /// /// Gets the storage asynchronous for generated code. /// @@ -487,10 +598,19 @@ protected virtual void Dispose(bool disposing) _connectTokenSource?.Dispose(); // dispose remaining request tokens - foreach (var key in _requestTokenSourceDict.Keys) key?.Dispose(); + foreach (var key in _requestTokenSourceDict.Keys) + { + key?.Dispose(); + } + _requestTokenSourceDict.Clear(); - _jsonRpc?.Dispose(); + if (_jsonRpc != null) + { + _jsonRpc.Disconnected -= OnJsonRpcDisconnected; + _jsonRpc.Dispose(); + } + _socket?.Dispose(); Logger.Debug("Client disposed."); } diff --git a/SubstrateNetApi.sln b/SubstrateNetApi.sln index bfcb753..fa92792 100644 --- a/SubstrateNetApi.sln +++ b/SubstrateNetApi.sln @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Substrate.NetApi", "Substra EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Substrate.NetApi.TestNode", "Substrate.NetApi.TestNode\Substrate.NetApi.TestNode.csproj", "{1866CE09-C874-4E65-A443-49DCBFC583A1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Substrate.NetApi.Console", "Substrate.NetApi.Console\Substrate.NetApi.Console.csproj", "{78AD3039-CDC8-479C-A91E-494998510AD2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +43,14 @@ Global {1866CE09-C874-4E65-A443-49DCBFC583A1}.Release|Any CPU.Build.0 = Release|Any CPU {1866CE09-C874-4E65-A443-49DCBFC583A1}.Release|x64.ActiveCfg = Release|Any CPU {1866CE09-C874-4E65-A443-49DCBFC583A1}.Release|x64.Build.0 = Release|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Debug|x64.ActiveCfg = Debug|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Debug|x64.Build.0 = Debug|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Release|Any CPU.Build.0 = Release|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Release|x64.ActiveCfg = Release|Any CPU + {78AD3039-CDC8-479C-A91E-494998510AD2}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE