private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            Subscription.Settings.SavePath             = SaveDirectoryTextBox.Text;
            Subscription.Settings.PreferQuality        = PreferCheckBox.IsChecked.Value;
            Subscription.Settings.PreferHighestFPS     = PreferHighestFPSCheckBox.IsChecked.Value;
            Subscription.Settings.Quality              = Resolutions[(string)ResulotionDropDown.SelectedValue];
            Subscription.Settings.Convert              = ConvertCheckBox.IsChecked.Value;
            Subscription.Settings.SaveFormat           = ExtensionsDropDown.SelectedItem.ToString();
            Subscription.Settings.SetBitrate           = BitrateCheckBox.IsChecked.Value;
            Subscription.Settings.DownloadCaptions     = CaptionsCheckBox.IsChecked.Value;
            Subscription.Settings.CaptionsLanguage     = Languages.FirstOrDefault(x => x.Value.Equals((string)CaptionsLanguagesComboBox.SelectedItem, StringComparison.OrdinalIgnoreCase)).Key;
            Subscription.Settings.FilterVideosByLength = FilterByLengthCheckBox.IsChecked.Value;

            if (double.TryParse(FilterByLengthTextBox.Text, out double result))
            {
                Subscription.Settings.FilterByLengthValue = result;
            }

            Subscription.Settings.FilterMode = FilterByLengthShorterOrLongerDropDown.SelectedItem.Equals(FindResource("Longer"));

            if (Subscription.Settings.SetBitrate && BitRateTextBox.Text.All(x => char.IsDigit(x)))
            {
                Subscription.Settings.Bitrate = BitRateTextBox.Text;
            }
            else
            {
                Subscription.Settings.SetBitrate = false;
                Subscription.Settings.Bitrate    = string.Empty;
            }
            Subscription.Settings.AudioOnly = AudioOnlyCheckBox.IsChecked.Value;


            SubscriptionManager.SaveSubscriptions();
            GlobalConsts.CloseFlyout();
        }
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            bool   convert          = ConvertCheckBox.IsChecked.Value;
            bool   preferQuality    = PreferCheckBox.IsChecked.Value;
            bool   setBitrate       = BitrateCheckBox.IsChecked.Value;
            var    vq               = VideoQuality.High720;
            string type             = "mp3";
            string bitrate          = null;
            bool   audioOnly        = AudioOnlyCheckBox.IsChecked.Value;
            bool   preferHighestFPS = PreferHighestFPSCheckBox.IsChecked.Value;
            bool   downloadCaptions = CaptionsCheckBox.IsChecked.Value;
            string captionsLanguage = Languages.FirstOrDefault(x => x.Value.Equals((string)CaptionsLanguagesComboBox.SelectedItem, StringComparison.OrdinalIgnoreCase)).Key;


            if (BitrateCheckBox.IsChecked.Value)
            {
                if (!string.IsNullOrWhiteSpace(BitRateTextBox.Text) && BitRateTextBox.Text.All(c => char.IsDigit(c)))
                {
                    bitrate = BitRateTextBox.Text;
                }
            }


            if (PreferCheckBox.IsChecked.Value)
            {
                vq = Resolutions[(string)ResulotionDropDown.SelectedValue];
            }

            if (convert)
            {
                type = (string)ExtensionsDropDown.SelectedItem;
            }



            GlobalConsts.DownloadSettings = new Objects.DownloadSettings(type, audioOnly, vq, preferHighestFPS, preferQuality, convert, setBitrate, bitrate, downloadCaptions, captionsLanguage);
            GlobalConsts.CloseFlyout();
        }
コード例 #3
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            bool   convert               = ConvertCheckBox.IsChecked.Value;
            bool   preferQuality         = PreferCheckBox.IsChecked.Value;
            bool   setBitrate            = BitrateCheckBox.IsChecked.Value;
            var    vq                    = VideoQuality.High720;
            string type                  = "mp3";
            string bitrate               = null;
            bool   audioOnly             = AudioOnlyCheckBox.IsChecked.Value;
            bool   preferHighestFPS      = PreferHighestFPSCheckBox.IsChecked.Value;
            bool   downloadCaptions      = CaptionsCheckBox.IsChecked.Value;
            bool   playlistDirectories   = UniquePlaylistDirectoryCheckBox.IsChecked.Value;
            string captionsLanguage      = Languages.FirstOrDefault(x => x.Value.Equals((string)CaptionsLanguagesComboBox.SelectedItem, StringComparison.OrdinalIgnoreCase)).Key;
            bool   subset                = PlaylistIndexCheckBox.IsChecked.Value;
            bool   openDestinationFolder = OpenDestinationFolderCheckBox.IsChecked.Value;
            bool   tagAudioFile          = TagAudioFileCheckBox.IsChecked.Value;

            int startIndex = 0, endIndex = 0;

            if (subset)
            {
                if (!int.TryParse(PlaylistStartIndexTextBox.Text, out startIndex) || startIndex < 1)
                {
                    startIndex = 0;
                    PlaylistStartIndexTextBox.Background = GlobalConsts.ErrorBrush;
                }
                else
                {
                    PlaylistStartIndexTextBox.Background = null;
                }


                if (!int.TryParse(PlaylistEndIndexTextBox.Text, out endIndex))
                {
                    endIndex = 0;
                    PlaylistEndIndexTextBox.Background = GlobalConsts.ErrorBrush;
                }
                else
                {
                    PlaylistEndIndexTextBox.Background = null;
                }
            }

            if (BitrateCheckBox.IsChecked.Value)
            {
                if (!string.IsNullOrWhiteSpace(BitRateTextBox.Text) && BitRateTextBox.Text.All(c => char.IsDigit(c)))
                {
                    bitrate = BitRateTextBox.Text;
                }
            }


            if (PreferCheckBox.IsChecked.Value)
            {
                vq = Resolutions[(string)ResulotionDropDown.SelectedValue];
            }

            if (convert)
            {
                type = (string)ExtensionsDropDown.SelectedItem;
            }



            GlobalConsts.DownloadSettings = new Objects.DownloadSettings(type, audioOnly, vq, preferHighestFPS, preferQuality, convert, setBitrate, bitrate, downloadCaptions, captionsLanguage, playlistDirectories, subset, startIndex, endIndex, openDestinationFolder, tagAudioFile);
            GlobalConsts.CloseFlyout();
        }