Exemplo n.º 1
0
        public static async Task <bool> Download(string url, string path)
        {
            try
            {
                using (var client = new WebClient())
                {
                    await client.DownloadFileTaskAsync(url, path);

                    return(true);
                }
            }
            catch (System.ArgumentNullException) { throw ServerSide.DownloadFailure("Null value for url or path"); }
            catch (System.Net.WebException ex) { throw ServerSide.UrlDownloadFailure(ex.Message + "|" + ex.ToString() + "|" + path); }
            catch (System.InvalidOperationException) { throw ServerSide.FileInUseError(); }
            catch (Exception ex) { throw new Exception(); }
        }