public async Task RdTest() { var direct = await FlexibleLoader.LoadAsync("http://www.racedepartment.com/downloads/lut-generator-for-ac.9740/"); Console.WriteLine(direct); Assert.NotNull(direct); }
/// <summary> /// Loads remote file using FlexibleLoader. /// </summary> /// <param name="argument">Remote source.</param> /// <param name="destination">Destination.</param> /// <exception cref="Exception">Thrown if failed or cancelled.</exception> private static async Task LoadRemoteFileToNew(string argument, string destination) { using (var waiting = new WaitingDialog(ControlsStrings.Common_Loading)) { await FlexibleLoader.LoadAsyncTo(argument, (url, information) => new FlexibleLoaderDestination(destination, false), null, information => { if (information.FileName != null) { waiting.Title = $@"Loading {information.FileName}…"; } }, null, waiting, waiting.CancellationToken); } }
private static async Task <string> LoadRemoveFileToNew(string argument, string destination) { using (var waiting = new WaitingDialog(ControlsStrings.Common_Loading)) { return(await FlexibleLoader.LoadAsyncTo(argument, destination, waiting, information => { if (information.FileName != null) { waiting.Title = $@"Loading {information.FileName}…"; } }, waiting.CancellationToken)); } }
private static async Task <string> LoadRemoveFile(string argument, string name = null, string extension = null) { using (var waiting = new WaitingDialog(ControlsStrings.Common_Loading)) { return(await FlexibleLoader.LoadAsyncTo(argument, (url, information) => { var filename = Path.Combine(SettingsHolder.Content.TemporaryFilesLocationValue, name + extension); return new FlexibleLoaderDestination(filename, true); }, null, information => { if (information.FileName != null) { waiting.Title = $@"Loading {information.FileName}…"; } }, null, waiting, waiting.CancellationToken)); } }
public async Task RunAsync(string suggestedName, long totalSize, IWebDownloader downloader) { try { FlexibleLoader.RegisterPriority(this); ContentInstallationManager.Instance.InstallAsync(_url, AddInstallMode.ForceNewTask, ContentInstallationParams.DefaultWithExecutables).Forget(); FlexibleLoader.Unregister(this); var destinationCallback = _destinationCallback; var reportDestinationCallback = _reportDestinationCallback; var progress = _progress; var resultTask = _resultTask; if (destinationCallback == null) { return; } TotalSize = totalSize; FileName = suggestedName; _destinationCallback = null; _reportDestinationCallback = null; _progress = null; var destination = destinationCallback(_url, new FlexibleLoaderMetaInformation { CanPause = false, FileName = suggestedName, TotalSize = totalSize }); reportDestinationCallback?.Invoke(destination.Filename); try { if (SettingsHolder.WebBlocks.NotifyOnWebDownloads) { Toast.Show("New download started", suggestedName ?? _url); } resultTask.TrySetResult(await downloader.DownloadAsync(destination.Filename, progress, _cancellation)); } catch (Exception e) { Logging.Warning(e); resultTask.TrySetException(e); } } catch (Exception e) { Logging.Error(e); } }
private async Task <string> LoadRemoveFileTo(string argument, string destination) { using (var waiting = new WaitingDialog(ControlsStrings.Common_Loading)) { return(await FlexibleLoader.LoadAsyncTo(argument, destination, waiting, waiting.CancellationToken)); } }
private async Task <string> LoadRemoveFile(string argument, string name = null, string extension = null) { using (var waiting = new WaitingDialog(ControlsStrings.Common_Loading)) { return(await FlexibleLoader.LoadAsync(argument, name, extension, waiting, waiting.CancellationToken)); } }