Esempio n. 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Initialize main window and view model
            var mainWindow = new DownloadManagerV();
            var downloadManagerMV = new DownloadManagerMV();
            mainWindow.DataContext = downloadManagerMV;
            mainWindow.Show();
        }
Esempio n. 2
0
        public DownloadInfo(String urlVideoFile, String videoTitre, long videoTaille, String filePath, String extension, DownloadManagerMV managerMV, DownloadManagerM managerM, Download download, int videoIndex = -1)
        {
            this.p_downloadManagerMV = managerMV;
            this.p_downloadManagerM = managerM;
            this.p_titre = videoTitre;
            this.p_taille = videoTaille;
            this.urlVideoFile = urlVideoFile;
            this.p_saveFilePath = filePath;
            this.p_fileExtension = extension;
            this.download = download;
            this.fileExistsAlready = false;
            this.videoIndex = videoIndex;

            SetFileName();
            CheckIndexation();

            p_downloaded = 0;
            p_lastTime = DateTime.Now;
            downloadedLast = 0;
            p_speed = 0;
        }
Esempio n. 3
0
        public DownloadManagerM(DownloadManagerMV manager)
        {
            stop = false;
            this.managerMV = manager;
            String[] regexSeparateur = new String[1];
            regexSeparateur[0] = Settings.Default.regexSeparateur;
            String multipleRegexes;

            indexRegex = new Regex("index=(?<index>[0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);

            youtubeRegex = new List<Regex>();
            /*
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoEmbedUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoOldEmbedUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoUrlAbrege, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeChannelVideo, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            multipleRegexes = Settings.Default.allYoutubeRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                youtubeRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            dailymotionRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allDailyMotionRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                dailymotionRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*dailymotionRegex.Add(new Regex(Settings.Default.regexDailyMotionVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            dailymotionRegex.Add(new Regex(Settings.Default.regexDailyMotionEmbedVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            justinTVRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allJustinTvRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                justinTVRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*            justinTVRegex.Add(new Regex(Settings.Default.regexJustinTVVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            justinTVRegex.Add(new Regex(Settings.Default.regexTwitchTVVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */

            gameanyoneRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexGameanyone;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                gameanyoneRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            //gameanyoneRegex.Add(new Regex(Settings.Default.regexGameanyone, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            giantBombRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexGiantBombVideoUrl;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                giantBombRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            //giantBombRegex.Add(new Regex(Settings.Default.regexGiantBombVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            gamespotRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexGamespotVideoUrl;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                gamespotRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            //gamespotRegex.Add(new Regex(Settings.Default.regexGamespotVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            blipTvRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexBlipTvVideoUrl;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                blipTvRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            //blipTvRegex.Add(new Regex(Settings.Default.regexBlipTvVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            vimeoRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allVimeoRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                vimeoRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*            vimeoRegex.Add(new Regex(Settings.Default.regexVimeo, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            vimeoRegex.Add(new Regex(Settings.Default.regexVimeoEmbed, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            youtubePlaylistRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allYoutubePlaylistRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                youtubePlaylistRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*            youtubePlaylistRegex.Add(new Regex(Settings.Default.regexYoutubePalylist1, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubePlaylistRegex.Add(new Regex(Settings.Default.regexYoutubePalylist2, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubePlaylistRegex.Add(new Regex(Settings.Default.regexYoutubePalylist3, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            gametrailersRegex = new List<Regex>();
            multipleRegexes = Settings.Default.gametrailersRegex;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                gametrailersRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            videoUrlRegex = new List<Regex>();
            multipleRegexes = Settings.Default.videoUrlRegex;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                videoUrlRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            CheckSettings();

            var cme = new System.Net.Configuration.ConnectionManagementElement();
            cme.MaxConnection = 65000;
            System.Net.ServicePointManager.DefaultConnectionLimit = 65000;

            listeDownload = new SyncedList<Download>();
            waitingListeSegment = new SyncedList<Segment>();
            listeSegmentEnCours = new SyncedList<Segment>();
            listeBackgroundWorkers = new List<BackgroundWorker>();
            lastCheck = DateTime.Now;

            moniteur = new ClipboardMonitor(this);
            moniteur.Show();

            youtubeCookieContainer = null;
        }