public static void WriteInt32(NetworkBinaryWriter writer, int value)
 {
     writer.Write((byte)StreamWireFormattingTag.Int32);
     writer.Write(value);
 }
Beispiel #2
0
 public static byte[] Contents(NetworkBinaryWriter w)
 {
     return(((MemoryStream)w.BaseStream).ToArray());
 }
Beispiel #3
0
 public static void WriteLonglong(NetworkBinaryWriter writer, ulong val)
 {
     writer.Write(val);
 }
Beispiel #4
0
 public static void WriteDouble(NetworkBinaryWriter writer, double value)
 {
     writer.Write(value);
 }
Beispiel #5
0
 public static void WriteBytes(NetworkBinaryWriter writer, byte[] source)
 {
     Write(writer, source, 0, source.Length);
 }
Beispiel #6
0
 public static void WriteByte(NetworkBinaryWriter writer, byte value)
 {
     writer.Write(value);
 }
Beispiel #7
0
 public static void WriteInt64(NetworkBinaryWriter writer, long value)
 {
     writer.Write(value);
 }
Beispiel #8
0
 public OutboundFrame(FrameType type, int channel) : base(type, channel)
 {
     m_accumulator = new MemoryStream();
     writer        = new NetworkBinaryWriter(m_accumulator);
 }
 public void WriteTo(NetworkBinaryWriter writer, ulong bodySize)
 {
     writer.Write((ushort)0); // weight - not currently used
     writer.Write((ulong)bodySize);
     WritePropertiesTo(new ContentHeaderPropertyWriter(writer));
 }
 public static void WriteUntypedString(NetworkBinaryWriter writer, string value)
 {
     writer.Write(Encoding.UTF8.GetBytes(value));
     writer.Write((byte)0);
 }
Beispiel #11
0
        public BodySegmentOutboundFrame(int channel, byte[] body, int offset, int count) : base(FrameType.FrameBody, channel)
        {
            NetworkBinaryWriter writer = base.GetWriter();

            writer.Write(body, offset, count);
        }
 public static void WriteString(NetworkBinaryWriter writer, string value)
 {
     writer.Write((byte)StreamWireFormattingTag.String);
     WriteUntypedString(writer, value);
 }
 public static void WriteSingle(NetworkBinaryWriter writer, float value)
 {
     writer.Write((byte)StreamWireFormattingTag.Single);
     writer.Write(value);
 }
 public static void WriteInt64(NetworkBinaryWriter writer, long value)
 {
     writer.Write((byte)StreamWireFormattingTag.Int64);
     writer.Write(value);
 }
Beispiel #15
0
 public static void WriteInt32(NetworkBinaryWriter writer, int value)
 {
     writer.Write(value);
 }
 public void Check(NetworkBinaryWriter w, byte[] bytes)
 {
     Assert.AreEqual(bytes, Contents(w));
 }
Beispiel #17
0
 public static void WriteInt16(NetworkBinaryWriter writer, short value)
 {
     writer.Write(value);
 }
 public void SetUp()
 {
     m_w = Writer();
 }
Beispiel #19
0
 public static void WriteChar(NetworkBinaryWriter writer, char value)
 {
     writer.Write((ushort)value);
 }
Beispiel #20
0
 public abstract void WritePayload(NetworkBinaryWriter writer);
Beispiel #21
0
 public static void WriteSingle(NetworkBinaryWriter writer, float value)
 {
     writer.Write(value);
 }
Beispiel #22
0
 public override void WritePayload(NetworkBinaryWriter writer)
 {
     writer.Write((uint)count);
     writer.Write(body, offset, count);
 }
Beispiel #23
0
 public static void Write(NetworkBinaryWriter writer, byte[] source, int offset, int count)
 {
     writer.Write(source, offset, count);
 }
Beispiel #24
0
 internal override void WritePayload(NetworkBinaryWriter writer)
 {
     writer.Write((uint)0);
 }
Beispiel #25
0
 public static void WriteString(NetworkBinaryWriter writer, string value)
 {
     byte[] bytes = Encoding.UTF8.GetBytes(value);
     writer.Write((ushort)bytes.Length);
     writer.Write(bytes);
 }
Beispiel #26
0
 internal abstract void WritePayload(NetworkBinaryWriter writer);
Beispiel #27
0
 public static void WriteFieldValue(NetworkBinaryWriter writer, object value)
 {
     if (value == null)
     {
         WriteOctet(writer, (byte)'V');
     }
     else if (value is string)
     {
         WriteOctet(writer, (byte)'S');
         WriteLongstr(writer, Encoding.UTF8.GetBytes((string)value));
     }
     else if (value is byte[])
     {
         WriteOctet(writer, (byte)'S');
         WriteLongstr(writer, (byte[])value);
     }
     else if (value is int)
     {
         WriteOctet(writer, (byte)'I');
         writer.Write((int)value);
     }
     else if (value is decimal)
     {
         WriteOctet(writer, (byte)'D');
         WriteDecimal(writer, (decimal)value);
     }
     else if (value is AmqpTimestamp)
     {
         WriteOctet(writer, (byte)'T');
         WriteTimestamp(writer, (AmqpTimestamp)value);
     }
     else if (value is IDictionary)
     {
         WriteOctet(writer, (byte)'F');
         WriteTable(writer, (IDictionary)value);
     }
     else if (value is IList)
     {
         WriteOctet(writer, (byte)'A');
         WriteArray(writer, (IList)value);
     }
     else if (value is sbyte)
     {
         WriteOctet(writer, (byte)'b');
         writer.Write((sbyte)value);
     }
     else if (value is double)
     {
         WriteOctet(writer, (byte)'d');
         writer.Write((double)value);
     }
     else if (value is float)
     {
         WriteOctet(writer, (byte)'f');
         writer.Write((float)value);
     }
     else if (value is long)
     {
         WriteOctet(writer, (byte)'l');
         writer.Write((long)value);
     }
     else if (value is short)
     {
         WriteOctet(writer, (byte)'s');
         writer.Write((short)value);
     }
     else if (value is bool)
     {
         WriteOctet(writer, (byte)'t');
         WriteOctet(writer, (byte)(((bool)value) ? 1 : 0));
     }
     else if (value is BinaryTableValue)
     {
         WriteOctet(writer, (byte)'x');
         WriteLongstr(writer, ((BinaryTableValue)value).Bytes);
     }
     else
     {
         throw new WireFormattingException("Value cannot appear as table value",
                                           value);
     }
 }
Beispiel #28
0
 internal override void WritePayload(NetworkBinaryWriter writer)
 {
     writer.Write((uint)_count);
     writer.Write(_body, _offset, _count);
 }
Beispiel #29
0
 public static void WriteLongstr(NetworkBinaryWriter writer, byte[] val)
 {
     WriteLong(writer, (uint)val.Length);
     writer.Write(val);
 }
 public static void WriteDouble(NetworkBinaryWriter writer, double value)
 {
     writer.Write((byte)StreamWireFormattingTag.Double);
     writer.Write(value);
 }