private async Task DeleteAsync(string fullPath, CancellationToken cancellationToken) { (CloudBlobContainer container, string path) = await GetPartsAsync(fullPath, false); if (StoragePath.IsRootPath(path)) { //deleting the entire container await container.DeleteIfExistsAsync(cancellationToken).ConfigureAwait(false); } else { CloudBlockBlob blob = string.IsNullOrEmpty(path) ? null : container.GetBlockBlobReference(StoragePath.Normalize(path, false)); if (blob != null && await blob.ExistsAsync().ConfigureAwait(false)) { await blob.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots, null, null, null, cancellationToken); } else { //try deleting as a folder CloudBlobDirectory dir = container.GetDirectoryReference(StoragePath.Normalize(path, false)); using (var browser = new AzureBlobDirectoryBrowser(container, _containerName == null, 3)) { await browser.RecursiveDeleteAsync(dir, cancellationToken).ConfigureAwait(false); } } } }
private async Task ListAsync(CloudBlobContainer container, List <Blob> result, ListOptions options, CancellationToken cancellationToken) { var browser = new AzureBlobDirectoryBrowser(container, BrowserParallelism); IReadOnlyCollection <Blob> containerBlobs = await browser.ListFolderAsync(options, cancellationToken); if (containerBlobs.Count > 0) { result.AddRange(containerBlobs); } }
private async Task ListAsync(CloudBlobContainer container, List <Blob> result, ListOptions options, CancellationToken cancellationToken) { using (var browser = new AzureBlobDirectoryBrowser(container, _containerName == null, BrowserParallelism)) { IReadOnlyCollection <Blob> containerBlobs = await browser.ListFolderAsync(options, cancellationToken).ConfigureAwait(false); if (containerBlobs.Count > 0) { result.AddRange(containerBlobs); } } }