protected virtual void SetItem(IDownloadItem item, Uri actualDownloadUri)
        {
            CurrentDownloadItem      = item;
            item.DownloadingFilename = HttpUtility.UrlDecode(actualDownloadUri.Segments.Last());
            item.CompletedFilename   = item.DownloadingFilename;

            downloader = new PausableEventedDownloader(actualDownloadUri, item.GetDownloadingPath());
            downloader.ProgressChanged          += Downloader_ProgressChanged;
            downloader.StatusChanged            += Downloader_StatusChanged;
            downloader.ReceivedResponseFilename += Downloader_ReceivedResponseFilename;
            item.Progress = new DownloadProgress
            {
                BytesTotal      = 0,
                BytesDownloaded = 0,
                Status          = DownloadStatus.Pending
            };

            // Now it's ready, invoke the handler to get download manager to start (or update)
            DownloadStatusChanged?.Invoke(this, new DownloadEventArgs(CurrentDownloadItem));
        }
Beispiel #2
0
 public void Run(IDownloadItem item)
 {
     File.Move(item.GetDownloadingPath(), item.GetCompletedPath());
 }