コード例 #1
0
        private void downloadLink_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(this.urlTextBox.Text) &&
                !string.IsNullOrWhiteSpace(this.directoryTextBox.Text) &&
                Directory.Exists(this.directoryTextBox.Text))
            {
                try
                {
                    UrlProcessor.ValidateURL(this.urlTextBox.Text, this.playlistButton.Highlight);

                    this.downloadPanel = new DownloadPanel(this);
                    this.downloadPanel.CancelDownload = false;

                    this.downloadManager = new DownloadManager(this.playlistButton.Highlight
                                                               , this.videoButton.Highlight
                                                               , this.audioQulityBar.Value
                                                               , this.videoQulityBar.Value
                                                               , this.directoryTextBox.Text
                                                               , this.urlTextBox.Text
                                                               , downloadPanel);

                    downloadPanel.Swipe(true);
                    this.downloadManager.StartDownloading();
                }
                catch (ArgumentException ae)
                {
                    string errorLabel = this.playlistButton.Highlight ? GlobalMessages.InvalidPlaylistUrl : GlobalMessages.InvalidVideoUrl;
                    MetroMessageBox.Show(this, ae.Message, errorLabel, MessageBoxButtons.OK, MessageBoxIcon.Error, 180);
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #2
0
ファイル: DownloadManager.cs プロジェクト: MarioZisov/YouLab
 private void ExctractUrls()
 {
     if (!isPlaylist)
     {
         this.urls.Add(this.url);
     }
     else
     {
         UrlProcessor.ExtractUrls(this.url, ref this.urls);
     }
 }