Esempio 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);
        }
Esempio 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));
        }
Esempio n. 3
0
 public ValueTask <string> ReadStringAsync(LengthFormat lengthFormat, DecodingContext context, CancellationToken token = default)
 => StreamExtensions.ReadStringAsync(stream, lengthFormat, context, buffer, token);
Esempio n. 4
0
 ValueTask <MemoryOwner <byte> > IAsyncBinaryReader.ReadAsync(LengthFormat lengthFormat, MemoryAllocator <byte>?allocator, CancellationToken token)
 => StreamExtensions.ReadBlockAsync(stream, lengthFormat, buffer, allocator, token);
Esempio 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);
Esempio n. 6
0
 ValueTask <BigInteger> IAsyncBinaryReader.ReadBigIntegerAsync(LengthFormat lengthFormat, bool littleEndian, CancellationToken token)
 => StreamExtensions.ReadBigIntegerAsync(stream, lengthFormat, littleEndian, token);
Esempio 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);
Esempio n. 8
0
 ValueTask <BigInteger> IAsyncBinaryReader.ReadBigIntegerAsync(LengthFormat lengthFormat, bool littleEndian, CancellationToken token)
 => EndOfStream <BigInteger>();
 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));
 }
Esempio n. 10
0
 ValueTask <BigInteger> IAsyncBinaryReader.ReadBigIntegerAsync(LengthFormat lengthFormat, DecodingContext context, NumberStyles style, IFormatProvider?provider, CancellationToken token)
 => EndOfStream <BigInteger>();
Esempio n. 11
0
 ValueTask <Guid> IAsyncBinaryReader.ReadGuidAsync(LengthFormat lengthFormat, DecodingContext context, string format, CancellationToken token)
 => EndOfStream <Guid>();
Esempio n. 12
0
 ValueTask <TimeSpan> IAsyncBinaryReader.ReadTimeSpanAsync(LengthFormat lengthFormat, DecodingContext context, string[] formats, TimeSpanStyles style, IFormatProvider?provider, CancellationToken token)
 => EndOfStream <TimeSpan>();
Esempio n. 13
0
 ValueTask <DateTimeOffset> IAsyncBinaryReader.ReadDateTimeOffsetAsync(LengthFormat lengthFormat, DecodingContext context, string[] formats, DateTimeStyles style, IFormatProvider?provider, CancellationToken token)
 => EndOfStream <DateTimeOffset>();
Esempio n. 14
0
 public ValueTask <string> ReadStringAsync(LengthFormat lengthFormat, DecodingContext context, CancellationToken token)
 => EndOfStream <string>();
Esempio n. 15
0
 public ValueTask <MemoryOwner <byte> > ReadAsync(LengthFormat lengthFormat, MemoryAllocator <byte>?allocator, CancellationToken token)
 => EndOfStream <MemoryOwner <byte> >();
Esempio 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);
Esempio 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));
 }
Esempio n. 18
0
 ValueTask <Guid> IAsyncBinaryReader.ReadGuidAsync(LengthFormat lengthFormat, DecodingContext context, string format, CancellationToken token)
 => StreamExtensions.ReadGuidAsync(stream, lengthFormat, context, buffer, format, token);
Esempio n. 19
0
 ValueTask <MemoryOwner <byte> > IAsyncBinaryReader.ReadAsync(LengthFormat lengthFormat, MemoryAllocator <byte> allocator, CancellationToken token)
 => reader.ReadAsync(lengthFormat, allocator, token);
Esempio 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);