/// <summary> /// Download an Azure file from Azure File Storage. /// </summary> /// <param name="sourceFile">The <see cref="CloudFile"/> that is the source Azure file.</param> /// <param name="destPath">Path to the destination file.</param> /// <param name="options">A <see cref="DownloadOptions"/> object that specifies additional options for the operation.</param> /// <param name="context">A <see cref="TransferContext"/> object that represents the context for the current operation.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> object to observe while waiting for a task to complete.</param> /// <returns>A <see cref="Task"/> object that represents the asynchronous operation.</returns> public static Task DownloadAsync(CloudFile sourceFile, string destPath, DownloadOptions options, TransferContext context, CancellationToken cancellationToken) { AzureFileLocation sourceLocation = new AzureFileLocation(sourceFile); FileLocation destLocation = new FileLocation(destPath); if (options != null) { sourceLocation.AccessCondition = options.SourceAccessCondition; FileRequestOptions requestOptions = Transfer_RequestOptions.DefaultFileRequestOptions; requestOptions.DisableContentMD5Validation = options.DisableContentMD5Validation; sourceLocation.FileRequestOptions = requestOptions; } return DownloadInternalAsync(sourceLocation, destLocation, context, cancellationToken); }
/// <summary> /// Upload a file to Azure File Storage. /// </summary> /// <param name="sourcePath">Path to the source file.</param> /// <param name="destFile">The <see cref="CloudFile"/> that is the destination Azure file.</param> /// <param name="options">An <see cref="UploadOptions"/> object that specifies additional options for the operation.</param> /// <param name="context">A <see cref="TransferContext"/> object that represents the context for the current operation.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> object to observe while waiting for a task to complete.</param> /// <returns>A <see cref="Task"/> object that represents the asynchronous operation.</returns> public static Task UploadAsync(string sourcePath, CloudFile destFile, UploadOptions options, TransferContext context, CancellationToken cancellationToken) { FileLocation sourceLocation = new FileLocation(sourcePath); AzureFileLocation destLocation = new AzureFileLocation(destFile); if (options != null) { destLocation.AccessCondition = options.DestinationAccessCondition; } return UploadInternalAsync(sourceLocation, destLocation, options, context, cancellationToken); }