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

            switch (methodID)
            {
            case EnumUpdaterReportMethods.CLIENT_REPORTSTATUS_HASH:
                byteArray.EncryptKey = EnumUpdaterReportMethods.CLIENT_REPORTSTATUS_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();
                mtdrst__             = OnReportStatus(byteArray, clientService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);

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

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

            if (ClientRequestErrorHandler__ != null)
            {
                ClientRequestErrorHandler__(errorCode);
            }
            return(true);
        }
Example #3
0
        private static bool OnReportStatus(ByteArray byteArray, IUpdaterReportClientService clientService)
        {
            UpdaterState status = new UpdaterState();

            status.ReadFromByteArray(byteArray);

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                clientService.OnReportStatus(ref status);
            }

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