Exemplo n.º 1
0
        ValueTask IAsyncBinaryWriter.WriteBigIntegerAsync(BigInteger value, LengthFormat lengthFormat, EncodingContext context, string?format, IFormatProvider?provider, CancellationToken token)
        {
            ValueTask result;

            if (token.IsCancellationRequested)
            {
#if NETSTANDARD2_1
                result = new (Task.FromCanceled(token));
#else
                result = ValueTask.FromCanceled(token);
#endif
            }
            else
            {
                result = new();
                try
                {
                    writer.WriteBigInteger(value, lengthFormat, in context, format, provider);
                }
                catch (Exception e)
                {
#if NETSTANDARD2_1
                    result = new (Task.FromException(e));
#else
                    result = ValueTask.FromException(e);
#endif
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        ValueTask IAsyncBinaryWriter.WriteBigIntegerAsync(BigInteger value, LengthFormat lengthFormat, EncodingContext context, string?format, IFormatProvider?provider, CancellationToken token)
        {
            Task result;

            if (token.IsCancellationRequested)
            {
                result = Task.FromCanceled(token);
            }
            else
            {
                result = Task.CompletedTask;
                try
                {
                    writer.WriteBigInteger(value, lengthFormat, in context, format, provider);
                }
                catch (Exception e)
                {
                    result = Task.FromException(e);
                }
            }

            return(new ValueTask(result));
        }
Exemplo n.º 3
0
 public ValueTask <string> ReadStringAsync(LengthFormat lengthFormat, DecodingContext context, CancellationToken token = default)
 => StreamExtensions.ReadStringAsync(stream, lengthFormat, context, buffer, token);
Exemplo n.º 4
0
 ValueTask <MemoryOwner <byte> > IAsyncBinaryReader.ReadAsync(LengthFormat lengthFormat, MemoryAllocator <byte>?allocator, CancellationToken token)
 => StreamExtensions.ReadBlockAsync(stream, lengthFormat, buffer, allocator, token);
Exemplo n.º 5
0
 ValueTask IAsyncBinaryWriter.WriteBigIntegerAsync(BigInteger value, LengthFormat lengthFormat, EncodingContext context, string?format, IFormatProvider?provider, CancellationToken token)
 => stream.WriteBigIntegerAsync(value, lengthFormat, context, buffer, format, provider, token);
Exemplo n.º 6
0
 ValueTask <BigInteger> IAsyncBinaryReader.ReadBigIntegerAsync(LengthFormat lengthFormat, bool littleEndian, CancellationToken token)
 => StreamExtensions.ReadBigIntegerAsync(stream, lengthFormat, littleEndian, token);
Exemplo n.º 7
0
 ValueTask <TimeSpan> IAsyncBinaryReader.ReadTimeSpanAsync(LengthFormat lengthFormat, DecodingContext context, string[] formats, TimeSpanStyles style, IFormatProvider?provider, CancellationToken token)
 => StreamExtensions.ReadTimeSpanAsync(stream, lengthFormat, context, buffer, formats, style, provider, token);
Exemplo n.º 8
0
 ValueTask <BigInteger> IAsyncBinaryReader.ReadBigIntegerAsync(LengthFormat lengthFormat, bool littleEndian, CancellationToken token)
 => EndOfStream <BigInteger>();
Exemplo n.º 9
0
 public static ValueTask <FlushResult> WriteSByteAsync(this PipeWriter writer, sbyte value, LengthFormat lengthFormat, EncodingContext context, string?format = null, IFormatProvider?provider = null, CancellationToken token = default)
 {
     writer.WriteSByte(value, lengthFormat, in context, format, provider);
     return(writer.FlushAsync(token));
 }
Exemplo n.º 10
0
 ValueTask <BigInteger> IAsyncBinaryReader.ReadBigIntegerAsync(LengthFormat lengthFormat, DecodingContext context, NumberStyles style, IFormatProvider?provider, CancellationToken token)
 => EndOfStream <BigInteger>();
Exemplo n.º 11
0
 ValueTask <Guid> IAsyncBinaryReader.ReadGuidAsync(LengthFormat lengthFormat, DecodingContext context, string format, CancellationToken token)
 => EndOfStream <Guid>();
Exemplo n.º 12
0
 ValueTask <TimeSpan> IAsyncBinaryReader.ReadTimeSpanAsync(LengthFormat lengthFormat, DecodingContext context, string[] formats, TimeSpanStyles style, IFormatProvider?provider, CancellationToken token)
 => EndOfStream <TimeSpan>();
Exemplo n.º 13
0
 ValueTask <DateTimeOffset> IAsyncBinaryReader.ReadDateTimeOffsetAsync(LengthFormat lengthFormat, DecodingContext context, string[] formats, DateTimeStyles style, IFormatProvider?provider, CancellationToken token)
 => EndOfStream <DateTimeOffset>();
Exemplo n.º 14
0
 public ValueTask <string> ReadStringAsync(LengthFormat lengthFormat, DecodingContext context, CancellationToken token)
 => EndOfStream <string>();
Exemplo n.º 15
0
 public ValueTask <MemoryOwner <byte> > ReadAsync(LengthFormat lengthFormat, MemoryAllocator <byte>?allocator, CancellationToken token)
 => EndOfStream <MemoryOwner <byte> >();
Exemplo n.º 16
0
 ValueTask <byte> IAsyncBinaryReader.ReadByteAsync(LengthFormat lengthFormat, DecodingContext context, NumberStyles style, IFormatProvider?provider, CancellationToken token)
 => StreamExtensions.ReadByteAsync(stream, lengthFormat, context, buffer, style, provider, token);
Exemplo n.º 17
0
 public static ValueTask <FlushResult> WriteGuidAsync(this PipeWriter writer, Guid value, LengthFormat lengthFormat, EncodingContext context, string?format = null, CancellationToken token = default)
 {
     writer.WriteGuid(value, lengthFormat, in context, format);
     return(writer.FlushAsync(token));
 }
Exemplo n.º 18
0
 ValueTask <Guid> IAsyncBinaryReader.ReadGuidAsync(LengthFormat lengthFormat, DecodingContext context, string format, CancellationToken token)
 => StreamExtensions.ReadGuidAsync(stream, lengthFormat, context, buffer, format, token);
Exemplo n.º 19
0
 ValueTask <MemoryOwner <byte> > IAsyncBinaryReader.ReadAsync(LengthFormat lengthFormat, MemoryAllocator <byte> allocator, CancellationToken token)
 => reader.ReadAsync(lengthFormat, allocator, token);
Exemplo n.º 20
0
 ValueTask <DateTimeOffset> IAsyncBinaryReader.ReadDateTimeOffsetAsync(LengthFormat lengthFormat, DecodingContext context, DateTimeStyles style, IFormatProvider?provider, CancellationToken token)
 => StreamExtensions.ReadDateTimeOffsetAsync(stream, lengthFormat, context, buffer, style, provider, token);