Exemplo n.º 1
0
        /// <summary>
        /// Append Packet to Buffer
        /// </summary>
        public void SendPacket(CString Packet, Boolean SendNow)
        {
            // Data Exist?
            if (Packet.Length < 1)
                return;

            // Append '\n'
            if (Packet[Packet.Length - 1] != '\n')
                Packet.WriteByte((byte)'\n');

            // Append Data
            mDataOut.Write(Packet);

            // Check Buffer & Send
            if (SendNow || mDataOut.Length > 4096)
                SendCompress();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Read Data from Buffer into CString
        /// </summary>
        public void Read(CString Data, int Count)
        {
            if (Count < 1)
                return;

            Count = Math.Min(Count, Length - ReadCount);
            for (int i = 0; i < Count; i++)
                Data.WriteByte(mBuffer[ReadCount++]);
        }