/// <summary>
        /// Serializes a value as inline
        /// </summary>
        private int SerializeInlineValue(object obj, TypeModel typeModel)
        {
            switch (typeModel.BaseType)
            {
            case BaseType.Bool:
            {
                _builder.AddBool((bool)obj);
                break;
            }

            case BaseType.Char:
            {
                _builder.AddSbyte((sbyte)obj);
                break;
            }

            case BaseType.UChar:
            {
                _builder.AddByte((byte)obj);
                break;
            }

            case BaseType.Short:
            {
                _builder.AddShort((short)obj);
                break;
            }

            case BaseType.UShort:
            {
                _builder.AddUshort((ushort)obj);
                break;
            }

            case BaseType.Int:
            {
                _builder.AddInt((int)obj);
                break;
            }

            case BaseType.UInt:
            {
                _builder.AddUint((uint)obj);
                break;
            }

            case BaseType.Long:
            {
                _builder.AddLong((long)obj);
                break;
            }

            case BaseType.ULong:
            {
                _builder.AddUlong((ulong)obj);
                break;
            }

            case BaseType.Float:
            {
                _builder.AddFloat((float)obj);
                break;
            }

            case BaseType.Double:
            {
                _builder.AddDouble((double)obj);
                break;
            }

            case BaseType.Struct:
            {
                return(SerializeStruct(obj, typeModel));
            }

            default:
            {
                throw new InvalidOperationException();
            }
            }
            return(_builder.Offset);
        }
Esempio n. 2
0
 public static void AddIdentifier(FlatBufferBuilder builder, ulong identifier)
 {
     builder.AddUlong(0, identifier, 0);
 }
Esempio n. 3
0
 public static void AddTesthashu64Fnv1(FlatBufferBuilder builder, ulong testhashu64Fnv1)
 {
     builder.AddUlong(19, testhashu64Fnv1, 0);
 }
Esempio n. 4
0
 public static void AddTesthashu64Fnv1a(FlatBufferBuilder builder, ulong testhashu64Fnv1a)
 {
     builder.AddUlong(23, testhashu64Fnv1a, 0);
 }
Esempio n. 5
0
 public static void AddTrackingId(FlatBufferBuilder builder, ulong trackingId)
 {
     builder.AddUlong(0, trackingId, 0);
 }