/// <summary> /// /// </summary> public IpcClientService(string pipeName) { pipeName = pipeName ?? throw new ArgumentNullException(nameof(pipeName)); PipeClient = new PipeClient <string>(pipeName); PipeClient.MessageReceived += PipeServer_OnMessageReceived; PipeClient.ExceptionOccurred += (_, args) => OnExceptionOccurred(args.Exception); PipeClient.Connected += PipeServer_OnConnected; PipeClient.Disconnected += PipeServer_OnDisconnected; AsyncDisposables.Add(PipeClient); }
/// <summary> /// /// </summary> public IpcServerService(string pipeName) { pipeName = pipeName ?? throw new ArgumentNullException(nameof(pipeName)); PipeServer = new PipeServer <string>(pipeName); PipeServer.MessageReceived += PipeServer_OnMessageReceived; PipeServer.ExceptionOccurred += (_, args) => OnExceptionOccurred(args.Exception); PipeServer.ClientConnected += PipeServer_OnClientConnected; PipeServer.ClientDisconnected += PipeServer_OnClientDisconnected; PipeServer.AllowUsersReadWrite(); AsyncDisposables.Add(PipeServer); }