Provides functionality for writing primitive binary data.
Ejemplo n.º 1
0
 public Packet(ushort opcode, ushort length)
 {
     m_Stream = PacketWriter.CreateInstance((length + 6), true);
     m_Stream.Write(length);
     m_Stream.Write((ushort)PacketFlag.Master);
     m_Stream.Write(opcode);
 }
Ejemplo n.º 2
0
Archivo: Time.cs Proyecto: LuJie/avalon
        public static byte[] ServerTime(int hash)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Write((ushort)hash);
            Writer.Write((ushort)0x1769);
            Writer.Write((ushort)DateTime.Now.Year);
            Writer.Write((ushort)DateTime.Now.Month);
            Writer.Write((ushort)DateTime.Now.Day);
            Writer.Write((ushort)DateTime.Now.Hour);
            Writer.Write((ushort)DateTime.Now.Minute);
            Writer.Write((ushort)DateTime.Now.Second);
            Writer.Write((ushort)DateTime.Now.Millisecond);

            return Writer.UnderlyingStream.ToArray();
        }
Ejemplo n.º 3
0
 public void EnsureCapacity(ushort length)
 {
     m_Stream = PacketWriter.CreateInstance((length + 6), false);// new PacketWriter( length );
     m_Stream.Write((ushort)(length + (ushort)6));
     m_Stream.Write((ushort)PacketFlag.Master);
     m_Stream.Write(m_Opcode);
 }