Пример #1
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            ResultCode      = issStream.Decode4();
            m_isExist       = issStream.Decode1();

            return issStream.CheckSignature();
        }
Пример #2
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            ResultCode      = issStream.Decode4();
            m_guestID       = issStream.DecodeAnsiToString();

            return issStream.CheckSignature();
        }
Пример #3
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            RecvTransNum    = issStream.Decode2();
            ResultCode      = issStream.Decode4();

            return issStream.CheckSignature();
        }
Пример #4
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            ResultCode      = issStream.Decode4();
            m_type          = issStream.Decode1();
            m_buffer        = issStream.DecodeBuffer();
            m_isLastPacket  = issStream.Decode1();

            return issStream.CheckSignature();
        }
Пример #5
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            RecvTransNum    = issStream.Decode2();
            m_actionId      = issStream.Decode1();
            m_param1        = issStream.Decode4();
            m_param2        = issStream.Decode4();
            m_param3        = issStream.Decode4();
            m_param4        = issStream.Decode4();

            return issStream.CheckSignature();
        }
Пример #6
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            RecvTransNum    = issStream.Decode2();
            ResultCode      = issStream.Decode4();

            if (ResultCode == 0)
            {
                m_typeCode  = issStream.Decode1();
                m_userID    = issStream.DecodeAnsiToString();
                m_nickname  = issStream.DecodeUnicodeToString();
            }

            return issStream.CheckSignature();
        }
Пример #7
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            bool ret = true;

            ResultCode          = issStream.Decode4();
            m_isAlreadyLogined  = issStream.Decode1();

            if (ResultCode == 0 && m_isAlreadyLogined == 0)
            {
                m_user = new User();

                SimpleStream stream = new SimpleStream();
                stream.SetBuffer(issStream.DecodeBuffer(), true);
                ret = m_user.DeSerialize(stream);
            }

            if (ret)    ret = issStream.CheckSignature();
            return ret;
        }    
Пример #8
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            bool ret = true;

            m_resultCode = issStream.Decode4();

            if (m_resultCode == 0)
            {
                m_configVer = issStream.Decode1();

                if (m_configVer == 0)
                {
                    SimpleStream stream = new SimpleStream();
                    m_config = new ValConfig();

                    stream.SetBuffer(issStream.DecodeBuffer(), true);
                    ret = m_config.DeSerialize(stream);
                }
            }

            if (ret)    ret = issStream.CheckSignature();
            return ret;
        }
Пример #9
0
 public override bool DoDecoding(ISmartStream stream)
 {
     return stream.CheckSignature();
 }
Пример #10
0
        public override bool DoDecoding(ISmartStream issStream)
        {
            m_type          = issStream.Decode1();

            return issStream.CheckSignature();
        }
Пример #11
0
 public virtual bool DoDecoding(ISmartStream issStream)
 {
     // No implementation.
     return false;
 }
Пример #12
0
        private ErrCode OnRecvPacketData()
        {
            ErrCode errCode = ErrCode.Success;

            if (m_recvPacketSize > GetRecvBufSize())
            {
                return IssueRecvPacketData();
            }

            ISmartStream stream = new ISmartStream();
            uint decodedLen = 0;

            stream.SetBuffer(GetRawRecvBuf(), ref decodedLen);

            if (decodedLen != 0)
            {
                SmartPacket packet = (SmartPacket)PacketFactory.Instance.CreateSmartPacket(m_recvPacketCode);
                //SmartPacket packet = CreateSmartPacket(m_recvPacketCode);
                if (packet != null)
                {
                    if (packet.DoDecoding(stream))
                    {
                        if (m_recvPacketHandler != null)
                        {
                            errCode = m_recvPacketHandler(packet);
                            if (errCode == ErrCode.Success)
                            {
                                if (!Connected)
                                {
                                    errCode = ErrCode.NetworkSocketClosed;
                                }
                                else
                                {
                                    ResetRecvBuf();
                                    errCode = IssueRecvPacketHeader();
                                }
                            }
                        }
                    }
                    else
                    {
                        errCode = ErrCode.PacketData;
                    }

                    packet.Dispose();
                }
                else
                {
                    m_errMessage = string.Format("Received invalid packet code ({0})", m_recvPacketCode);
                    errCode = ErrCode.InvalidPacketCode;
                }
            }
            else
            {
                errCode = ErrCode.PacketSize;
            }

            stream.Dispose();

            return errCode;
        }