예제 #1
0
        // 为什么将请求和响应的消息封装都放在一个类里面?这是为了方便更改,和调试
        // 如果放在两个类或两个文件里面,也许就不好调试对应关系
        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
                   ));
        }
예제 #2
0
 public IpcBufferMessageContext CreateResponseMessage(IpcClientRequestMessageId messageId,
                                                      IpcRequestMessage response)
 => CreateResponseMessageInner(messageId, response);
예제 #3
0
 public IpcClientRequestMessage(IpcBufferMessageContext ipcBufferMessageContext, Task <IpcBufferMessage> task, IpcClientRequestMessageId messageId)
 {
     IpcBufferMessageContext = ipcBufferMessageContext;
     Task      = task;
     MessageId = messageId;
 }