private void textBoxSubs2File_Validating(object sender, CancelEventArgs e)
        {
            string error       = null;
            string filePattern = ((TextBox)sender).Text.Trim();

            string[] files = UtilsCommon.getNonHiddenFiles(filePattern);

            if ((error == null) && (UtilsSubs.getNumSubsFiles(filePattern) == 0))
            {
                error = "Please provide a valid subtitle file. \nOnly .srt, .ass and .ssa are allowed.";
                invalidCount++;
            }

            if ((error == null))
            {
                foreach (string f in files)
                {
                    if (!isSupportedSubtitleFormat(f))
                    {
                        error = "Please provide a valid subtitle file. \nOnly .srt, .ass and .ssa are allowed.";
                        invalidCount++;
                        break;
                    }
                }
            }

            if ((error == null) && (UtilsSubs.getNumSubsFiles(filePattern) != UtilsSubs.getNumSubsFiles(textBoxSubs1File.Text.Trim())))
            {
                error = "The number of files here must match\nthe number of subtitle files in Subs1.";
                invalidCount++;
            }

            errorProvider1.SetError((Control)sender, error);
        }
        private void textBoxSubs2File_Validating(object sender, CancelEventArgs e)
        {
            string error       = null;
            string filePattern = ((TextBox)sender).Text.Trim();

            string[] files = UtilsCommon.getNonHiddenFiles(filePattern);

            if (groupBoxCheckLyrics.Checked)
            {
                if ((radioButtonTimingSubs2.Checked) && (filePattern == ""))
                {
                    error = "Since you want to use subs2 timings,\nplease enter a valid Subs2 subtitle file here";
                    invalidCount++;
                }

                if ((error == null) && (filePattern != ""))
                {
                    if ((error == null) && (UtilsSubs.getNumSubsFiles(filePattern) == 0))
                    {
                        error = "Please provide a valid subtitle file. \nOnly .srt, .ass, .ssa, .lrc and .trs are allowed.";
                        invalidCount++;
                    }

                    if ((error == null))
                    {
                        foreach (string f in files)
                        {
                            if (!isSupportedSubtitleFormat(f))
                            {
                                error = "Please provide a valid subtitle file. \nOnly .srt, .ass, .ssa, .lrc and .trs are allowed.";
                                invalidCount++;
                                break;
                            }
                        }
                    }

                    if ((error == null) && (UtilsSubs.getNumSubsFiles(filePattern) != UtilsCommon.getNonHiddenFiles(textBoxMediaFile.Text.Trim()).Length))
                    {
                        error = "The number of files here must match\nthe number of files in Media";
                        invalidCount++;
                    }
                }
            }

            errorProvider1.SetError((Control)sender, error);
        }
Example #3
0
        /// <summary>
        /// Update the episode combo box with all episodes. Uses the First Episode field.
        /// </summary>
        private void populateEpisodeComboBox()
        {
            int numEpisodes  = UtilsSubs.getNumSubsFiles(Settings.Instance.Subs[0].FilePattern);
            int firstEpisode = Settings.Instance.EpisodeStartNumber;

            int lastSelectedEpisodeIndex = 0;

            if (comboBoxEpisode.SelectedIndex != -1)
            {
                lastSelectedEpisodeIndex = comboBoxEpisode.SelectedIndex;
            }

            comboBoxEpisode.Items.Clear();

            for (int i = 0; i < numEpisodes; i++)
            {
                int episodeNum = i + firstEpisode;
                comboBoxEpisode.Items.Add(episodeNum);
            }

            comboBoxEpisode.SelectedIndex = lastSelectedEpisodeIndex;
        }