Provides functionality for writing primitive binary data.
예제 #1
0
 public IOClient(Connection c)
 {
     this.connection = c;
     this.connectedAt = Server.CurrentTimeMillis();
     this.mm_stream = new PacketWriter(255);
 }
예제 #2
0
        public Packet(int packetID, int length)
        {
            m_PacketID = packetID;
            m_Length = length;

            m_Stream = PacketWriter.CreateInstance(length);
            m_Stream.Write((byte)packetID);
        }
예제 #3
0
        public byte[] Compile()
        {
            System.IO.MemoryStream ms = m_Stream.UnderlyingStream;

            m_CompiledBuffer = ms.GetBuffer();
            m_CompiledLength = (int)ms.Length;

            int length = m_CompiledLength;
            byte[] old = m_CompiledBuffer;
            m_CompiledBuffer = new byte[length];
            Buffer.BlockCopy(old, 0, m_CompiledBuffer, 0, length);

            PacketWriter.ReleaseInstance(m_Stream);
            m_Stream = null;

            return Encrypt(m_CompiledBuffer);
        }
예제 #4
0
        public Packet(int packetID)
        {
            m_PacketID = packetID;
            m_Length = 32;

            m_Stream = PacketWriter.CreateInstance();
            m_Stream.Write((byte)packetID);
        }