Ejemplo n.º 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);
 }
Ejemplo 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);
 }
Ejemplo n.º 3
0
 public int Marshal(byte[] b, int n)
 {
     if (this.IntPtr != null)
     {
         b[n++] = 1;
         Gobuf.WriteVarint(this.IntPtr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.UintPtr != null)
     {
         b[n++] = 1;
         Gobuf.WriteUvarint(this.UintPtr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Int8Ptr != null)
     {
         b[n++] = 1;
         b[n++] = (byte)this.Int8Ptr.Value;
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Uint8Ptr != null)
     {
         b[n++] = 1;
         b[n++] = (byte)this.Uint8Ptr.Value;
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Int16Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteUint16((ushort)this.Int16Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Uint16Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteUint16((ushort)this.Uint16Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Int32Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteUint32((uint)this.Int32Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Uint32Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteUint32((uint)this.Uint32Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Int64Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteUint64((ulong)this.Int64Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Uint64Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteUint64((ulong)this.Uint64Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Float32Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteFloat32(this.Float32Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.Float64Ptr != null)
     {
         b[n++] = 1;
         Gobuf.WriteFloat64(this.Float64Ptr.Value, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.StringPtr != null)
     {
         b[n++] = 1;
         Gobuf.WriteString(this.StringPtr, b, ref n);
     }
     else
     {
         b[n++] = 0;
     }
     if (this.BoolPtr != null)
     {
         b[n++] = 1;
         b[n++] = this.BoolPtr.Value ? (byte)1 : (byte)0;
     }
     else
     {
         b[n++] = 0;
     }
     return(n);
 }
Ejemplo n.º 4
0
 public int Marshal(byte[] b, int n)
 {
     Gobuf.WriteUvarint((ulong)this.IntMap.Count, b, ref n);
     foreach (var item1 in this.IntMap)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteVarint(item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.UintMap.Count, b, ref n);
     foreach (var item1 in this.UintMap)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteUvarint(item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Int8Map.Count, b, ref n);
     foreach (var item1 in this.Int8Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         b[n++] = (byte)item1.Value;
     }
     Gobuf.WriteUvarint((ulong)this.Uint8Map.Count, b, ref n);
     foreach (var item1 in this.Uint8Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         b[n++] = (byte)item1.Value;
     }
     Gobuf.WriteUvarint((ulong)this.Int16Map.Count, b, ref n);
     foreach (var item1 in this.Int16Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteUint16((ushort)item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Uint16Map.Count, b, ref n);
     foreach (var item1 in this.Uint16Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteUint16((ushort)item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Int32Map.Count, b, ref n);
     foreach (var item1 in this.Int32Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteUint32((uint)item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Uint32Map.Count, b, ref n);
     foreach (var item1 in this.Uint32Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteUint32((uint)item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Int64Map.Count, b, ref n);
     foreach (var item1 in this.Int64Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteUint64((ulong)item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Uint64Map.Count, b, ref n);
     foreach (var item1 in this.Uint64Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteUint64((ulong)item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Float32Map.Count, b, ref n);
     foreach (var item1 in this.Float32Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteFloat32(item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.Float64Map.Count, b, ref n);
     foreach (var item1 in this.Float64Map)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteFloat64(item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.StringMap.Count, b, ref n);
     foreach (var item1 in this.StringMap)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         Gobuf.WriteString(item1.Value, b, ref n);
     }
     Gobuf.WriteUvarint((ulong)this.BoolMap.Count, b, ref n);
     foreach (var item1 in this.BoolMap)
     {
         Gobuf.WriteVarint(item1.Key, b, ref n);
         b[n++] = item1.Value ? (byte)1 : (byte)0;
     }
     return(n);
 }