Example #1
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteByte ((byte)Type);
     aStream.WriteInt (X);
     aStream.WriteInt (Y);
     aStream.WriteInt (Z);
 }
Example #2
0
 public override void Serialize(Stream stream, Type type, object value)
 {
     var array = value as Array;
     var elementType = type.GetElementType();
     stream.WriteInt(array.Length);
     for (int i = 0; i < array.Length; i++)
         ctx.Serializer.Serialize_Main(stream, elementType, array.GetValue(i));
 }
        public override void Serialize(Stream stream, Type type, object value)
        {
            var collection = (ICollection)value;
            Type elementType = GetElementType(type);
            stream.WriteInt(collection.Count);

            foreach (var item in collection)
                ctx.Serializer.Serialize_Main(stream, elementType, item);
        }
Example #4
0
 public static void Stream(IEnumerable<HashBlock> hashBlocks, Stream outputStream)
 {
     outputStream.WriteUInt((uint) hashBlocks.Count());
     foreach (HashBlock block in hashBlocks)
     {
         outputStream.Write(block.Hash, 0, 16);
         outputStream.WriteInt(block.Length);
         outputStream.WriteLong(block.Offset);
         outputStream.WriteUInt(block.Checksum);
     }
 }
Example #5
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (X);
     aStream.WriteByte (Y);
     aStream.WriteInt (Z);
     aStream.WriteByte ((byte)Direction);
     aStream.WriteShort (ItemID);
     if (ItemID >= 0) {
         aStream.WriteByte (Amount);
         aStream.WriteShort (Damage);
     }
 }
Example #6
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteShort (Slot);
     aStream.WriteShort (ItemID);
     aStream.WriteShort (Damage);
 }
Example #7
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (CollectedEID);
     aStream.WriteInt (CollectorEID);
 }
Example #8
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (UserID);
     aStream.WriteInt (TargetID);
     aStream.WriteBoolean (LeftClick);
 }
Example #9
0
        /// <summary>
        /// Writes the query parameters.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        protected void WriteQueryParameters(Stream buffer)
        {
            buffer.WriteConsistency(CqlConsistency);

            var flags = (byte)((Parameters != null ? 1 : 0) |
                               (SkipMetaData ? 2 : 0) |
                               (PageSize.HasValue ? 4 : 0) |
                               (PagingState != null ? 8 : 0) |
                               (SerialConsistency.HasValue ? 16 : 0) |
                               (ProtocolVersion >= 3 && Timestamp.HasValue ? 32 : 0));

            buffer.WriteByte(flags);

            if(Parameters != null)
            {
                buffer.WriteShort((ushort)Parameters.Count);
                foreach(var value in Parameters)
                    buffer.WriteByteArray(value);
            }

            if(PageSize.HasValue)
                buffer.WriteInt(PageSize.Value);

            if(PagingState != null)
                buffer.WriteByteArray(PagingState);

            if(SerialConsistency.HasValue)
                buffer.WriteShort((ushort)SerialConsistency.Value);

            if(ProtocolVersion >= 3 && Timestamp.HasValue)
                buffer.WriteLong(Timestamp.Value.ToTimestamp()*1000); //convert milliseconds to microseconds
        }
Example #10
0
 private void SendCopyDelta(CopyDelta delta, Stream inputStream, Stream outputStream)
 {
     if (inputStream.CanSeek == false) throw new IOException("inputStream not seekable");
     outputStream.WriteByte(DeltaStreamConstants.COPY_BLOCK_START_MARKER);
     outputStream.WriteLong(delta.Offset);
     outputStream.WriteInt(delta.Length);
     inputStream.Seek(delta.Length, SeekOrigin.Current);
 }
Example #11
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteByte (Animate);
 }
Example #12
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteShort(VelX);
     aStream.WriteShort (VelY);
     aStream.WriteShort (VelZ);
 }
Example #13
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteString16 (Title);
     aStream.WriteInt (X);
     aStream.WriteInt (Y);
     aStream.WriteInt (Z);
     aStream.WriteInt (Direction);
 }
Example #14
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt(VehicleID);
 }
Example #15
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteShort (ItemID);
     aStream.WriteByte (Count);
     aStream.WriteShort (DamageData);
     aStream.WriteInt (X);
     aStream.WriteInt (Y);
     aStream.WriteInt (Z);
     aStream.WriteByte (Rotation);
     aStream.WriteByte (Pitch);
     aStream.WriteByte (Roll);
 }
Example #16
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteString16 (PlayerName);
     aStream.WriteInt (X);
     aStream.WriteInt (Y);
     aStream.WriteInt (Z);
     aStream.WriteByte (Rotation);
     aStream.WriteByte (Pitch);
     aStream.WriteShort (CurrentItem);
 }
Example #17
0
        public override void WriteTo(Stream stream, bool writeType, bool writeName)
        {
            base.WriteTo(stream, writeType, writeName);

            stream.WriteByte(ItemType);
            stream.WriteInt(Length);

            for (int i = 0; i < Length; ++i)
            {
                Items[i].WriteTo(stream, false, false);
            }
        }
Example #18
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt(X);
     aStream.WriteInt (Y);
     aStream.WriteInt (Z);
     aStream.WriteByte (Yaw);
     aStream.WriteByte (Pitch);
 }
Example #19
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteByte ((byte)Status);
     aStream.WriteInt (X);
     aStream.WriteByte (Y);
     aStream.WriteInt (Z);
     aStream.WriteByte ((byte)Face);
 }
Example #20
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     // write ID
     aStream.WriteInt (EntityID);
     aStream.WriteString16 (UserName);
     aStream.WriteLong (0);
     aStream.WriteByte (0);
 }
Example #21
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (X);
     aStream.WriteInt (Z);
     aStream.WriteBoolean(Mode);
 }
Example #22
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (X);
     aStream.WriteInt (Y);
     aStream.WriteInt (Z);
 }
Example #23
0
 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteByte (InBed);
     aStream.WriteInt (X);
     aStream.WriteByte (Y);
     aStream.WriteInt (Z);
 }
Example #24
0
 private void SendByteDelta(ByteDelta delta, Stream inputStream, Stream outputStream)
 {
     outputStream.WriteByte(DeltaStreamConstants.NEW_BLOCK_START_MARKER);
     outputStream.WriteInt(delta.Length);
     var buffer = new byte[delta.Length];
     inputStream.Seek(delta.Offset, SeekOrigin.Begin);
     long totalRead = 0;
     while (totalRead < delta.Length)
     {
         var toRead = (int) MathEx.Bounded(0, StreamChunkSize, delta.Length - totalRead);
         int readLength = inputStream.Read(buffer, 0, toRead);
         if (readLength == 0 && totalRead < delta.Length)
             throw new IOException("Input stream offset out of bounds, or not enough data available");
         outputStream.Write(buffer, 0, readLength);
         totalRead += readLength;
     }
 }
Example #25
0
 void EncodeDisp32(Stream buffer, byte constant)
 {
     if (indexReg != null) {
     buffer.WriteByte (CombineModRM (MOD_R32_PTR_DISP32, 0x04, constant));
     buffer.WriteByte (CombineSib (baseReg.Index, indexReg.Index, scale));
     } else {
     buffer.WriteByte (CombineModRM (MOD_R32_PTR_DISP32, baseReg.Index, constant));
     if (baseReg == ESP)
         buffer.WriteByte (0x24);
     }
     buffer.WriteInt (disp);
 }