Example #1
0
        private void DealReceivedData(User client, byte[] packetBytes)
        {
            SecuruStik.Protocal.Packet  packet  = (Packet)CommunicatingProtocal.ExplainPacket(packetBytes);
            SecuruStik.Protocal.Request request = packet as Request;
            switch (packet.Type)
            {
            case MessageType.Request_Login:
                Login(client, request);
                break;

            case MessageType.Request_Logout:
                Logout(client);
                break;

            case MessageType.Request_GetPK:
                Request_GetPK(client, request);
                break;

            case MessageType.Request_SetPK:
                Request_SetPK(client, request);
                break;

            case MessageType.Request_GetSharingInfo:
                Request_GetSharingInfo(client, request.UserID);
                break;

            case MessageType.Request_SetSharingInfo:
                Request_SetSharingInfo(client, request);
                break;
            }
        }
        private void DealReceivedData(Byte[] packetBytes)
        {
            Packet   packet   = (Packet)CommunicatingProtocal.ExplainPacket(packetBytes);
            Response response = (Response)packet;

            if (response.IsSuccess == false)
            {
                this.DealReceiveError(response);
            }
            else
            {
                switch (response.Type)
                {
                case MessageType.Request_Login:
                    this.IsInited = true; Resume_ReceiveThread(); break;

                case MessageType.Response_GetPK:
                    this.DealReceivePK(response.ResponseContent); break;

                case MessageType.Response_GetSharingInfo:
                    this.DealReceiveSharingInfo(response.ResponseContent); break;
                }
            }
        }