예제 #1
0
 public void LaunchMultipleDownload(String savePath)
 {
     List<DownloadInfo> videosInfo = GetMultipleVideoInfo(savePath);
     if ((videosInfo != null) && videosInfo.Count > 0)
     {
         for (int index = videosInfo.Count - 1; index >= 0; index-- )
         {
             if (videosInfo[index] != null)
             {
                 Download dl = new JustinTVDownload(videosInfo[index].urlVideoFile, manager);
                 dl.videoInfo = videosInfo[index];
                 dl.videoInfo.download = dl;
                 if (!manager.AlreadyDownloading(dl))
                 {
                     dl.isPaused = Settings.Default.batchDLAutoPause;
                     dl.StartDownload();
                 }
             }
         }
     }
 }
예제 #2
0
        internal void CheckPotentialDownload(string clipboardContent)
        {
            try
            {
                clipboardContent = clipboardContent.Trim();
                Download download = null;
                List<String> listeUrl;
                bool multiple = false;
                if (clipboardContent.Contains(Settings.Default.debutUrlYoutube))
                {
                    download = new YoutubeDownload(this, clipboardContent);
                    download.LaunchDownload(Settings.Default.saveDialog, Settings.Default.savePath);
                }
                else
                {
                    listeUrl = CheckClipboardContent(clipboardContent);
                    if (listeUrl != null)
                    {
                        multiple = listeUrl.Count > 1;
                        String multipleSavePath = Settings.Default.savePath;
                        if (multiple && Settings.Default.saveDialog)
                        {
                            lock (mainWindowPtr)
                            {
                                using (FolderBrowserDialog dlg = new FolderBrowserDialog())
                                {
                                    dlg.Description = Properties.Resources.titreFolderBrowserDialog;
                                    dlg.SelectedPath = multipleSavePath;
                                    dlg.ShowNewFolderButton = true;
                                    DialogResult result = dlg.ShowDialog(mainWindowPtr);
                                    if (result == System.Windows.Forms.DialogResult.OK)
                                    {
                                        multipleSavePath = Helper.CheckPath(dlg.SelectedPath);
                                    }
                                    else
                                        listeUrl.Clear();
                                }
                            }
                        }

                        foreach (String urlPage in listeUrl)
                        {
                            if (urlPage.Contains(Settings.Default.youtubePageUrl))
                                download = new YoutubeDownload(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.youtubeVideoInfoAPIUrl))
                                download = new YoutubeDownloadAPI(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.justinTVPageUrl))
                                download = new JustinTVDownload(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.dailyMotionPageUrl))
                                download = new DailyMotionDownload(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.giantBombPageUrl))
                                download = new GiantBombDownload(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.gamespotPageUrl))
                                download = new GamespotDownload(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.blipTvPageUrl))
                                download = new BlipTvDownload(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.vimeoPageUrl))
                                download = new VimeoDownload(urlPage, this);
                            else if (urlPage.Contains(Settings.Default.gametrailersVideoPageUrl))
                                download = new GametrailersDownload(urlPage, this);

                            if ((download != null) && (!AlreadyDownloading(download)) && !stop)
                            {
                                if (multiple)
                                {
                                    download.isPaused = Settings.Default.batchDLAutoPause;
                                    download.LaunchDownload(false, multipleSavePath);
                                }
                                else
                                    download.LaunchDownload(Settings.Default.saveDialog, Settings.Default.savePath);
                            }

                        }
                    }
                }

                /*BackgroundWorker bw = new BackgroundWorker();
                bw.WorkerReportsProgress = false;
                bw.WorkerSupportsCancellation = false;
                bw.DoWork += new DoWorkEventHandler(bw_DoWork);
                bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
                bw.RunWorkerAsync(download);
                listeBackgroundWorkers.Add(bw);*/
                //Thread t = new Thread(new ThreadStart(download.LaunchDownload));
                //t.Start();
                //}
            }
            catch (Exception ex)
            {
                AddErrorMsg("DownloadManagerM.CheckPotentialDownload ", ex);
            }
        }