コード例 #1
0
        public override async ValueTask <Page <StorageFileItem> > GetNextPageAsync(
            string continuationToken,
            int?pageSizeHint,
            bool isAsync,
            CancellationToken cancellationToken)
        {
            Task <Response <FilesAndDirectoriesSegment> > task = _client.GetFilesAndDirectoriesInternal(
                continuationToken,
                _prefix,
                pageSizeHint,
                isAsync,
                cancellationToken);
            Response <FilesAndDirectoriesSegment> response = isAsync ?
                                                             await task.ConfigureAwait(false) :
                                                             task.EnsureCompleted();

            var items = new List <StorageFileItem>();

            items.AddRange(response.Value.DirectoryItems.Select(d => new StorageFileItem(true, d.Name)));
            items.AddRange(response.Value.FileItems.Select(f => new StorageFileItem(false, f.Name, f.Properties?.ContentLength)));
            return(Page <StorageFileItem> .FromValues(
                       items.ToArray(),
                       response.Value.NextMarker,
                       response.GetRawResponse()));
        }