protected override async Task <DownloadResult> DoDownload(DownloadOption downloadOption) { try { var run = await downloadOption.RunDownload(ydl, this, cts.Token, progress); DownloadPath = run.Data; if (!run.Success) { return(DownloadResult.Failed); } } catch (Exception ex) { // TODO Clean up partially downloaded files? DownloadPath = String.Empty; if (ex is TaskCanceledException) { return(DownloadResult.Cancelled); } else { return(DownloadResult.Failed); } } Debug.WriteLine($"Finished downloading to: \"{DownloadPath}\""); return(DownloadResult.Success); }
protected override async Task <DownloadResult> DoDownload(DownloadOption downloadOption) { try { var run = await downloadOption.RunDownload(ydl, this, cts.Token, progress); DownloadPaths = run.Data; // TODO When does playlist download count as 'failed'? if (!run.Success) { return(DownloadResult.Failed); } } catch (Exception ex) { // TODO Clean up partially downloaded files? DownloadPaths = null; if (ex is TaskCanceledException) { return(DownloadResult.Cancelled); } else { return(DownloadResult.Failed); } } return(DownloadResult.Success); }