Exemplo n.º 1
0
            ValueTask IDataTransferObject.WriteToAsync <TWriter>(TWriter writer, CancellationToken token)
            {
                Task result;

                if (touched)
                {
                    result = Task.FromException(new InvalidOperationException(ExceptionMessages.ReadLogEntryTwice));
                }
                else
                {
                    touched = true;
                    result  = reader.CopyToAsync(writer, token);
                }

                return(new ValueTask(result));
            }
Exemplo n.º 2
0
            ValueTask IDataTransferObject.WriteToAsync <TWriter>(TWriter writer, CancellationToken token)
            {
                ValueTask result;

                if (touched)
                {
#if NETCOREAPP3_1
                    result = new (Task.FromException(new InvalidOperationException(ExceptionMessages.ReadLogEntryTwice)));
#else
                    result = ValueTask.FromException(new InvalidOperationException(ExceptionMessages.ReadLogEntryTwice));
#endif
                }
                else
                {
                    touched = true;
                    result  = new(reader.CopyToAsync(writer, token));
                }

                return(result);
            }
Exemplo n.º 3
0
 public override Task CopyToAsync(PipeWriter destination, CancellationToken cancellationToken = default)
 {
     _socketConnection.EnsureStarted();
     return(_reader.CopyToAsync(destination, cancellationToken));
 }
Exemplo n.º 4
0
 Task IAsyncBinaryWriter.CopyFromAsync(PipeReader input, CancellationToken token)
 => input.CopyToAsync(output, token);