private void ProWt_ActiveResp() { _lastActiveDate = DateTime.Now; ActiveResp actvieResp = new ActiveResp(_buffer); OnRaiseMsgRecvEvent(actvieResp.Header.Command_Id, actvieResp, "接收消息:" + actvieResp.ToString()); }
/// <summary> /// 链路测试 /// </summary> /// <param name="client"></param> /// <param name="buffer"></param> private void ProActive(CommuTcpClient client, byte[] buffer) { Active active = new Active(buffer); //OnRaiseMsgRecvEvent(client, active.ToString()); ActiveResp activeResp = new ActiveResp(active.Header.Sequence_Id); client.SendData(activeResp.ToBytes()); }
private void ProWt_Active() { Active active = new Active(_buffer); ActiveResp actvieResp = new ActiveResp(active.Header.Sequence_Id); OnRaiseMsgRecvEvent(active.Header.Command_Id, active, "接收消息:" + active.ToString()); SendData(actvieResp.ToBytes()); OnRaiseMsgSendEvent(actvieResp.Header.Command_Id, actvieResp, "发送消息:" + actvieResp.ToString()); }
private void OnRaiseMsgSendEvent(byte[] buffer) { if (MsgSendEventHandler != null) { string msg = string.Empty; MessageHeader header = new MessageHeader(buffer); switch (header.Command_Id) { case PXin_COMMAND_TYPE.Login: msg = new Login(buffer).ToString(); break; case PXin_COMMAND_TYPE.LoginResp: msg = new LoginResp(buffer).ToString(); break; case PXin_COMMAND_TYPE.Logout: msg = new Wt_Logout(buffer).ToString(); break; case PXin_COMMAND_TYPE.LogoutResp: msg = new LogoutResp(buffer).ToString(); break; case PXin_COMMAND_TYPE.Active: msg = new Active(buffer).ToString(); break; case PXin_COMMAND_TYPE.ActiveResp: msg = new ActiveResp(buffer).ToString(); break; case PXin_COMMAND_TYPE.ChatFee: msg = new ChatFee(buffer).ToString(); break; case PXin_COMMAND_TYPE.ChatFeeResp: msg = new ChatFeeResp(buffer).ToString(); break; case PXin_COMMAND_TYPE.ChatFeePush: msg = new ChatFeePush(buffer).ToString(); break; case PXin_COMMAND_TYPE.ChatFeeRateSet: msg = new ChatFeeRateSet(buffer).ToString(); break; case PXin_COMMAND_TYPE.ChatFeeRateSetResp: msg = new ChatFeeRateSetResp(buffer).ToString(); break; case PXin_COMMAND_TYPE.ChatFeeRateQuery: msg = new ChatFeeRateQuery(buffer).ToString(); break; case PXin_COMMAND_TYPE.ChatFeeRateQueryResp: msg = new ChatFeeRateQueryResp(buffer).ToString(); break; default: break; } //发布"消息发送"事件 if (header.Command_Id != PXin_COMMAND_TYPE.Active && header.Command_Id != PXin_COMMAND_TYPE.ActiveResp) { MsgSendEventHandler?.Invoke(this, new MessageEventArgs(string.Empty, Identity, msg)); } } }
/// <summary> /// 链路测试响应 /// </summary> /// <param name="client"></param> /// <param name="buffer"></param> private void ProActiveResp(CommuTcpClient client, byte[] buffer) { ActiveResp activeResp = new ActiveResp(buffer); //OnRaiseMsgRecvEvent(client, activeResp.ToString()); }