/// <summary> /// 获取下载任务 /// </summary> /// <param name="info"></param> /// <returns></returns> public static HttpDownload GetTaskByInfo(DownloadInfo info) { return(new HttpDownload() { Url = info.DownloadUrl, DownloadPath = info.DownloadPath, UserCookies = info.UserCookies, Domain = info.Domain, Referer = info.Referer, ThreadNum = info.DownloadBlockList.Count, UserAgent = info.UserAgent, Info = info }); }
/// <summary> /// 创建数据 /// </summary> public async Task <DownloadInfo> CreateData() { return(await Task.Run(() => { var response = GetResponse(); if (response == null) { throw new NullReferenceException("下载链接已失效"); } var info = new DownloadInfo { ContentLength = response.ContentLength, BlockLength = response.ContentLength / ThreadNum, DownloadUrl = Url, DownloadPath = DownloadPath, UserCookies = UserCookies, Domain = Domain, Referer = Referer, UserAgent = UserAgent }; info.init(); return info; })); }