Beispiel #1
0
        /// <summary>
        /// 根据url下载
        /// </summary>
        /// <param name="uri"></param>
        /// <returns></returns>
        public async Task <bool> UrlDownload(string urlFileName, string savefilePath)
        {
            string downloadPartPath = savefilePath + DownloadFile.Ext;
            string downloadPartDir  = Path.GetDirectoryName(downloadPartPath);

            if (!Directory.Exists(downloadPartDir))
            {
                Directory.CreateDirectory(downloadPartDir);
            }
            string url = this.downloadUrl + "?fileName=" + urlFileName;

            using (DownloadFile downloadFile = DownloadFile.FromUrl(downloadPartPath, url))
            {
                return(await DoDownloadFile(downloadFile));
            }
        }