private static bool OnClientRequestError__(ByteArray byteArray, IMonitorClientService clientService) { int errorCode = byteArray.readDynamicsInt(); if (ClientRequestErrorHandler__ != null) { ClientRequestErrorHandler__(errorCode); } return(true); }
private static bool OnStatusReport(ByteArray byteArray, IMonitorClientService clientService) { ByteArray status = ByteArray.SReadFromByteArray(byteArray); int crc = byteArray.readIntNCRC(); if (crc == byteArray.CRC) { clientService.OnStatusReport(ref status); } byteArray.Recycle(); return(true); }
private static bool OnSendMessage(ByteArray byteArray, IMonitorClientService clientService) { String message = byteArray.readUTF(); int crc = byteArray.readIntNCRC(); if (crc == byteArray.CRC) { clientService.OnSendMessage(message); } byteArray.Recycle(); return(true); }
public static bool IntepretMessage(ByteArray byteArray, IMonitorClientService clientService) { byteArray.BypassHeader(); int methodID = byteArray.readInt(); bool mtdrst__ = false; switch (methodID) { case EnumMonitorMethods.CLIENT_STATUSREPORT_HASH: byteArray.EncryptKey = EnumMonitorMethods.CLIENT_STATUSREPORT_HASH; byteArray.CRC = 0; byteArray.readDynamicsInt(); mtdrst__ = OnStatusReport(byteArray, clientService); byteArray.EncryptKey = 0; return(mtdrst__); case EnumMonitorMethods.CLIENT_SENDMESSAGE_HASH: byteArray.EncryptKey = EnumMonitorMethods.CLIENT_SENDMESSAGE_HASH; byteArray.CRC = 0; byteArray.readDynamicsInt(); mtdrst__ = OnSendMessage(byteArray, clientService); byteArray.EncryptKey = 0; return(mtdrst__); case EnumMonitorMethods.CLIENT_COMMANDRESULT_HASH: byteArray.EncryptKey = EnumMonitorMethods.CLIENT_COMMANDRESULT_HASH; byteArray.CRC = 0; byteArray.readDynamicsInt(); mtdrst__ = OnCommandResult(byteArray, clientService); byteArray.EncryptKey = 0; return(mtdrst__); case EnumMonitorMethods.CLIENT_REQUESTERROR_HASH: byteArray.EncryptKey = EnumMonitorMethods.CLIENT_REQUESTERROR_HASH; byteArray.readDynamicsInt(); OnClientRequestError__(byteArray, clientService); byteArray.EncryptKey = 0; return(true); } if (methodID == EnumMonitorMethods.CLIENT_REQUESTERROR_HASH) { return(OnClientRequestError__(byteArray, clientService)); } // recover the header byteArray.Rewind(); return(false); }
private static bool OnCommandResult(ByteArray byteArray, IMonitorClientService clientService) { String command = byteArray.readUTF(); int result = byteArray.readDynamicsInt(); String message = byteArray.readUTF(); int crc = byteArray.readIntNCRC(); if (crc == byteArray.CRC) { clientService.OnCommandResult(command, result, message); } byteArray.Recycle(); return(true); }