예제 #1
0
        private void GetMedia_Click(object sender, RoutedEventArgs e)
        {
            Dir  dir      = new Dir();
            bool letsDoIt = true;

            string url = urlToAdd.Text;

            if (!Url.Valid(url))
            {
                letsDoIt = false;
                MessageBox.Show(msgInvalidUrl);
            }

            if (!dir.CheckFolderPath(saveToDirectory.Text) && letsDoIt)
            {
                letsDoIt = false;
                MessageBox.Show(msgInvalidFolderPath);
            }

            if (letsDoIt)
            {
                string btncontent = (sender as Button).Name.ToString();

                consoleControl.ClearOutput();
                DisableSubButtons();
                DisableMediaButton();

                if (btncontent == "btnAudioOnly")
                {
                    btnAudioOnly.Background = Brushes.LawnGreen;
                    YoutubeDLProcess(url, cbAudio.SelectedValue.ToString(), null);
                }
                else if (btncontent == "btnAudioOnlyMP3")
                {
                    btnAudioOnlyMP3.Background = Brushes.LawnGreen;
                    YoutubeDLProcess(url, cbAudio.SelectedValue.ToString(), null, true);
                }
                else if (btncontent == "btnVideoOnly")
                {
                    btnVideoOnly.Background = Brushes.LawnGreen;
                    YoutubeDLProcess(url, null, cbVideo.SelectedValue.ToString());
                }
                else if (btncontent == "btnAudioPlusVideo")
                {
                    btnAudioPlusVideo.Background = Brushes.LawnGreen;
                    YoutubeDLProcess(url, cbAudio.SelectedValue.ToString(), cbVideo.SelectedValue.ToString());
                }
            }
        }