Exemplo n.º 1
0
        public static bool IntepretMessage(ByteArray byteArray, IOperatorRequestClientService clientService)
        {
            byteArray.BypassHeader();
            int  methodID = byteArray.readInt();
            bool mtdrst__ = false;

            switch (methodID)
            {
            case EnumOperatorRequestMethods.CLIENT_LOGIN_HASH:
                byteArray.EncryptKey = EnumOperatorRequestMethods.CLIENT_LOGIN_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();
                mtdrst__             = OnLogin(byteArray, clientService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);

            case EnumOperatorRequestMethods.CLIENT_REQUESTERROR_HASH:
                byteArray.EncryptKey = EnumOperatorRequestMethods.CLIENT_REQUESTERROR_HASH;
                byteArray.readDynamicsInt();
                OnClientRequestError__(byteArray, clientService);
                byteArray.EncryptKey = 0;
                return(true);
            }

            if (methodID == EnumOperatorRequestMethods.CLIENT_REQUESTERROR_HASH)
            {
                return(OnClientRequestError__(byteArray, clientService));
            }
            // recover the header
            byteArray.Rewind();
            return(false);
        }
Exemplo n.º 2
0
        private static bool OnClientRequestError__(ByteArray byteArray, IOperatorRequestClientService clientService)
        {
            int errorCode = byteArray.readDynamicsInt();

            if (ClientRequestErrorHandler__ != null)
            {
                ClientRequestErrorHandler__(errorCode);
            }
            return(true);
        }
Exemplo n.º 3
0
        private static bool OnLogin(ByteArray byteArray, IOperatorRequestClientService clientService)
        {
            String account = byteArray.readUTF();
            String token   = byteArray.readUTF();

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                clientService.OnLogin(account, token);
            }

            byteArray.Recycle();
            return(true);
        }