-
-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the last bug with solution build
- Loading branch information
Showing
5 changed files
with
204 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...PackObjects_Array/Formatters.MessagePack.GeneratedMessagePackResolver.A.B.CFormatter.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// <auto-generated /> | ||
|
||
#pragma warning disable 618, 612, 414, 168, CS1591, SA1129, SA1309, SA1312, SA1403, SA1649 | ||
|
||
#pragma warning disable CS8669 // We may leak nullable annotations into generated code. | ||
|
||
using MsgPack = global::MessagePack; | ||
|
||
namespace MessagePack { | ||
partial class GeneratedMessagePackResolver { | ||
internal partial class A { | ||
internal partial class B { | ||
|
||
internal sealed class CFormatter : MsgPack::Formatters.IMessagePackFormatter<global::A.B.C> | ||
{ | ||
|
||
public void Serialize(ref MsgPack::MessagePackWriter writer, global::A.B.C value, MsgPack::MessagePackSerializerOptions options) | ||
{ | ||
if (value == null) | ||
{ | ||
writer.WriteNil(); | ||
return; | ||
} | ||
|
||
writer.WriteArrayHeader(0); | ||
} | ||
|
||
public global::A.B.C Deserialize(ref MsgPack::MessagePackReader reader, MsgPack::MessagePackSerializerOptions options) | ||
{ | ||
if (reader.TryReadNil()) | ||
{ | ||
return null; | ||
} | ||
|
||
reader.Skip(); | ||
return new global::A.B.C(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...gePackObjects_Array/Formatters.MessagePack.GeneratedMessagePackResolver.A.BFormatter.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// <auto-generated /> | ||
|
||
#pragma warning disable 618, 612, 414, 168, CS1591, SA1129, SA1309, SA1312, SA1403, SA1649 | ||
|
||
#pragma warning disable CS8669 // We may leak nullable annotations into generated code. | ||
|
||
using MsgPack = global::MessagePack; | ||
|
||
namespace MessagePack { | ||
partial class GeneratedMessagePackResolver { | ||
internal partial class A { | ||
|
||
internal sealed class BFormatter : MsgPack::Formatters.IMessagePackFormatter<global::A.B> | ||
{ | ||
|
||
public void Serialize(ref MsgPack::MessagePackWriter writer, global::A.B value, MsgPack::MessagePackSerializerOptions options) | ||
{ | ||
if (value == null) | ||
{ | ||
writer.WriteNil(); | ||
return; | ||
} | ||
|
||
MsgPack::IFormatterResolver formatterResolver = options.Resolver; | ||
writer.WriteArrayHeader(1); | ||
MsgPack::FormatterResolverExtensions.GetFormatterWithVerify<global::A.B.C[]>(formatterResolver).Serialize(ref writer, value.array, options); | ||
} | ||
|
||
public global::A.B Deserialize(ref MsgPack::MessagePackReader reader, MsgPack::MessagePackSerializerOptions options) | ||
{ | ||
if (reader.TryReadNil()) | ||
{ | ||
return null; | ||
} | ||
|
||
options.Security.DepthStep(ref reader); | ||
MsgPack::IFormatterResolver formatterResolver = options.Resolver; | ||
var length = reader.ReadArrayHeader(); | ||
var ____result = new global::A.B(); | ||
|
||
for (int i = 0; i < length; i++) | ||
{ | ||
switch (i) | ||
{ | ||
case 0: | ||
____result.array = MsgPack::FormatterResolverExtensions.GetFormatterWithVerify<global::A.B.C[]>(formatterResolver).Deserialize(ref reader, options); | ||
break; | ||
default: | ||
reader.Skip(); | ||
break; | ||
} | ||
} | ||
|
||
reader.Depth--; | ||
return ____result; | ||
} | ||
} | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...ts/Resources/NestedMessagePackObjects_Array/MessagePack.GeneratedMessagePackResolver.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// <auto-generated /> | ||
|
||
#pragma warning disable 618, 612, 414, 168, CS1591, SA1129, SA1309, SA1312, SA1403, SA1649 | ||
|
||
using MsgPack = global::MessagePack; | ||
|
||
[assembly: MsgPack::Internal.GeneratedAssemblyMessagePackResolverAttribute(typeof(MessagePack.GeneratedMessagePackResolver), 3, 0)] | ||
|
||
namespace MessagePack { | ||
|
||
/// <summary>A MessagePack resolver that uses generated formatters for types in this assembly.</summary> | ||
partial class GeneratedMessagePackResolver : MsgPack::IFormatterResolver | ||
{ | ||
/// <summary>An instance of this resolver that only returns formatters specifically generated for types in this assembly.</summary> | ||
public static readonly MsgPack::IFormatterResolver Instance = new GeneratedMessagePackResolver(); | ||
|
||
private GeneratedMessagePackResolver() | ||
{ | ||
} | ||
|
||
public MsgPack::Formatters.IMessagePackFormatter<T> GetFormatter<T>() | ||
{ | ||
return FormatterCache<T>.Formatter; | ||
} | ||
|
||
private static class FormatterCache<T> | ||
{ | ||
internal static readonly MsgPack::Formatters.IMessagePackFormatter<T> Formatter; | ||
|
||
static FormatterCache() | ||
{ | ||
var f = GeneratedMessagePackResolverGetFormatterHelper.GetFormatter(typeof(T)); | ||
if (f != null) | ||
{ | ||
Formatter = (MsgPack::Formatters.IMessagePackFormatter<T>)f; | ||
} | ||
} | ||
} | ||
|
||
private static class GeneratedMessagePackResolverGetFormatterHelper | ||
{ | ||
private static readonly global::System.Collections.Generic.Dictionary<global::System.Type, int> closedTypeLookup = new(3) | ||
{ | ||
{ typeof(global::A.B.C[]), 0 }, | ||
{ typeof(global::A.B.C), 1 }, | ||
{ typeof(global::A.B), 2 }, | ||
}; | ||
|
||
internal static object GetFormatter(global::System.Type t) | ||
{ | ||
if (closedTypeLookup.TryGetValue(t, out int closedKey)) | ||
{ | ||
return closedKey switch | ||
{ | ||
0 => new MsgPack::Formatters.ArrayFormatter<global::A.B.C>(), | ||
1 => new global::MessagePack.GeneratedMessagePackResolver.A.B.CFormatter(), | ||
2 => new global::MessagePack.GeneratedMessagePackResolver.A.BFormatter(), | ||
_ => null, // unreachable | ||
}; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} | ||
|
||
} |