Exemple #1
0
        private void AddDownloadingTask(DownloadInfo info)
        {
            var download = HttpDownload.GetTaskByInfo(info);

            download.DownloadStateChangedEvent      += Download_DownloadStateChangedEvent;
            download.DownloadPercentageChangedEvent += Download_DownloadPercentageChangedEvent;
            download.Start();
            _downloadingTasks.Add(download);
        }
Exemple #2
0
        public async Task <NextResult> CreateData(DownloadingFileData info, DownloadResult result)
        {
            try
            {
                foreach (var url in result.DownloadUrlList)
                {
                    var httpInfo = await HttpDownload.CreateTaskInfo(url.Value.UrlLists, info.DownloadPath, _user.DownloadThreadNumber,
                                                                     result.Cookies);

                    info.Info = httpInfo;
                    info.Save();
                    return(new NextResult(httpInfo, 0, string.Empty));
                }
                return(null);
            }
            catch (NullReferenceException)
            {
                return(null);
            }
        }
        public async Task <NextResult> CreateData(DownloadingFileData info, DownloadResult result)
        {
            try
            {
                foreach (var url in result.DownloadUrlList)
                {
                    var httpInfo = await HttpDownload.CreateTaskInfo(url.Value.UrlLists, info.DownloadPath, (int)Container.Resolve <ILocalConfigInfo>().SpeedLimit,
                                                                     result.Cookies);

                    info.Info = httpInfo;
                    info.Save();
                    return(new NextResult(httpInfo, 0, string.Empty));
                }
                return(null);
            }
            catch (NullReferenceException)
            {
                return(null);
            }
        }