Beispiel #1
0
        public IpcBufferMessageContext BuildPeerRegisterMessage(string pipeName)
        {
            var peerRegisterHeaderIpcBufferMessage = new IpcBufferMessage(PeerRegisterHeader);
            var buffer = Encoding.UTF8.GetBytes(pipeName);
            var pipeNameIpcBufferMessage = new IpcBufferMessage(buffer);

            return(new IpcBufferMessageContext($"PeerRegisterMessage PipeName={pipeName}", peerRegisterHeaderIpcBufferMessage, pipeNameIpcBufferMessage));
        }
Beispiel #2
0
        public static async Task WriteAsync(Stream stream, byte[] messageHeader, Ack ack,
                                            IpcBufferMessage ipcBufferMessage, string?summary, ILogger logger)
        {
            logger.Debug($"[{nameof(IpcMessageConverter)}] Start Write {summary}");

            var binaryWriter = await WriteHeaderAsync(stream, messageHeader, ack);

            await binaryWriter.WriteAsync(ipcBufferMessage.Count);

            await stream.WriteAsync(ipcBufferMessage.Buffer, ipcBufferMessage.Start, ipcBufferMessage.Count);

            logger.Debug($"[{nameof(IpcMessageConverter)}] Finished Write {summary}");
        }
        public IpcBufferMessageContext BuildPeerRegisterMessage(string peerName)
        {
            /*
             * byte[] Header
             * Int32 PipeNameLength
             * byte[] PipeName
             */
            var peerRegisterHeaderIpcBufferMessage = new IpcBufferMessage(PeerRegisterHeader);
            var buffer = Encoding.UTF8.GetBytes(peerName);

            var peerNameLengthBufferMessage = new IpcBufferMessage(BitConverter.GetBytes(buffer.Length));
            var peerNameIpcBufferMessage    = new IpcBufferMessage(buffer);

            return(new IpcBufferMessageContext($"PeerRegisterMessage PipeName={peerName}",
                                               IpcMessageCommandType.PeerRegister, peerRegisterHeaderIpcBufferMessage, peerNameLengthBufferMessage,
                                               peerNameIpcBufferMessage));
        }
 public IpcRequestMessage(string summary, IpcBufferMessage requestMessage)
 {
     Summary        = summary;
     RequestMessage = requestMessage;
 }
 public IpcRequestMessageContext(IpcBufferMessage ipcBufferMessage, IPeerProxy peer)
 {
     IpcBufferMessage = ipcBufferMessage;
     Peer             = peer;
 }