/// <summary> /// Returns a new <see cref="IAsset"/> with the file in <paramref name="filePath"/>. /// </summary> /// <param name="context">The <see cref="CloudMediaContext"/> instance.</param> /// <param name="filePath">The path to the file to upload to the new <see cref="IAsset"/>.</param> /// <param name="storageAccountName">The name of the Storage Account where to store the new <see cref="IAsset"/>.</param> /// <param name="options">The <see cref="AssetCreationOptions"/>.</param> /// <param name="uploadProgressChangedCallback">A callback to report the upload progress of the file.</param> /// <returns>A new <see cref="IAsset"/> with the file in <paramref name="filePath"/>.</returns> public static IAsset CreateAssetFromFile(this CloudMediaContext context, string filePath, string storageAccountName, AssetCreationOptions options, Action <IAssetFile, UploadProgressChangedEventArgs> uploadProgressChangedCallback) { using (Task <IAsset> task = context.CreateAssetFromFileAsync(filePath, storageAccountName, options, uploadProgressChangedCallback, CancellationToken.None)) { return(task.Result); } }
/// <summary> /// Returns a <see cref="System.Threading.Tasks.Task<IAsset>"/> instance for a new <see cref="IAsset"/> with the file in <paramref name="filePath"/>. /// </summary> /// <param name="context">The <see cref="CloudMediaContext"/> instance.</param> /// <param name="filePath">The path to the file to upload to the new <see cref="IAsset"/>.</param> /// <param name="options">The <see cref="AssetCreationOptions"/>.</param> /// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> instance used for cancellation.</param> /// <returns>A <see cref="System.Threading.Tasks.Task<IAsset>"/> instance for a new <see cref="IAsset"/> with the file in <paramref name="filePath"/>.</returns> public static Task <IAsset> CreateAssetFromFileAsync(this CloudMediaContext context, string filePath, AssetCreationOptions options, CancellationToken cancellationToken) { return(context.CreateAssetFromFileAsync(filePath, options, null, cancellationToken)); }
/// <summary> /// Returns a <see cref="System.Threading.Tasks.Task<IAsset>"/> instance for a new <see cref="IAsset"/> with the file in <paramref name="filePath"/>. /// </summary> /// <param name="context">The <see cref="CloudMediaContext"/> instance.</param> /// <param name="filePath">The path to the file to upload to the new <see cref="IAsset"/>.</param> /// <param name="options">The <see cref="AssetCreationOptions"/>.</param> /// <param name="uploadProgressChangedCallback">A callback to report the upload progress of the file.</param> /// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> instance used for cancellation.</param> /// <returns>A <see cref="System.Threading.Tasks.Task<IAsset>"/> instance for a new <see cref="IAsset"/> with the file in <paramref name="filePath"/>.</returns> public static Task <IAsset> CreateAssetFromFileAsync(this CloudMediaContext context, string filePath, AssetCreationOptions options, Action <IAssetFile, UploadProgressChangedEventArgs> uploadProgressChangedCallback, CancellationToken cancellationToken) { return(context.CreateAssetFromFileAsync(filePath, null, options, uploadProgressChangedCallback, cancellationToken)); }