예제 #1
0
 public int Marshal(byte[] b, int n)
 {
     for (var i1 = 0; i1 < this.IntArray.Length; i1++)
     {
         Gobuf.WriteVarint(this.IntArray[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.UintArray.Length; i1++)
     {
         Gobuf.WriteUvarint(this.UintArray[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Int8Array.Length; i1++)
     {
         b[n++] = (byte)this.Int8Array[i1];
     }
     Gobuf.WriteBytes(this.Uint8Array, b, ref n);
     for (var i1 = 0; i1 < this.Int16Array.Length; i1++)
     {
         Gobuf.WriteUint16((ushort)this.Int16Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Uint16Array.Length; i1++)
     {
         Gobuf.WriteUint16((ushort)this.Uint16Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Int32Array.Length; i1++)
     {
         Gobuf.WriteUint32((uint)this.Int32Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Uint32Array.Length; i1++)
     {
         Gobuf.WriteUint32((uint)this.Uint32Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Int64Array.Length; i1++)
     {
         Gobuf.WriteUint64((ulong)this.Int64Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Uint64Array.Length; i1++)
     {
         Gobuf.WriteUint64((ulong)this.Uint64Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Float32Array.Length; i1++)
     {
         Gobuf.WriteFloat32(this.Float32Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.Float64Array.Length; i1++)
     {
         Gobuf.WriteFloat64(this.Float64Array[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.StringArray.Length; i1++)
     {
         Gobuf.WriteString(this.StringArray[i1], b, ref n);
     }
     for (var i1 = 0; i1 < this.BoolArray.Length; i1++)
     {
         b[n++] = this.BoolArray[i1] ? (byte)1 : (byte)0;
     }
     return(n);
 }
예제 #2
0
 public int Marshal(byte[] b, int n)
 {
     b[n++] = (byte)this.Byte;
     Gobuf.WriteVarint(this.Int, b, ref n);
     Gobuf.WriteUvarint(this.Uint, b, ref n);
     b[n++] = (byte)this.Int8;
     b[n++] = (byte)this.Uint8;
     Gobuf.WriteUint16((ushort)this.Int16, b, ref n);
     Gobuf.WriteUint16((ushort)this.Uint16, b, ref n);
     Gobuf.WriteUint32((uint)this.Int32, b, ref n);
     Gobuf.WriteUint32((uint)this.Uint32, b, ref n);
     Gobuf.WriteUint64((ulong)this.Int64, b, ref n);
     Gobuf.WriteUint64((ulong)this.Uint64, b, ref n);
     Gobuf.WriteFloat32(this.Float32, b, ref n);
     Gobuf.WriteFloat64(this.Float64, b, ref n);
     Gobuf.WriteString(this.String, b, ref n);
     Gobuf.WriteBytes(this.Bytes, b, ref n);
     b[n++] = this.Bool ? (byte)1 : (byte)0;
     return(n);
 }