コード例 #1
0
        public static byte[] BuildResponseMessage(RemotingResponse response)
        {
            var requestSequenceBytes     = BitConverter.GetBytes(response.RequestSequence);
            var requestCodeBytes         = BitConverter.GetBytes(response.RequestCode);
            var requestTypeBytes         = BitConverter.GetBytes(response.RequestType);
            var requestTimeBytes         = ByteUtil.EncodeDateTime(response.RequestTime);
            var requestHeaderBytes       = HeaderUtil.EncodeHeader(response.RequestHeader);
            var requestHeaderLengthBytes = BitConverter.GetBytes(requestHeaderBytes.Length);

            var responseCodeBytes         = BitConverter.GetBytes(response.ResponseCode);
            var responseTimeBytes         = ByteUtil.EncodeDateTime(response.ResponseTime);
            var responseHeaderBytes       = HeaderUtil.EncodeHeader(response.ResponseHeader);
            var responseHeaderLengthBytes = BitConverter.GetBytes(requestHeaderBytes.Length);

            return(ByteUtil.Combine(
                       requestSequenceBytes,
                       requestCodeBytes,
                       requestTypeBytes,
                       requestTimeBytes,
                       requestHeaderLengthBytes,
                       requestHeaderBytes,
                       responseCodeBytes,
                       responseTimeBytes,
                       responseHeaderLengthBytes,
                       responseHeaderBytes,
                       response.ResponseBody));
        }
コード例 #2
0
        public static byte[] BuildRemotingServerMessage(RemotingServerMessage message)
        {
            byte[] IdBytes;
            byte[] IdLengthBytes;
            ByteUtil.EncodeString(message.Id, out IdLengthBytes, out IdBytes);

            var typeBytes         = BitConverter.GetBytes(message.Type);
            var codeBytes         = BitConverter.GetBytes(message.Code);
            var createdTimeBytes  = ByteUtil.EncodeDateTime(message.CreatedTime);
            var headerBytes       = HeaderUtil.EncodeHeader(message.Header);
            var headerLengthBytes = BitConverter.GetBytes(headerBytes.Length);

            return(ByteUtil.Combine(
                       IdLengthBytes,
                       IdBytes,
                       typeBytes,
                       codeBytes,
                       createdTimeBytes,
                       headerLengthBytes,
                       headerBytes,
                       message.Body));
        }
コード例 #3
0
        public static byte[] BuildRequestMessage(RemotingRequest request)
        {
            byte[] IdBytes;
            byte[] IdLengthBytes;
            ByteUtil.EncodeString(request.Id, out IdLengthBytes, out IdBytes);

            var sequenceBytes     = BitConverter.GetBytes(request.Sequence);
            var codeBytes         = BitConverter.GetBytes(request.Code);
            var typeBytes         = BitConverter.GetBytes(request.Type);
            var createdTimeBytes  = ByteUtil.EncodeDateTime(request.CreatedTime);
            var headerBytes       = HeaderUtil.EncodeHeader(request.Header);
            var headerLengthBytes = BitConverter.GetBytes(headerBytes.Length);

            return(ByteUtil.Combine(
                       IdLengthBytes,
                       IdBytes,
                       sequenceBytes,
                       codeBytes,
                       typeBytes,
                       createdTimeBytes,
                       headerLengthBytes,
                       headerBytes,
                       request.Body));
        }