示例#1
0
 public abstract void Download(
     string id,
     string filePath,
     Uri url,
     IEnumerable <KeyValuePair <string, string> > cookies,
     bool disableTracking,
     DownloadChangedEventHandler downloadChanged     = null,
     DownloadCompletedEventHandler downloadCompleted = null);
示例#2
0
 public DownloadItem(string downloaderName, string file, Uri url, IEnumerable <KeyValuePair <string, string> > cookies,
                     DownloadChangedEventHandler downloadChanged     = null,
                     DownloadCompletedEventHandler downloadCompleted = null)
 {
     DownloaderName    = downloaderName;
     File              = file;
     Url               = url;
     Cookies           = cookies;
     DownloadChanged   = downloadChanged;
     DownloadCompleted = downloadCompleted;
     DownloadStatus    = new DownloadInfo(file, url);
 }
 public CurlDownloadInfo(
     string id,
     string outputFile,
     Uri url,
     IEnumerable <KeyValuePair <string, string> > cookies = null,
     bool disableTracking = false,
     DownloadChangedEventHandler downloadChanged     = null,
     DownloadCompletedEventHandler downloadCompleted = null)
 {
     Id                = id;
     OutputFile        = outputFile;
     Url               = url;
     Cookies           = cookies;
     DisableTracking   = disableTracking;
     DownloadChanged   = downloadChanged;
     DownloadCompleted = downloadCompleted;
 }
示例#4
0
        public override void Download(
            string id,
            string filePath,
            Uri url,
            IEnumerable <KeyValuePair <string, string> > cookies,
            bool disableTracking,
            DownloadChangedEventHandler downloadChanged     = null,
            DownloadCompletedEventHandler downloadCompleted = null)
        {
            var outputFilePath = filePath.ToSafePath();

            var downloadInfo = new CurlDownloadInfo(id, outputFilePath, url, cookies, disableTracking, downloadChanged, downloadCompleted);

            PrepareOutputDirectory(outputFilePath);

            Sys.RunProcess(
                _curlBin,
                downloadInfo.GetCommadArguments(),
                true,
                (data) => HandleDownloadFeedback(data, downloadInfo),
                HandleDownloadError,
                (exitCode) => HandleDownloadCompleted(exitCode, downloadInfo));
        }