Ejemplo n.º 1
0
        private static async Task DownloadFromYoutube(Downloader downloader, IEnumerable <Type> exceptionTypes, IObserver <double> progress)
        {
            try
            {
                await Task.Run(() => downloader.Execute());
            }

            catch (Exception ex)
            {
                Exception outer = new YoutubeDownloadException("Youtube video or audio download failed", ex);

                if (exceptionTypes.Contains(ex.GetType()))
                {
                    progress.OnError(outer);
                }

                throw outer;
            }

            progress.OnCompleted();
        }
Ejemplo n.º 2
0
        private static async Task DownloadFromYoutube(Downloader downloader, IEnumerable<Type> exceptionTypes, IObserver<double> progress)
        {
            try
            {
                await Task.Run(() => downloader.Execute());
            }

            catch (Exception ex)
            {
                Exception outer = new YoutubeDownloadException("Youtube video or audio download failed", ex);

                if (exceptionTypes.Contains(ex.GetType()))
                {
                    progress.OnError(outer);
                }

                throw outer;
            }

            progress.OnCompleted();
        }