Пример #1
0
 public override async Task<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
 {
     var set = new TSet();
     await ReadJsonArrayStartAsync(cancellationToken);
     set.ElementType = GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
     set.Count = (int) await ReadJsonIntegerAsync(cancellationToken);
     return set;
 }
Пример #2
0
 public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
 {
     await WriteJsonArrayStartAsync(cancellationToken);
     await WriteJsonStringAsync(GetTypeNameForTypeId(set.ElementType), cancellationToken);
     await WriteJsonIntegerAsync(set.Count, cancellationToken);
 }
Пример #3
0
        public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await WriteCollectionBeginAsync(set.ElementType, set.Count, cancellationToken);
        }
Пример #4
0
 public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
 {
     await _wrappedProtocol.WriteSetBeginAsync(set, cancellationToken);
 }
Пример #5
0
        public override async Task<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return await Task.FromCanceled<TSet>(cancellationToken);
            }

            var set = new TSet
            {
                ElementType = (TType) await ReadByteAsync(cancellationToken),
                Count = await ReadI32Async(cancellationToken)
            };

            return set;
        }
Пример #6
0
        public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await WriteByteAsync((sbyte) set.ElementType, cancellationToken);
            await WriteI32Async(set.Count, cancellationToken);
        }