public static BizMsgDataBase ByteToFingerMarkData(byte[] recbytes, IMessageRespHandler dataref) { if (dataref != null) { dataref.FromBytes(recbytes); } return dataref as FingerMarkData; }
public static BizMsgDataBase ByteToCoreMultiMsgData(byte[] recbytes, IMessageRespHandler dataref) { if (recbytes != null && recbytes.Length > 0) { dataref.FromBytes(recbytes); return dataref as CoreBizMsgMultiRespDataBase; } else { return null; } }
private static BizMsgDataBase DecodeBinaryToMsg(byte[] recbytes, IMessageRespHandler respdata) { try { if (respdata != null) { if (respdata is EncryptTellerAuth) { EncryptTellerAuth tellerData = respdata as EncryptTellerAuth; if (tellerData != null) { if (tellerData.AfterEncrypt) { tellerData.FromBytes(recbytes); return tellerData; } else { tellerData.TellerEncrypt.FromBytes(recbytes); return tellerData; } } else { throw new Exception(MESSAGE_DECODE_EXCEPTION); } } else { BizMsgDataBase bizData = respdata.FromBytes(recbytes) as BizMsgDataBase; //return respdata.FromBytes(recbytes) as BizMsgDataBase; return bizData; } } return null; } catch (Exception ex) { xQuant.Log4.LogHelper.Write(xQuant.Log4.LogLevel.Error, string.Format("{0}\r\n{1}", ex.Message, ex.StackTrace)); throw new Exception(MESSAGE_DECODE_EXCEPTION, ex); } }
public static BizMsgDataBase BytesToCoreMsgData(byte[] recbytes, IMessageRespHandler dataref) { if (recbytes != null && recbytes.Length > 0) { byte[] buffer = new byte[CoreMessageHeader.TOTAL_WIDTH]; if (recbytes.Length >= buffer.Length) { Array.Copy(recbytes, buffer, buffer.Length); } else { return null; } CoreMessageHeader msgHeader = new CoreMessageHeader(); msgHeader.FromBytes(buffer); UInt32 mbLen = msgHeader.MH_MESSAGE_LENGTH - CoreMessageHeader.TOTAL_WIDTH; buffer = new byte[mbLen]; //Assembly asm = Assembly.GetExecutingAssembly(); //object dataobj = asm.CreateInstance(type.ToString(), false); //IMessageRespHandler bizMsgData = dataref as IMessageRespHandler; if (dataref != null) { Array.Copy(recbytes, CoreMessageHeader.TOTAL_WIDTH, buffer, 0, mbLen); dataref.FromBytes(buffer); } return dataref as CoreBizMsgDataBase; } else { return null; } }
public static BizMsgDataBase ByteToPaymentMsgData(byte[] recbytes, IMessageRespHandler payData) { if (payData != null) { payData.FromBytes(recbytes); } return payData as PaymentBizMsgDataBase; }
public static BizMsgDataBase BytesToEncryptObject(byte[] recbytes, IMessageRespHandler tellerData) { //Assembly asm = Assembly.GetExecutingAssembly(); //object dataobj = asm.CreateInstance(type.ToString(), false); EncryptTellerAuth bizMsgData = tellerData as EncryptTellerAuth; if (bizMsgData != null) { bizMsgData.TellerEncrypt.FromBytes(recbytes); //tellerData.FromBytes(recbytes); } return tellerData as CoreBizMsgDataBase; }