MsgPack.SubtreeUnpacker.ReadAsyncCore C# (CSharp) Method

ReadAsyncCore() protected method

protected ReadAsyncCore ( CancellationToken cancellationToken ) : Task
cancellationToken CancellationToken
return Task
		protected override async Task<bool> ReadAsyncCore( CancellationToken cancellationToken )
		{
			this.DiscardCompletedStacks();

			if ( this._itemsCount.Count == 0 || !( await this._root.ReadSubtreeItemAsync( cancellationToken ).ConfigureAwait( false ) ) )
			{
				return false;
			}

			switch ( this._root.InternalCollectionType )
			{
				case ItemsUnpacker.CollectionType.Array:
				{
					this._itemsCount.Push( this._root.InternalItemsCount );
					this._unpacked.Push( 0 );
					this._isMap.Push( false );
					break;
				}
				case ItemsUnpacker.CollectionType.Map:
				{
					this._itemsCount.Push( this._root.InternalItemsCount * 2 );
					this._unpacked.Push( 0 );
					this._isMap.Push( true );
					break;
				}
				default:
				{
					this._unpacked.Push( this._unpacked.Pop() + 1 );
					break;
				}
			}

			this._state = State.InProgress;
			return true;
		}