public async Task <IDirectoryContents> GetDirectoryContentsAsync( string path, CancellationToken cancellationToken = default(CancellationToken)) { var directory = _share.GetDirectoryReference(path); try { await directory.FetchAttributesAsync(); var directoryContents = new AzureFileStorageDirectoryContents(directory); return(directoryContents); } catch (StorageException ex) when(StorageExceptionHelper.IsNotFoundStorageException(ex)) { return(new NotFoundDirectoryContents(path)); } }
/// <summary> /// Locate a file at the given subpath by directly mapping path segments to Azure File Storage directories. /// </summary> /// <param name="path">A path under the root file share.</param> /// <returns>The file information. Callers must check <see cref="IFile.Exists"/>. public async Task <IFile> GetFileInfoAsync( string path, CancellationToken cancellationToken = default(CancellationToken)) { var file = _share.GetFileReference(path); try { await file.FetchAttributesAsync(); var fileInfo = new AzureFile(file); return(fileInfo); } catch (StorageException ex) when(StorageExceptionHelper.IsNotFoundStorageException(ex)) { return(new NotFoundFile(path)); } }
public async Task <IFile> GetFileInfoAsync( string path, CancellationToken cancellationToken = default(CancellationToken)) { await _container.CreateIfNotExistsAsync(); var blob = _container.GetBlockBlobReference(path); try { await blob.FetchAttributesAsync(); var blobInfo = new AzureBlob(blob); return(blobInfo); } catch (StorageException ex) when(StorageExceptionHelper.IsNotFoundStorageException(ex)) { return(new NotFoundFile(path)); } }