// 为什么将请求和响应的消息封装都放在一个类里面?这是为了方便更改,和调试 // 如果放在两个类或两个文件里面,也许就不好调试对应关系 protected static IpcBufferMessageContext CreateResponseMessageInner(IpcClientRequestMessageId messageId, IpcRequestMessage response) { /* * MessageHeader * MessageId * Response Message Length * Response Message */ var currentMessageIdByteList = BitConverter.GetBytes(messageId.MessageIdValue); var responseMessageLengthByteList = BitConverter.GetBytes(response.RequestMessage.Count); return(new IpcBufferMessageContext ( response.Summary, IpcMessageCommandType.ResponseMessage, new IpcBufferMessage(ResponseMessageHeader), new IpcBufferMessage(currentMessageIdByteList), new IpcBufferMessage(responseMessageLengthByteList), response.RequestMessage )); }
public IpcBufferMessageContext CreateResponseMessage(IpcClientRequestMessageId messageId, IpcRequestMessage response) => CreateResponseMessageInner(messageId, response);
public IpcClientRequestMessage(IpcBufferMessageContext ipcBufferMessageContext, Task <IpcBufferMessage> task, IpcClientRequestMessageId messageId) { IpcBufferMessageContext = ipcBufferMessageContext; Task = task; MessageId = messageId; }