示例#1
0
        public static bool IntepretMessage(ByteArray byteArray, IDeamonClientService clientService)
        {
            byteArray.BypassHeader();
            int  methodID = byteArray.readInt();
            bool mtdrst__ = false;

            switch (methodID)
            {
            case EnumDeamonMethods.CLIENT_GETINSTANCELISTRESPONSE_HASH:
                byteArray.EncryptKey = EnumDeamonMethods.CLIENT_GETINSTANCELISTRESPONSE_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();
                mtdrst__             = OnGetInstanceListResponse(byteArray, clientService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);

            case EnumDeamonMethods.CLIENT_GETMACHINERESPONSE_HASH:
                byteArray.EncryptKey = EnumDeamonMethods.CLIENT_GETMACHINERESPONSE_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();
                mtdrst__             = OnGetMachineResponse(byteArray, clientService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);

            case EnumDeamonMethods.CLIENT_STARTINSTANCERESULT_HASH:
                byteArray.EncryptKey = EnumDeamonMethods.CLIENT_STARTINSTANCERESULT_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();
                mtdrst__             = OnStartInstanceResult(byteArray, clientService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);

            case EnumDeamonMethods.CLIENT_STOPINSTANCERESULT_HASH:
                byteArray.EncryptKey = EnumDeamonMethods.CLIENT_STOPINSTANCERESULT_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();
                mtdrst__             = OnStopInstanceResult(byteArray, clientService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);

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

            if (methodID == EnumDeamonMethods.CLIENT_REQUESTERROR_HASH)
            {
                return(OnClientRequestError__(byteArray, clientService));
            }
            // recover the header
            byteArray.Rewind();
            return(false);
        }
示例#2
0
        private static bool OnClientRequestError__(ByteArray byteArray, IDeamonClientService clientService)
        {
            int errorCode = byteArray.readDynamicsInt();

            if (ClientRequestErrorHandler__ != null)
            {
                ClientRequestErrorHandler__(errorCode);
            }
            return(true);
        }
示例#3
0
        private static bool OnStopInstanceResult(ByteArray byteArray, IDeamonClientService clientService)
        {
            int    result  = byteArray.readDynamicsInt();
            String message = byteArray.readUTF();

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                clientService.OnStopInstanceResult(result, message);
            }

            byteArray.Recycle();
            return(true);
        }
示例#4
0
        private static bool OnGetMachineResponse(ByteArray byteArray, IDeamonClientService clientService)
        {
            MachineInfo instances = new MachineInfo();

            instances.ReadFromByteArray(byteArray);

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                clientService.OnGetMachineResponse(ref instances);
            }

            byteArray.Recycle();
            return(true);
        }
示例#5
0
        private static bool OnGetInstanceListResponse(ByteArray byteArray, IDeamonClientService clientService)
        {
            AppInstanceSequence instances = new AppInstanceSequence();

            instances.ReadFromByteArray(byteArray);

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                clientService.OnGetInstanceListResponse(ref instances);
            }

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