1 // <auto-generated> 2 // automatically generated by the FlatBuffers compiler, do not modify 3 // </auto-generated> 4 5 namespace KeywordTest 6 { 7 8 [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] 9 public enum KeywordsInUnion : byte 10 { 11 NONE = 0, 12 @static = 1, 13 @internal = 2, 14 }; 15 16 public class KeywordsInUnionUnion { 17 public KeywordsInUnion Type { get; set; } 18 public object Value { get; set; } 19 KeywordsInUnionUnion()20 public KeywordsInUnionUnion() { 21 this.Type = KeywordsInUnion.NONE; 22 this.Value = null; 23 } 24 25 public T As<T>() where T : class { return this.Value as T; } Asstatic()26 public KeywordTest.KeywordsInTableT Asstatic() { return this.As<KeywordTest.KeywordsInTableT>(); } Fromstatic(KeywordTest.KeywordsInTableT _static)27 public static KeywordsInUnionUnion Fromstatic(KeywordTest.KeywordsInTableT _static) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.@static, Value = _static }; } Asinternal()28 public KeywordTest.KeywordsInTableT Asinternal() { return this.As<KeywordTest.KeywordsInTableT>(); } Frominternal(KeywordTest.KeywordsInTableT _internal)29 public static KeywordsInUnionUnion Frominternal(KeywordTest.KeywordsInTableT _internal) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.@internal, Value = _internal }; } 30 Pack(Google.FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o)31 public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) { 32 switch (_o.Type) { 33 default: return 0; 34 case KeywordsInUnion.@static: return KeywordTest.KeywordsInTable.Pack(builder, _o.Asstatic()).Value; 35 case KeywordsInUnion.@internal: return KeywordTest.KeywordsInTable.Pack(builder, _o.Asinternal()).Value; 36 } 37 } 38 } 39 40 public class KeywordsInUnionUnion_JsonConverter : Newtonsoft.Json.JsonConverter { CanConvert(System.Type objectType)41 public override bool CanConvert(System.Type objectType) { 42 return objectType == typeof(KeywordsInUnionUnion) || objectType == typeof(System.Collections.Generic.List<KeywordsInUnionUnion>); 43 } WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer)44 public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) { 45 var _olist = value as System.Collections.Generic.List<KeywordsInUnionUnion>; 46 if (_olist != null) { 47 writer.WriteStartArray(); 48 foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); } 49 writer.WriteEndArray(); 50 } else { 51 this.WriteJson(writer, value as KeywordsInUnionUnion, serializer); 52 } 53 } WriteJson(Newtonsoft.Json.JsonWriter writer, KeywordsInUnionUnion _o, Newtonsoft.Json.JsonSerializer serializer)54 public void WriteJson(Newtonsoft.Json.JsonWriter writer, KeywordsInUnionUnion _o, Newtonsoft.Json.JsonSerializer serializer) { 55 if (_o == null) return; 56 serializer.Serialize(writer, _o.Value); 57 } ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)58 public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) { 59 var _olist = existingValue as System.Collections.Generic.List<KeywordsInUnionUnion>; 60 if (_olist != null) { 61 for (var _j = 0; _j < _olist.Count; ++_j) { 62 reader.Read(); 63 _olist[_j] = this.ReadJson(reader, _olist[_j], serializer); 64 } 65 reader.Read(); 66 return _olist; 67 } else { 68 return this.ReadJson(reader, existingValue as KeywordsInUnionUnion, serializer); 69 } 70 } ReadJson(Newtonsoft.Json.JsonReader reader, KeywordsInUnionUnion _o, Newtonsoft.Json.JsonSerializer serializer)71 public KeywordsInUnionUnion ReadJson(Newtonsoft.Json.JsonReader reader, KeywordsInUnionUnion _o, Newtonsoft.Json.JsonSerializer serializer) { 72 if (_o == null) return null; 73 switch (_o.Type) { 74 default: break; 75 case KeywordsInUnion.@static: _o.Value = serializer.Deserialize<KeywordTest.KeywordsInTableT>(reader); break; 76 case KeywordsInUnion.@internal: _o.Value = serializer.Deserialize<KeywordTest.KeywordsInTableT>(reader); break; 77 } 78 return _o; 79 } 80 } 81 82 83 84 static public class KeywordsInUnionVerify 85 { Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)86 static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos) 87 { 88 bool result = true; 89 switch((KeywordsInUnion)typeId) 90 { 91 case KeywordsInUnion.@static: 92 result = KeywordTest.KeywordsInTableVerify.Verify(verifier, tablePos); 93 break; 94 case KeywordsInUnion.@internal: 95 result = KeywordTest.KeywordsInTableVerify.Verify(verifier, tablePos); 96 break; 97 default: result = true; 98 break; 99 } 100 return result; 101 } 102 } 103 104 105 } 106