support json serialization

This commit is contained in:
mugisoba
2020-02-04 00:49:17 +09:00
parent 6400c9b054
commit e8b7292dd1
33 changed files with 887 additions and 5 deletions

View File

@@ -47,7 +47,13 @@ public struct Ability : IFlatbufferObject
public class AbilityT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("id")]
#endif
public uint Id { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("distance")]
#endif
public uint Distance { get; set; }
public AbilityT() {

View File

@@ -5,6 +5,9 @@
namespace MyGame.Example
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
#endif
public enum Any : byte
{
NONE = 0,
@@ -37,5 +40,50 @@ public class AnyUnion {
}
}
#if ENABLE_JSON_SERIALIZATION
public class AnyUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(AnyUnion) || objectType == typeof(System.Collections.Generic.List<AnyUnion>);
}
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = value as System.Collections.Generic.List<AnyUnion>;
if (_olist != null) {
writer.WriteStartArray();
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
writer.WriteEndArray();
} else {
this.WriteJson(writer, value as AnyUnion, serializer);
}
}
public void WriteJson(Newtonsoft.Json.JsonWriter writer, AnyUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return;
serializer.Serialize(writer, _o.Value);
}
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = existingValue as System.Collections.Generic.List<AnyUnion>;
if (_olist != null) {
for (var _j = 0; _j < _olist.Count; ++_j) {
reader.Read();
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
}
reader.Read();
return _olist;
} else {
return this.ReadJson(reader, existingValue as AnyUnion, serializer);
}
}
public AnyUnion ReadJson(Newtonsoft.Json.JsonReader reader, AnyUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return null;
switch (_o.Type) {
default: break;
case Any.Monster: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
case Any.TestSimpleTableWithEnum: _o.Value = serializer.Deserialize<MyGame.Example.TestSimpleTableWithEnumT>(reader); break;
case Any.MyGame_Example2_Monster: _o.Value = serializer.Deserialize<MyGame.Example2.MonsterT>(reader); break;
}
return _o;
}
}
#endif
}

View File

@@ -5,6 +5,9 @@
namespace MyGame.Example
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
#endif
public enum AnyAmbiguousAliases : byte
{
NONE = 0,
@@ -37,5 +40,50 @@ public class AnyAmbiguousAliasesUnion {
}
}
#if ENABLE_JSON_SERIALIZATION
public class AnyAmbiguousAliasesUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(AnyAmbiguousAliasesUnion) || objectType == typeof(System.Collections.Generic.List<AnyAmbiguousAliasesUnion>);
}
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = value as System.Collections.Generic.List<AnyAmbiguousAliasesUnion>;
if (_olist != null) {
writer.WriteStartArray();
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
writer.WriteEndArray();
} else {
this.WriteJson(writer, value as AnyAmbiguousAliasesUnion, serializer);
}
}
public void WriteJson(Newtonsoft.Json.JsonWriter writer, AnyAmbiguousAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return;
serializer.Serialize(writer, _o.Value);
}
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = existingValue as System.Collections.Generic.List<AnyAmbiguousAliasesUnion>;
if (_olist != null) {
for (var _j = 0; _j < _olist.Count; ++_j) {
reader.Read();
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
}
reader.Read();
return _olist;
} else {
return this.ReadJson(reader, existingValue as AnyAmbiguousAliasesUnion, serializer);
}
}
public AnyAmbiguousAliasesUnion ReadJson(Newtonsoft.Json.JsonReader reader, AnyAmbiguousAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return null;
switch (_o.Type) {
default: break;
case AnyAmbiguousAliases.M1: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
case AnyAmbiguousAliases.M2: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
case AnyAmbiguousAliases.M3: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
}
return _o;
}
}
#endif
}

View File

@@ -5,6 +5,9 @@
namespace MyGame.Example
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
#endif
public enum AnyUniqueAliases : byte
{
NONE = 0,
@@ -37,5 +40,50 @@ public class AnyUniqueAliasesUnion {
}
}
#if ENABLE_JSON_SERIALIZATION
public class AnyUniqueAliasesUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(AnyUniqueAliasesUnion) || objectType == typeof(System.Collections.Generic.List<AnyUniqueAliasesUnion>);
}
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = value as System.Collections.Generic.List<AnyUniqueAliasesUnion>;
if (_olist != null) {
writer.WriteStartArray();
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
writer.WriteEndArray();
} else {
this.WriteJson(writer, value as AnyUniqueAliasesUnion, serializer);
}
}
public void WriteJson(Newtonsoft.Json.JsonWriter writer, AnyUniqueAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return;
serializer.Serialize(writer, _o.Value);
}
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = existingValue as System.Collections.Generic.List<AnyUniqueAliasesUnion>;
if (_olist != null) {
for (var _j = 0; _j < _olist.Count; ++_j) {
reader.Read();
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
}
reader.Read();
return _olist;
} else {
return this.ReadJson(reader, existingValue as AnyUniqueAliasesUnion, serializer);
}
}
public AnyUniqueAliasesUnion ReadJson(Newtonsoft.Json.JsonReader reader, AnyUniqueAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return null;
switch (_o.Type) {
default: break;
case AnyUniqueAliases.M: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
case AnyUniqueAliases.TS: _o.Value = serializer.Deserialize<MyGame.Example.TestSimpleTableWithEnumT>(reader); break;
case AnyUniqueAliases.M2: _o.Value = serializer.Deserialize<MyGame.Example2.MonsterT>(reader); break;
}
return _o;
}
}
#endif
}

View File

@@ -101,11 +101,29 @@ public struct ArrayStruct : IFlatbufferObject
public class ArrayStructT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("a")]
#endif
public float A { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("b")]
#endif
public int[] B { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("c")]
#endif
public sbyte C { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("d")]
#endif
public MyGame.Example.NestedStructT[] D { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("e")]
#endif
public int E { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("f")]
#endif
public long[] F { get; set; }
public ArrayStructT() {

View File

@@ -48,11 +48,23 @@ public struct ArrayTable : IFlatbufferObject
public class ArrayTableT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("a")]
#endif
public MyGame.Example.ArrayStructT A { get; set; }
public ArrayTableT() {
this.A = new MyGame.Example.ArrayStructT();
}
#if ENABLE_JSON_SERIALIZATION
public static ArrayTableT DeserializeFromJson(string jsonText) {
return Newtonsoft.Json.JsonConvert.DeserializeObject<ArrayTableT>(jsonText);
}
public string SerializeToJson() {
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
#endif
}

View File

@@ -6,6 +6,9 @@ namespace MyGame.Example
{
/// Composite components of Monster color.
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
#endif
[System.FlagsAttribute]
public enum Color : byte
{

View File

@@ -593,50 +593,232 @@ public struct Monster : IFlatbufferObject
public class MonsterT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("pos")]
#endif
public MyGame.Example.Vec3T Pos { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("mana")]
#endif
public short Mana { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("hp")]
#endif
public short Hp { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("name")]
#endif
public string Name { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("inventory")]
#endif
public List<byte> Inventory { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("color")]
#endif
public MyGame.Example.Color Color { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("test_type")]
private MyGame.Example.Any TestType {
get {
return this.Test != null ? this.Test.Type : MyGame.Example.Any.NONE;
}
set {
this.Test = new MyGame.Example.AnyUnion();
this.Test.Type = value;
}
}
[Newtonsoft.Json.JsonProperty("test")]
[Newtonsoft.Json.JsonConverter(typeof(MyGame.Example.AnyUnion_JsonConverter))]
#endif
public MyGame.Example.AnyUnion Test { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("test4")]
#endif
public List<MyGame.Example.TestT> Test4 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testarrayofstring")]
#endif
public List<string> Testarrayofstring { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testarrayoftables")]
#endif
public List<MyGame.Example.MonsterT> Testarrayoftables { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("enemy")]
#endif
public MyGame.Example.MonsterT Enemy { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testnestedflatbuffer")]
#endif
public List<byte> Testnestedflatbuffer { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testempty")]
#endif
public MyGame.Example.StatT Testempty { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testbool")]
#endif
public bool Testbool { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashs32_fnv1")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public int Testhashs32Fnv1 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashu32_fnv1")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public uint Testhashu32Fnv1 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashs64_fnv1")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public long Testhashs64Fnv1 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashu64_fnv1")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public ulong Testhashu64Fnv1 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashs32_fnv1a")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public int Testhashs32Fnv1a { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashu32_fnv1a")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public uint Testhashu32Fnv1a { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashs64_fnv1a")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public long Testhashs64Fnv1a { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testhashu64_fnv1a")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public ulong Testhashu64Fnv1a { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testarrayofbools")]
#endif
public List<bool> Testarrayofbools { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testf")]
#endif
public float Testf { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testf2")]
#endif
public float Testf2 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testf3")]
#endif
public float Testf3 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testarrayofstring2")]
#endif
public List<string> Testarrayofstring2 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("testarrayofsortedstruct")]
#endif
public List<MyGame.Example.AbilityT> Testarrayofsortedstruct { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("flex")]
#endif
public List<byte> Flex { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("test5")]
#endif
public List<MyGame.Example.TestT> Test5 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_longs")]
#endif
public List<long> VectorOfLongs { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_doubles")]
#endif
public List<double> VectorOfDoubles { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("parent_namespace_test")]
#endif
public MyGame.InParentNamespaceT ParentNamespaceTest { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_referrables")]
#endif
public List<MyGame.Example.ReferrableT> VectorOfReferrables { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("single_weak_reference")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public ulong SingleWeakReference { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_weak_references")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public List<ulong> VectorOfWeakReferences { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_strong_referrables")]
#endif
public List<MyGame.Example.ReferrableT> VectorOfStrongReferrables { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("co_owning_reference")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public ulong CoOwningReference { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_co_owning_references")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public List<ulong> VectorOfCoOwningReferences { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("non_owning_reference")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public ulong NonOwningReference { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_non_owning_references")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public List<ulong> VectorOfNonOwningReferences { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("any_unique_type")]
private MyGame.Example.AnyUniqueAliases AnyUniqueType {
get {
return this.AnyUnique != null ? this.AnyUnique.Type : MyGame.Example.AnyUniqueAliases.NONE;
}
set {
this.AnyUnique = new MyGame.Example.AnyUniqueAliasesUnion();
this.AnyUnique.Type = value;
}
}
[Newtonsoft.Json.JsonProperty("any_unique")]
[Newtonsoft.Json.JsonConverter(typeof(MyGame.Example.AnyUniqueAliasesUnion_JsonConverter))]
#endif
public MyGame.Example.AnyUniqueAliasesUnion AnyUnique { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("any_ambiguous_type")]
private MyGame.Example.AnyAmbiguousAliases AnyAmbiguousType {
get {
return this.AnyAmbiguous != null ? this.AnyAmbiguous.Type : MyGame.Example.AnyAmbiguousAliases.NONE;
}
set {
this.AnyAmbiguous = new MyGame.Example.AnyAmbiguousAliasesUnion();
this.AnyAmbiguous.Type = value;
}
}
[Newtonsoft.Json.JsonProperty("any_ambiguous")]
[Newtonsoft.Json.JsonConverter(typeof(MyGame.Example.AnyAmbiguousAliasesUnion_JsonConverter))]
#endif
public MyGame.Example.AnyAmbiguousAliasesUnion AnyAmbiguous { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vector_of_enums")]
#endif
public List<MyGame.Example.Color> VectorOfEnums { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("signed_enum")]
#endif
public MyGame.Example.Race SignedEnum { get; set; }
public MonsterT() {
@@ -686,6 +868,15 @@ public class MonsterT
this.VectorOfEnums = null;
this.SignedEnum = MyGame.Example.Race.None;
}
#if ENABLE_JSON_SERIALIZATION
public static MonsterT DeserializeFromJson(string jsonText) {
return Newtonsoft.Json.JsonConvert.DeserializeObject<MonsterT>(jsonText);
}
public string SerializeToJson() {
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
#endif
}

View File

@@ -70,9 +70,21 @@ public struct NestedStruct : IFlatbufferObject
public class NestedStructT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("a")]
#endif
public int[] A { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("b")]
#endif
public MyGame.Example.TestEnum B { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("c")]
#endif
public MyGame.Example.TestEnum[] C { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("d")]
#endif
public long[] D { get; set; }
public NestedStructT() {

View File

@@ -5,6 +5,9 @@
namespace MyGame.Example
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
#endif
public enum Race : sbyte
{
None = -1,

View File

@@ -78,6 +78,10 @@ public struct Referrable : IFlatbufferObject
public class ReferrableT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("id")]
[Newtonsoft.Json.JsonIgnore()]
#endif
public ulong Id { get; set; }
public ReferrableT() {

View File

@@ -73,8 +73,17 @@ public struct Stat : IFlatbufferObject
public class StatT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("id")]
#endif
public string Id { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("val")]
#endif
public long Val { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("count")]
#endif
public ushort Count { get; set; }
public StatT() {

View File

@@ -48,7 +48,13 @@ public struct Test : IFlatbufferObject
public class TestT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("a")]
#endif
public short A { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("b")]
#endif
public sbyte B { get; set; }
public TestT() {

View File

@@ -5,6 +5,9 @@
namespace MyGame.Example
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
#endif
public enum TestEnum : sbyte
{
A = 0,

View File

@@ -53,6 +53,9 @@ internal partial struct TestSimpleTableWithEnum : IFlatbufferObject
internal partial class TestSimpleTableWithEnumT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("color")]
#endif
public MyGame.Example.Color Color { get; set; }
public TestSimpleTableWithEnumT() {

View File

@@ -162,17 +162,53 @@ public struct TypeAliases : IFlatbufferObject
public class TypeAliasesT
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("i8")]
#endif
public sbyte I8 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("u8")]
#endif
public byte U8 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("i16")]
#endif
public short I16 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("u16")]
#endif
public ushort U16 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("i32")]
#endif
public int I32 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("u32")]
#endif
public uint U32 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("i64")]
#endif
public long I64 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("u64")]
#endif
public ulong U64 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("f32")]
#endif
public float F32 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("f64")]
#endif
public double F64 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("v8")]
#endif
public List<sbyte> V8 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("vf64")]
#endif
public List<double> Vf64 { get; set; }
public TypeAliasesT() {

View File

@@ -73,11 +73,29 @@ public struct Vec3 : IFlatbufferObject
public class Vec3T
{
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("x")]
#endif
public float X { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("y")]
#endif
public float Y { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("z")]
#endif
public float Z { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("test1")]
#endif
public double Test1 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("test2")]
#endif
public MyGame.Example.Color Test2 { get; set; }
#if ENABLE_JSON_SERIALIZATION
[Newtonsoft.Json.JsonProperty("test3")]
#endif
public MyGame.Example.TestT Test3 { get; set; }
public Vec3T() {