// // Licensed under the MIT License. See LICENSE file in the project root for full license information. // namespace MUnique.OpenMU.Network; using System.IO.Pipelines; /// /// A simple implementation of a which is helpful for testing. /// It's pipes are configured to forward incoming data as soon as they are written. /// public class DuplexPipe : IDuplexPipe { /// /// Initializes a new instance of the class. /// /// The optional pipe options. If null, the default options are applied. public DuplexPipe(PipeOptions? options = null) { this.SendPipe = new Pipe(options ?? PipeOptions.Default); this.ReceivePipe = new Pipe(options ?? PipeOptions.Default); } /// /// Gets the send pipe. /// public Pipe SendPipe { get; } /// /// Gets the receive pipe. /// public Pipe ReceivePipe { get; } /// /// Gets the input pipe reader. It's the reader of the . /// public PipeReader Input => this.ReceivePipe.Reader; /// /// Gets the output pipe writer. It's the writer of the . /// public PipeWriter Output => this.SendPipe.Writer; }