Esempio n. 1
0
 public static Offset<StructInNestedNS> CreateStructInNestedNS(FlatBufferBuilder builder, int A, int B)
 {
     builder.Prep(4, 8);
     builder.PutInt(B);
     builder.PutInt(A);
     return new Offset<StructInNestedNS>(builder.Offset);
 }
Esempio n. 2
0
 public static int CreateTest(FlatBufferBuilder builder, short A, sbyte B) {
   builder.Prep(2, 4);
   builder.Pad(1);
   builder.PutSbyte(B);
   builder.PutShort(A);
   return builder.Offset();
 }
Esempio n. 3
0
 public static int CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, Color Test2, short Test_A, sbyte Test_B) {
   builder.Prep(16, 32);
   builder.Pad(2);
   builder.Prep(2, 4);
   builder.Pad(1);
   builder.PutSbyte(Test_B);
   builder.PutShort(Test_A);
   builder.Pad(1);
   builder.PutSbyte((sbyte)(Test2));
   builder.PutDouble(Test1);
   builder.Pad(4);
   builder.PutFloat(Z);
   builder.PutFloat(Y);
   builder.PutFloat(X);
   return builder.Offset();
 }
        private int SerializeStruct(object obj, TypeModel typeModel)
        {
            var structDef = typeModel.StructDef;

            if (structDef.IsFixed)
            {
                _builder.Prep(structDef.MinAlign, structDef.ByteSize);
                foreach (var field in structDef.Fields.Reverse())
                {
                    SerializeStructField(obj, structDef, field);
                }
            }
            else
            {
                _builder.StartObject(structDef.FieldCount);

                var enumerable = structDef.UseOriginalOrdering
                    ? structDef.Fields
                    : structDef.Fields.OrderByDescending(i => i.TypeModel.InlineSize);

                foreach (var field in enumerable)
                {
                    SerializeStructField(obj, structDef, field);
                }
                return(_builder.EndObject());
            }
            return(_builder.Offset);
        }
Esempio n. 5
0
 public static Offset<Vec3> CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, Color Test2, short test3_A, sbyte test3_B) {
   builder.Prep(16, 32);
   builder.Pad(2);
   builder.Prep(2, 4);
   builder.Pad(1);
   builder.PutSbyte(test3_B);
   builder.PutShort(test3_A);
   builder.Pad(1);
   builder.PutSbyte((sbyte)(Test2));
   builder.PutDouble(Test1);
   builder.Pad(4);
   builder.PutFloat(Z);
   builder.PutFloat(Y);
   builder.PutFloat(X);
   return new Offset<Vec3>(builder.Offset);
 }
Esempio n. 6
0
 public static Offset<Test> CreateTest(FlatBufferBuilder builder, short A, sbyte B) {
   builder.Prep(2, 4);
   builder.Pad(1);
   builder.PutSbyte(B);
   builder.PutShort(A);
   return new Offset<Test>(builder.Offset);
 }
Esempio n. 7
0
 public static int CreateListModuleEntry(FlatBufferBuilder builder, uint Handle, uint FunctionCount)
 {
     builder.Prep(4, 8);
     builder.PutUint(FunctionCount);
     builder.PutUint(Handle);
     return builder.Offset;
 }
Esempio n. 8
0
 public static Offset<Area> CreateArea(FlatBufferBuilder builder, float Largura, float Comprimento)
 {
     builder.Prep(4, 8);
     builder.PutFloat(Comprimento);
     builder.PutFloat(Largura);
     return new Offset<Area>(builder.Offset);
 }
Esempio n. 9
0
 public static int CreateXObject(FlatBufferBuilder builder, uint Handle)
 {
     builder.Prep(4, 4);
     builder.PutUint(Handle);
     return builder.Offset;
 }
Esempio n. 10
0
 public static int CreateBreakpoint(FlatBufferBuilder builder, uint BreakpointId)
 {
     builder.Prep(4, 4);
     builder.PutUint(BreakpointId);
     return builder.Offset;
 }