Пример #1
0
        /// <summary>
        /// Encrypt Packet
        /// </summary>
        public Encrypt.Type EncryptPacket(CString Packet)
        {
            // Encryption Type
            Encrypt.Type EncryptType = Encrypt.Type.UNCOMPRESSED;
            if (Packet.Length > 0x2000)
            { // 8192
                EncryptType = Encrypt.Type.BZ2;
                Packet.BCompress();
            }
            else if (Packet.Length > 0x28)
            { // 40
                EncryptType = Encrypt.Type.ZLIB;
                Packet.WriteShort(0);
                Packet.ZCompress();
            }

            // Apply Encryption
            mCodec.Limit(EncryptType);
            mCodec.Apply(Encrypt.CryptType.ENCRYPT, Packet);
            return EncryptType;
        }