Exemplo n.º 1
0
            public void Push(byte[] data)
            {
                byte[] encode_buffer     = new byte[YwEncrypt.MSG_MAX_STC_PACK_LEN];
                int    encode_buffer_len = YwEncrypt.Encode(mParent.mPackNum, encode_buffer, data);

                ByteArray final_buffer = new ByteArray();

                // Fill content len.
                final_buffer.Put((ushort)encode_buffer_len);

                // Fill real content.
                final_buffer.Put(encode_buffer, encode_buffer_len);

                mParent.mPackNum++;

                mCacheData.Put(final_buffer.GetData());
                mCount++;
            }
Exemplo n.º 2
0
        public virtual byte[] WrapPacket(byte[] data)
        {
            byte[] encode_buffer     = new byte[YwEncrypt.MSG_MAX_STC_PACK_LEN];
            int    encode_buffer_len = YwEncrypt.Encode(mPackNum, encode_buffer, data);

            ByteArray final_buffer = new ByteArray();

            // Fill head.
            final_buffer.Put((ushort)encode_buffer_len);
            final_buffer.Put((ushort)24);

            // Fill real content.
            final_buffer.Put(encode_buffer, encode_buffer_len);

            mPackNum++;

            return(final_buffer.GetData());
        }