コード例 #1
0
ファイル: BaseClient.cs プロジェクト: cooler-SAI/ProjectWAR
        public void Decrypt(PacketIn inStream)
        {
            if (m_crypts.Count <= 0)
            {
                return;
            }

            ulong opcode   = inStream.Opcode;
            int   size     = (int)inStream.Size;
            int   startPos = (int)inStream.Position;

            foreach (KeyValuePair <ICryptHandler, CryptKey[]> entry in m_crypts)
            {
                //Log.Debug("Decrypt", "Decrypt with " + entry.Key + ",Size="+inStream.Size);

                entry.Key.Decrypt(entry.Value[1], inStream.GetBuffer(), startPos, size);

                inStream.Opcode = opcode;
                inStream.Size   = (ulong)size;
            }

            //Log.Tcp("Decrypt", inStream.GetBuffer(), 0, inStream.GetBuffer().Length);
            inStream.Position = startPos;
        }