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);
        }
Пример #2
0
        /// <summary>
        /// Extract a video clip from a longer video clip without re-encoding.
        /// </summary>
        public static void cutVideo(string inFile, DateTime startTime, DateTime endTime, string outFile)
        {
            string startTimeArg = formatStartTimeArg(startTime);
            string durationArg  = formatDurationArg(startTime, endTime);
            string timeArg      = formatStartTimeAndDurationArg(startTime, endTime);

            string ffmpegCutArgs = "";

            // Example format:
            // -y -i -ss 00:00:00.000 -t "input.avi" -t 00:00:01.900 -c copy "output.avi"
            // Note: The order of the arguments is strange, but unless -ss comes before -i,
            //       the video will SOMETIMES fail to copy and the output will consist
            //       of only the audio. Lots of experimentation involved.
            ffmpegCutArgs = $"-y {startTimeArg} -i \"{inFile}\" {durationArg} -c copy \"{outFile}\""; // {3}

            UtilsCommon.startFFmpeg(ffmpegCutArgs, false, true);
        }
Пример #3
0
        /// <summary>
        /// Does the expanded file pattern contain vobsubs?
        /// </summary>
        public static bool filePatternContainsVobsubs(string filePattern)
        {
            bool containsVobsubs = false;

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

            foreach (string file in subsFiles)
            {
                string ext = file.Substring(file.LastIndexOf(".")).ToLower();

                if (ext == ".idx")
                {
                    containsVobsubs = true;
                    break;
                }
            }

            return(containsVobsubs);
        }
Пример #4
0
        /// <summary>
        /// In the provided file pattern have a corresponding .sub file for each .idx file encountered?
        /// </summary>
        public static bool isVobsubFilePatternCorrect(string filePattern)
        {
            bool isCorrect = false;
            int  numIdx    = 0;
            int  numSub    = 0;

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

            foreach (string file in subsFiles)
            {
                string ext = file.Substring(file.LastIndexOf(".")).ToLower();

                if (ext == ".idx")
                {
                    numIdx++;

                    string fileNoExt = file.Substring(0, file.LastIndexOf("."));
                    string subFile   = fileNoExt + ".sub";

                    if (File.Exists(subFile))
                    {
                        numSub++;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if ((numIdx > 0) && (numIdx == numSub))
            {
                isCorrect = true;
            }


            return(isCorrect);
        }
        private void textBoxMediaFile_TextChanged(object sender, EventArgs e)
        {
            string filePattern = this.textBoxMediaFile.Text.Trim();

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

            this.comboBoxStreamAudioFromVideo.Enabled = true;
            this.labelAudioStream.Enabled             = true;

            this.comboBoxStreamAudioFromVideo.Items.Clear();

            if (files.Length != 0)
            {
                // Based on the first video file in the file pattern, get the list of available streams.
                string            firstFile    = files[0];
                List <InfoStream> audioStreams = UtilsVideo.getAvailableAudioStreams(firstFile);

                if (audioStreams.Count > 0)
                {
                    foreach (InfoStream stream in audioStreams)
                    {
                        this.comboBoxStreamAudioFromVideo.Items.Add(stream);
                    }
                }
                else
                {
                    // Show the default stream when the available streams cannot be detected
                    this.comboBoxStreamAudioFromVideo.Items.Add(new InfoStream());
                }

                this.comboBoxStreamAudioFromVideo.SelectedIndex = 0;
            }
            else
            {
                this.comboBoxStreamAudioFromVideo.Enabled = false;
                this.labelAudioStream.Enabled             = false;
            }
        }
Пример #6
0
        /// <summary>
        /// Rip (and re-encode) a portion of the audio from a video file.
        /// </summary>
        public static void ripAudioFromVideo(string inFile, string stream, DateTime startTime,
                                             DateTime endTime, int bitrate, string outFile, DialogProgress dialogProgress)
        {
            string audioBitrateArg = UtilsVideo.formatAudioBitrateArg(bitrate);
            string audioMapArg     = UtilsVideo.formatAudioMapArg(stream);
            string timeArg         = UtilsVideo.formatStartTimeAndDurationArg(startTime, endTime);

            string ffmpegAudioProgArgs = "";

            // Example format:
            // -vn -y -i "G:\Temp\inputs.mkv" -ac 2 -map 0:1 -ss 00:03:32.420 -t 00:02:03.650 -b:a 128k -threads 0 "output.mp3"
            ffmpegAudioProgArgs =
                $"-vn -y -i \"{inFile}\" -ac 2 {audioMapArg} {timeArg} {audioBitrateArg} -threads 0 \"{outFile}\""; // {4}

            if (dialogProgress == null)
            {
                UtilsCommon.startFFmpeg(ffmpegAudioProgArgs, false, true);
            }
            else
            {
                UtilsCommon.startFFmpegProgress(ffmpegAudioProgArgs, dialogProgress);
            }
        }
Пример #7
0
        private void computeNewDimesions()
        {
            int widthIncrement  = 2;
            int heightIncrement = 2;

            newRes.Width  = (int)(((float)this.numericUpDownPercent.Value / 100.0) * (int)numericUpDownOrigWidth.Value);
            newRes.Height = (int)(((float)this.numericUpDownPercent.Value / 100.0) * (int)numericUpDownOrigHeight.Value);

            if (chooserType == VideoDimesionsChoooserType.Video)
            {
                widthIncrement = 16;
            }

            newRes.Width  = UtilsCommon.getNearestMultiple(newRes.Width, widthIncrement);
            newRes.Height = UtilsCommon.getNearestMultiple(newRes.Height, heightIncrement);

            if (newRes.Width < 16)
            {
                newRes.Width = 16;
            }
            else if (newRes.Width > 2048)
            {
                newRes.Width = 2048;
            }

            if (newRes.Height < 16)
            {
                newRes.Height = 16;
            }
            else if (newRes.Height > 2048)
            {
                newRes.Height = 2048;
            }

            this.textBoxNewWidth.Text  = newRes.Width.ToString();
            this.textBoxNewHeight.Text = newRes.Height.ToString();
        }
Пример #8
0
        /// <summary>
        /// Rip (and re-encode) a portion of the audio from a video file.
        /// </summary>
        public static void ripAudioFromVideo(string inFile, string stream, DateTime startTime,
                                             DateTime endTime, int bitrate, string outFile, DialogProgress dialogProgress)
        {
            string audioBitrateArg = UtilsVideo.formatAudioBitrateArg(bitrate);
            string audioMapArg     = UtilsVideo.formatAudioMapArg(stream);
            string timeArg         = UtilsVideo.formatStartTimeAndDurationArg(startTime, endTime);

            string ffmpegAudioProgArgs = "";

            // Example format:
            // -vn -y -i "G:\Temp\inputs.mkv" -ac 2 -map 0:1 -ss 00:03:32.420 -t 00:02:03.650 -b:a 128k -threads 0 "output.mp3"
            ffmpegAudioProgArgs = String.Format("-vn -y -i \"{0}\" -ac 2 {1} {2} {3} -threads 0 \"{4}\"",
                                                                 // Video file
                                                inFile,          // {0}

                                                                 // Mapping
                                                audioMapArg,     // {1}

                                                                 // Time span
                                                timeArg,         // {2}

                                                                 // Bitrate
                                                audioBitrateArg, // {3}

                                                                 // Output file name
                                                outFile);        // {4}

            if (dialogProgress == null)
            {
                UtilsCommon.startFFmpeg(ffmpegAudioProgArgs, false, true);
            }
            else
            {
                UtilsCommon.startFFmpegProgress(ffmpegAudioProgArgs, dialogProgress);
            }
        }
Пример #9
0
        /// <summary>
        /// Extract an audio clip from a longer audio clip without re-encoding.
        /// </summary>
        public static void cutAudio(string fileToCut, DateTime startTime, DateTime endTime, string outFile)
        {
            string timeArg       = UtilsVideo.formatStartTimeAndDurationArg(startTime, endTime);
            string audioCodecArg = UtilsVideo.formatAudioCodecArg(UtilsVideo.AudioCodec.COPY);

            string ffmpegAudioProgArgs = "";

            // Example format:
            //-y -i "input.mp3" -ss 00:00:00.000 -t 00:00:01.900 -codec:a copy "output.mp3"
            ffmpegAudioProgArgs = String.Format("-y -i \"{0}\" {1} {2} \"{3}\"",
                                                               // Input file
                                                fileToCut,     // {0}

                                                               // Time span
                                                timeArg,       // {1}

                                                               // Audio codec
                                                audioCodecArg, // {2}

                                                               // Output file (including full path)
                                                outFile);      // {3}

            UtilsCommon.startFFmpeg(ffmpegAudioProgArgs, false, true);
        }
Пример #10
0
        /// <summary>
        /// Parse the actors from the subtitle file (if possible) and populate the actors list.
        /// </summary>
        private void buttonActorCheck_Click(object sender, EventArgs e)
        {
            string[] subs1Files = null;
            string[] subs2Files = null;

            listBoxActors.Items.Clear();

            if (radioButtonSubs1Actor.Checked)
            {
                if (subs1FilePattern.Length == 0)
                {
                    UtilsMsg.showErrMsg("Can't check - Subs1 file isn't valid.");
                    return;
                }
                else
                {
                    subs1Files = UtilsCommon.getNonHiddenFiles(subs1FilePattern);

                    if (subs1Files.Length > 0)
                    {
                        foreach (string f in subs1Files)
                        {
                            if (!isActorSupportedSubtitleFormat(f))
                            {
                                UtilsMsg.showErrMsg("Can't check - Incorrect subtitle format found in Subs1 (only .ass/.ssa allowed).");
                                return;
                            }
                        }
                    }
                    else
                    {
                        UtilsMsg.showErrMsg("Can't check - No .ass/ssa files were found in Subs1.");
                        return;
                    }
                }
            }
            else
            {
                if (subs2FilePattern.Length == 0)
                {
                    UtilsMsg.showErrMsg("Can't check - Subs2 file isn't valid.");
                    return;
                }
                else
                {
                    subs2Files = UtilsCommon.getNonHiddenFiles(subs2FilePattern);

                    if (subs2Files.Length > 0)
                    {
                        foreach (string f in subs2Files)
                        {
                            if (!isActorSupportedSubtitleFormat(f))
                            {
                                UtilsMsg.showErrMsg("Can't check - Incorrect subtitle format found in Subs2 (only .ass/.ssa allowed).");
                                return;
                            }
                        }
                    }
                    else
                    {
                        UtilsMsg.showErrMsg("Can't check - No .ass/ssa files were found in Subs2.");
                        return;
                    }
                }
            }

            string[] fileList = null;
            Encoding fileEncoding;

            int subsNum = 1;

            if (radioButtonSubs1Actor.Checked)
            {
                subsNum      = 1;
                fileList     = subs1Files;
                fileEncoding = Encoding.GetEncoding(InfoEncoding.longToShort(this.subs1Encoding));
            }
            else
            {
                subsNum      = 2;
                fileList     = subs2Files;
                fileEncoding = Encoding.GetEncoding(InfoEncoding.longToShort(this.subs2Encoding));
            }

            List <string> actorList = new List <string>();

            // Get list of actors from all episodes
            foreach (string file in fileList)
            {
                SubsParser      subsParser    = new SubsParserASS(null, file, fileEncoding, subsNum);
                List <InfoLine> subsLineInfos = subsParser.parse();

                foreach (InfoLine info in subsLineInfos)
                {
                    string actor = info.Actor.Trim();
                    if (!actorList.Contains(actor))
                    {
                        actorList.Add(actor);
                    }
                }
            }

            foreach (string actor in actorList)
            {
                string addActor = actor;
                listBoxActors.Items.Add(addActor);
            }

            for (int i = 0; i < listBoxActors.Items.Count; i++)
            {
                listBoxActors.SetSelected(i, true);
            }
        }
Пример #11
0
        /// <summary>
        /// Get list of audio and subtitle tracks in the provided .mkv file.
        /// </summary>
        public static List <MkvTrack> getTrackList(string mkvFile)
        {
            List <MkvTrack> trackList = new List <MkvTrack>();

            if (Path.GetExtension(mkvFile) != ".mkv")
            {
                return(trackList);
            }

            string args     = $"\"{mkvFile}\"";
            string mkvIinfo = UtilsCommon.startProcessAndGetStdout(ConstantSettings.PathMkvInfoExeRel,
                                                                   ConstantSettings.PathMkvInfoExeFull, args);

            if (mkvIinfo == "Error.")
            {
                return(trackList);
            }

            mkvIinfo = mkvIinfo.Replace("\r\r", "");

            string[] lines = mkvIinfo.Split('\n');

            TrackListParseState state = TrackListParseState.SEARCH_FOR_START_OF_TRACKS;

            MkvTrack curTrack = new MkvTrack();

            foreach (string line in lines)
            {
                switch (state)
                {
                case TrackListParseState.SEARCH_FOR_START_OF_TRACKS:
                {
                    if (line.StartsWith("|+ Segment tracks"))
                    {
                        state = TrackListParseState.GET_NEXT_TRACK;
                    }

                    break;
                }

                case TrackListParseState.GET_NEXT_TRACK:
                {
                    // Reset track info
                    curTrack = new MkvTrack();

                    if (line.StartsWith("| + A track"))
                    {
                        state = TrackListParseState.GET_TRACK_NUM;
                    }

                    break;
                }

                case TrackListParseState.GET_TRACK_NUM:
                {
                    Match match = Regex.Match(line,
                                              @"^\|  \+ Track number: \d+ \(track ID for mkvmerge & mkvextract: (?<TrackNum>\d+)\)");

                    if (match.Success)
                    {
                        curTrack.TrackID = match.Groups["TrackNum"].ToString().Trim();
                        state            = TrackListParseState.GET_TRACK_TYPE;
                    }

                    break;
                }

                case TrackListParseState.GET_TRACK_TYPE:
                {
                    Match match = Regex.Match(line, @"^\|  \+ Track type: (?<TrackType>\w+)");

                    if (match.Success)
                    {
                        string trackType = match.Groups["TrackType"].ToString().Trim();

                        if (trackType == "subtitles")
                        {
                            curTrack.TrackType = TrackType.SUBTITLES;
                            state = TrackListParseState.GET_CODEC_ID;
                        }
                        else if (trackType == "audio")
                        {
                            curTrack.TrackType = TrackType.AUDIO;
                            state = TrackListParseState.GET_CODEC_ID;
                        }
                        else
                        {
                            state = TrackListParseState.GET_NEXT_TRACK;
                        }
                    }

                    break;
                }

                case TrackListParseState.GET_CODEC_ID:
                {
                    Match match = Regex.Match(line, @"^\|  \+ Codec ID: (?<CodecID>.+)");

                    if (match.Success)
                    {
                        string codecID = match.Groups["CodecID"].ToString().Trim();

                        curTrack.Extension = codecID;

                        // See http://matroska.org/technical/specs/codecid/index.html

                        // Try subtitle Codec IDs first
                        if (codecID == "S_VOBSUB")
                        {
                            curTrack.Extension = "sub";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "S_TEXT/UTF8")
                        {
                            curTrack.Extension = "srt";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "S_TEXT/ASS")
                        {
                            curTrack.Extension = "ass";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "S_TEXT/SSA")
                        {
                            curTrack.Extension = "ssa";
                            state = TrackListParseState.GET_LANG;
                        }
                        //
                        // Now try audio Codec IDs
                        //
                        else if (codecID == "A_MPEG/L3")
                        {
                            curTrack.Extension = "mp3";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "A_MPEG/L2")
                        {
                            curTrack.Extension = "mp2";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "A_MPEG/L1")
                        {
                            curTrack.Extension = "mp1";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID.StartsWith("A_PCM"))
                        {
                            curTrack.Extension = "wav";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "A_MPC")
                        {
                            curTrack.Extension = "mpc";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID.StartsWith("A_AC3"))
                        {
                            curTrack.Extension = "ac3";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID.StartsWith("A_ALAC"))
                        {
                            curTrack.Extension = "m4a";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID.StartsWith("A_DTS"))
                        {
                            curTrack.Extension = "dts";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "A_VORBIS")
                        {
                            curTrack.Extension = "ogg";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "A_FLAC")
                        {
                            curTrack.Extension = "flac";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID.StartsWith("A_REAL"))
                        {
                            curTrack.Extension = "rm";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID.StartsWith("A_AAC"))
                        {
                            curTrack.Extension = "aac";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID.StartsWith("A_QUICKTIME"))
                        {
                            curTrack.Extension = "aiff";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "A_TTA1")
                        {
                            curTrack.Extension = "tta";
                            state = TrackListParseState.GET_LANG;
                        }
                        else if (codecID == "A_WAVPACK4")
                        {
                            curTrack.Extension = "wv";
                            state = TrackListParseState.GET_LANG;
                        }
                        else
                        {
                            state = TrackListParseState.GET_NEXT_TRACK;
                        }
                    }

                    break;
                }

                // Note: Lang is optional
                case TrackListParseState.GET_LANG:
                {
                    Match match = Regex.Match(line, @"^\|  \+ Language: (?<Lang>\w+)");

                    if (match.Success)
                    {
                        curTrack.Lang = match.Groups["Lang"].ToString().Trim();

                        // All required info for this track was found, add it to the list
                        trackList.Add(curTrack);

                        state = TrackListParseState.GET_NEXT_TRACK;
                    }
                    else
                    {
                        if (line.StartsWith("| + A track"))
                        {
                            // Lang is missing, add what we have
                            trackList.Add(curTrack);

                            state = TrackListParseState.GET_TRACK_NUM;

                            // Reset track info
                            curTrack = new MkvTrack();
                        }
                        else if (line.StartsWith("|+"))     // Are we past the track section?
                        {
                            // Lang is missing, add what we have
                            trackList.Add(curTrack);
                            goto lbl_end_parse;
                        }
                    }

                    break;
                }

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

lbl_end_parse:

            return(trackList);
        }
Пример #12
0
        /// <summary>
        /// Get list of subtitle files for the provided file pattern.
        /// </summary>
        public static List <string> getSubsFiles(string filePattern)
        {
            string[] allFiles = UtilsCommon.getNonHiddenFiles(filePattern);

            return(allFiles.Where(isSupportedSubtitleFormat).ToList());
        }
Пример #13
0
        /// <summary>
        /// Extract track from the provided mvk file.
        /// </summary>
        public static void extractTrack(string mkvFile, string trackID, string outName)
        {
            string args = String.Format("tracks \"{0}\" {1}:\"{2}\"", mkvFile, trackID, outName);

            UtilsCommon.startProcess(ConstantSettings.PathMkvExtractExeRel, ConstantSettings.PathMkvExtractExeFull, args);
        }
Пример #14
0
        /// <summary>
        /// Convert the input video using the specified options.
        ///
        /// Note:
        /// h.264 and .mp4 have timing/cutting issues. h.264 only cuts on the last keyframe,
        /// which could be several seconds before the time that you actually want to cut.
        ///
        /// When cutting an .mp4 (even with MPEG4 video and MP3 audio), the cut will take place
        /// ~0.5 seconds before it should.
        ///
        /// (Is this still true?)
        /// </summary>
        public static void convertVideo(string inFile, string audioStream, DateTime startTime, DateTime endTime,
                                        ImageSize size, ImageCrop crop, int bitrateVideo, int bitrateAudio, VideoCodec videoCodec, AudioCodec audioCodec,
                                        Profilex264 profile, Presetx264 preset, string outFile, DialogProgress dialogProgress)
        {
            string videoMapArg = UtilsVideo.formatVideoMapArg();
            string audioMapArg = UtilsVideo.formatAudioMapArg(audioStream);

            string videoCodecArg = UtilsVideo.formatVideoCodecArg(videoCodec);

            string presetArg          = UtilsVideo.formatPresetFileArg(preset);
            string keyframeOptionsArg = UtilsVideo.formatKeyframeOptionsArg(videoCodec);
            string profileArg         = UtilsVideo.formatProfileFileArg(profile);

            string videoSizeArg    = UtilsVideo.formatVideoSizeArg(inFile, size, crop, 16, 2);
            string videoBitrateArg = String.Format("-b:v {0}k", bitrateVideo);

            string audioCodecArg   = UtilsVideo.formatAudioCodecArg(audioCodec);
            string audioBitrateArg = UtilsVideo.formatAudioBitrateArg(bitrateAudio);

            string timeArg = UtilsVideo.formatStartTimeAndDurationArg(startTime, endTime);

            string cropArg = UtilsVideo.formatCropArg(inFile, size, crop);

            string threadsArg = "-threads 0";

            string ffmpegConvertArgs = "";

            // Good ffmpeg resource: http://howto-pages.org/ffmpeg/
            // 0:0 is assumed to be the video stream
            // Audio stream: 0:n where n is the number of the audio stream (usually 1)
            //
            // Example format:
            // -y -i "G:\Temp\input.mkv" -ac 2 -map 0:v:0 -map 0:a:0 -codec:v libx264 -preset superfast -g 6 -keyint_min 6
            // -fpre "E:\subs2srs\subs2srs\bin\Release\Utils\ffmpeg\presets\libx264-ipod640.ffpreset"
            // -b:v 800k -codec:a aac -b:a 128k -ss 00:03:32.420 -t 00:02:03.650 -vf "scale 352:202, crop=352:202:0:0" -threads 0
            // "C:\Documents and Settings\cb4960\Local Settings\Temp\~subs2srs_temp.mp4"
            ffmpegConvertArgs = String.Format("-y -i \"{0}\" -ac 2 {1} {2} {3} {4} {5} {6} {7} {8} {9}" +
                                              " {10} -vf \"{11}, {12}\" {13} \"{14}\" ",
                                                                  // Input video file name
                                              inFile,             // {0}

                                                                  // Mapping
                                              videoMapArg,        // {1}
                                              audioMapArg,        // {2}

                                                                  // Video
                                              videoCodecArg,      // {3}
                                              presetArg,          // {4}
                                              keyframeOptionsArg, // {5}
                                              profileArg,         // {6}
                                              videoBitrateArg,    // {7}

                                                                  // Audio
                                              audioCodecArg,      // {8}
                                              audioBitrateArg,    // {9}

                                                                  // Time span
                                              timeArg,            // {10}

                                                                  // Filters
                                              videoSizeArg,       // {11}
                                              cropArg,            // {12}

                                                                  // Threads
                                              threadsArg,         // {13}

                                                                  // Output video file name
                                              outFile);           // {14}


            if (dialogProgress == null)
            {
                UtilsCommon.startFFmpeg(ffmpegConvertArgs, true, true);
            }
            else
            {
                UtilsCommon.startFFmpegProgress(ffmpegConvertArgs, dialogProgress);
            }
        }
Пример #15
0
        /// <summary>
        /// Dump the most important settings to the log.
        /// </summary>
        public void writeSettingsToLog()
        {
            if (!ConstantSettings.EnableLogging || !initalized)
            {
                return;
            }

            startSection("Settings");

            for (int i = 0; i < 2; i++)
            {
                info("Subs " + i + ":");
                var(new { Settings.Instance.Subs[i].ActorsEnabled });
                var(new { Settings.Instance.Subs[i].Encoding });

                string excludedWords = UtilsCommon.makeSemiString(Settings.Instance.Subs[i].ExcludedWords);
                var(new { excludedWords });

                var(new { Settings.Instance.Subs[i].RemoveNoCounterpart });
                var(new { Settings.Instance.Subs[i].RemoveStyledLines });
                var(new { Settings.Instance.Subs[i].ExcludeDuplicateLinesEnabled });
                var(new { Settings.Instance.Subs[i].ExcludeFewerCount });
                var(new { Settings.Instance.Subs[i].ExcludeFewerEnabled });
                var(new { Settings.Instance.Subs[i].ExcludeLongerThanTime });
                var(new { Settings.Instance.Subs[i].ExcludeLongerThanTimeEnabled });
                var(new { Settings.Instance.Subs[i].ExcludeShorterThanTime });
                var(new { Settings.Instance.Subs[i].ExcludeShorterThanTimeEnabled });
                var(new { Settings.Instance.Subs[i].FilePattern });

                foreach (string file in Settings.Instance.Subs[i].Files)
                {
                    Logger.Instance.var(new { file });
                }

                string includedWords = UtilsCommon.makeSemiString(Settings.Instance.Subs[i].IncludedWords);
                var(new { includedWords });

                var(new { Settings.Instance.Subs[i].TimeShift });
                var(new { Settings.Instance.Subs[i].TimingsEnabled });
                var(new { Settings.Instance.Subs[i].VobsubStream });
            }

            var(new { Settings.Instance.VideoClips.Enabled });
            var(new { Settings.Instance.VideoClips.FilePattern });

            foreach (string file in Settings.Instance.VideoClips.Files)
            {
                var(new { file });
            }

            info("Audio Clips:");
            var(new { Settings.Instance.AudioClips.Enabled });
            var(new { Settings.Instance.AudioClips.filePattern });

            foreach (string file in Settings.Instance.AudioClips.Files)
            {
                var(new { file });
            }

            var(new { Settings.Instance.AudioClips.Bitrate });
            var(new { Settings.Instance.AudioClips.PadEnabled });
            var(new { Settings.Instance.AudioClips.PadStart });
            var(new { Settings.Instance.AudioClips.PadEnd });
            var(new { Settings.Instance.AudioClips.UseAudioFromVideo });
            var(new { Settings.Instance.AudioClips.UseExistingAudio });
            var(new { Settings.Instance.AudioClips.Normalize });

            info("Snapshots:");
            var(new { Settings.Instance.Snapshots.Enabled });
            var(new { Settings.Instance.Snapshots.Crop.Bottom });
            var(new { Settings.Instance.Snapshots.Size.Width });
            var(new { Settings.Instance.Snapshots.Size.Height });

            info("Video Clips:");
            var(new { Settings.Instance.VideoClips.AudioStream });
            var(new { Settings.Instance.VideoClips.BitrateAudio });
            var(new { Settings.Instance.VideoClips.BitrateVideo });
            var(new { Settings.Instance.VideoClips.Crop.Bottom });
            var(new { Settings.Instance.VideoClips.IPodSupport });
            var(new { Settings.Instance.VideoClips.PadEnabled });
            var(new { Settings.Instance.VideoClips.PadStart });
            var(new { Settings.Instance.VideoClips.PadEnd });
            var(new { Settings.Instance.VideoClips.Size.Width });
            var(new { Settings.Instance.VideoClips.Size.Height });

            info("Other:");
            var(new { Settings.Instance.ContextLeadingCount });
            var(new { Settings.Instance.ContextLeadingIncludeAudioClips });
            var(new { Settings.Instance.ContextLeadingIncludeSnapshots });
            var(new { Settings.Instance.ContextLeadingIncludeVideoClips });
            var(new { Settings.Instance.ContextLeadingRange });

            var(new { Settings.Instance.ContextTrailingCount });
            var(new { Settings.Instance.ContextTrailingIncludeAudioClips });
            var(new { Settings.Instance.ContextTrailingIncludeSnapshots });
            var(new { Settings.Instance.ContextTrailingIncludeVideoClips });
            var(new { Settings.Instance.ContextTrailingRange });

            var(new { Settings.Instance.DeckName });
            var(new { Settings.Instance.EpisodeStartNumber });
            var(new { Settings.Instance.LangaugeSpecific.KanjiLinesOnly });
            var(new { Settings.Instance.OutputDir });
            var(new { Settings.Instance.TimeShiftEnabled });
            var(new { Settings.Instance.SpanEnabled });
            var(new { Settings.Instance.SpanEnd });
            var(new { Settings.Instance.SpanStart });
            var(new { Settings.Instance.VobSubColors.Enabled });

            string vobSubColors = Settings.Instance.VobSubColors.Colors[0].ToString();

            var(new { vobSubColors });

            endSection("Settings");

            startSection("Preferences");

            var(new { ConstantSettings.SaveExt });
            var(new { HelpFile = ConstantSettings.HelpPage });
            var(new { ConstantSettings.ExeFFmpeg });
            var(new { ConstantSettings.PathFFmpegExe });
            var(new { ConstantSettings.PathFFmpegFullExe });
            var(new { ConstantSettings.PathFFmpegPresetsFull });
            var(new { ConstantSettings.TempImageFilename });
            var(new { ConstantSettings.TempVideoFilename });
            var(new { ConstantSettings.TempAudioFilename });
            var(new { ConstantSettings.TempAudioPreviewFilename });
            var(new { ConstantSettings.TempPreviewDirName });
            var(new { ConstantSettings.TempMkvExtractSubs1Filename });
            var(new { ConstantSettings.TempMkvExtractSubs2Filename });
            var(new { ConstantSettings.NormalizeAudioExe });
            var(new { ConstantSettings.PathNormalizeAudioExeRel });
            var(new { ConstantSettings.PathNormalizeAudioExeFull });
            var(new { ConstantSettings.PathSubsReTimerFull });
            var(new { ConstantSettings.PathMkvDirRel });
            var(new { ConstantSettings.PathMkvDirFull });
            var(new { ConstantSettings.PathMkvInfoExeRel });
            var(new { ConstantSettings.PathMkvInfoExeFull });
            var(new { ConstantSettings.PathMkvExtractExeRel });
            var(new { ConstantSettings.PathMkvExtractExeFull });

            string tempDirectory = Path.GetTempPath();

            var(new { tempDirectory });

            var(new { ConstantSettings.SettingsFilename });
            var(new { ConstantSettings.MainWindowWidth });
            var(new { ConstantSettings.MainWindowHeight });
            var(new { ConstantSettings.DefaultEnableAudioClipGeneration });
            var(new { ConstantSettings.DefaultEnableSnapshotsGeneration });
            var(new { ConstantSettings.DefaultEnableVideoClipsGeneration });
            var(new { ConstantSettings.VideoPlayer });
            var(new { ConstantSettings.VideoPlayerArgs });
            var(new { ConstantSettings.ReencodeBeforeSplittingAudio });
            var(new { ConstantSettings.EnableLogging });
            var(new { ConstantSettings.AudioNormalizeArgs });
            var(new { ConstantSettings.LongClipWarningSeconds });
            var(new { ConstantSettings.DefaultAudioClipBitrate });
            var(new { ConstantSettings.DefaultAudioNormalize });
            var(new { ConstantSettings.DefaultVideoClipVideoBitrate });
            var(new { ConstantSettings.DefaultVideoClipAudioBitrate });
            var(new { DefaultIphoneSupport = ConstantSettings.DefaultIphoneSupport });
            var(new { ConstantSettings.DefaultEncodingSubs1 });
            var(new { ConstantSettings.DefaultEncodingSubs2 });
            var(new { ConstantSettings.DefaultContextNumLeading });
            var(new { ConstantSettings.DefaultContextNumTrailing });
            var(new { ConstantSettings.DefaultFileBrowserStartDir });
            var(new { ConstantSettings.DefaultRemoveStyledLinesSubs1 });
            var(new { ConstantSettings.DefaultRemoveStyledLinesSubs2 });
            var(new { ConstantSettings.DefaultRemoveNoCounterpartSubs1 });
            var(new { ConstantSettings.DefaultRemoveNoCounterpartSubs2 });
            var(new { ConstantSettings.DefaultIncludeTextSubs1 });
            var(new { ConstantSettings.DefaultIncludeTextSubs2 });
            var(new { ConstantSettings.DefaultExcludeTextSubs1 });
            var(new { ConstantSettings.DefaultExcludeTextSubs2 });
            var(new { ConstantSettings.DefaultExcludeDuplicateLinesSubs1 });
            var(new { ConstantSettings.DefaultExcludeDuplicateLinesSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsNumSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsNumSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsNumSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsNumSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsNumSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsNumSubs2 });
            var(new { ConstantSettings.SrsFilenameFormat });
            var(new { ConstantSettings.SrsDelimiter });
            var(new { ConstantSettings.SrsTagFormat });
            var(new { ConstantSettings.SrsSequenceMarkerFormat });
            var(new { ConstantSettings.SrsAudioFilenamePrefix });
            var(new { ConstantSettings.SrsAudioFilenameSuffix });
            var(new { ConstantSettings.SrsSnapshotFilenamePrefix });
            var(new { ConstantSettings.SrsSnapshotFilenameSuffix });
            var(new { ConstantSettings.SrsVideoFilenamePrefix });
            var(new { ConstantSettings.SrsVideoFilenameSuffix });
            var(new { ConstantSettings.SrsSubs1Format });
            var(new { ConstantSettings.SrsSubs2Format });
            var(new { ConstantSettings.SrsVobsubFilenamePrefix });
            var(new { ConstantSettings.SrsVobsubFilenameSuffix });
            var(new { ConstantSettings.AudioFilenameFormat });
            var(new { ConstantSettings.SnapshotFilenameFormat });
            var(new { ConstantSettings.VideoFilenameFormat });
            var(new { ConstantSettings.VobsubFilenameFormat });
            var(new { ConstantSettings.AudioId3Artist });
            var(new { ConstantSettings.AudioId3Album });
            var(new { ConstantSettings.AudioId3Title });
            var(new { ConstantSettings.AudioId3Genre });
            var(new { ConstantSettings.AudioId3Lyrics });
            var(new { ConstantSettings.ExtractMediaAudioFilenameFormat });
            var(new { ConstantSettings.ExtractMediaLyricsSubs1Format });
            var(new { ConstantSettings.ExtractMediaLyricsSubs2Format });
            var(new { ConstantSettings.DuelingSubtitleFilenameFormat });
            var(new { ConstantSettings.DuelingQuickRefFilenameFormat });
            var(new { ConstantSettings.DuelingQuickRefSubs1Format });
            var(new { ConstantSettings.DuelingQuickRefSubs2Format });

            endSection("Preferences");

            flush();
        }
Пример #16
0
        /// <summary>
        /// Get number of subtitles or IDX/SUB pairs for the provided file pattern.
        /// </summary>
        public static int getNumSubsFiles(string filePattern)
        {
            string[] subsFiles = UtilsCommon.getNonHiddenFiles(filePattern);

            return(subsFiles.Count(isSupportedSubtitleFormat));
        }
Пример #17
0
        /// <summary>
        /// Update the global settings based on GUI.
        /// </summary>
        private void updateSettings()
        {
            Settings.Instance.Subs[0].IncludedWords                 = UtilsCommon.removeExtraSpaces(textBoxSubs1IncludedWords.Text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
            Settings.Instance.Subs[0].ExcludedWords                 = UtilsCommon.removeExtraSpaces(textBoxSubs1ExcludedWords.Text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
            Settings.Instance.Subs[0].RemoveNoCounterpart           = checkBoxSubs1RemovedNoCounterpart.Checked;
            Settings.Instance.Subs[0].RemoveStyledLines             = checkBoxSubs1RemoveStyledLines.Checked;
            Settings.Instance.Subs[0].ExcludeDuplicateLinesEnabled  = checkBoxSubs1ExcludeDuplicateLines.Checked;
            Settings.Instance.Subs[0].ExcludeFewerEnabled           = checkBoxSubs1ExcludeFewer.Checked;
            Settings.Instance.Subs[0].ExcludeFewerCount             = (int)numericUpDownSubs1ExcludeFewer.Value;
            Settings.Instance.Subs[0].ExcludeShorterThanTimeEnabled = checkBoxSubs1ExcludeShorterThanTime.Checked;
            Settings.Instance.Subs[0].ExcludeShorterThanTime        = (int)numericUpDownSubs1ExcludeShorterThanTime.Value;
            Settings.Instance.Subs[0].ExcludeLongerThanTimeEnabled  = checkBoxSubs1ExcludeLongerThanTime.Checked;
            Settings.Instance.Subs[0].ExcludeLongerThanTime         = (int)numericUpDownSubs1ExcludeLongerThanTime.Value;
            Settings.Instance.Subs[0].JoinSentencesEnabled          = checkBoxSubs1JoinSentences.Checked;
            Settings.Instance.Subs[0].JoinSentencesCharList         = textBoxSubs1JoinSentenceChars.Text.Trim();
            Settings.Instance.Subs[0].ActorsEnabled                 = radioButtonSubs1Actor.Checked;

            Settings.Instance.Subs[1].IncludedWords                 = UtilsCommon.removeExtraSpaces(textBoxSubs2IncludedWords.Text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
            Settings.Instance.Subs[1].ExcludedWords                 = UtilsCommon.removeExtraSpaces(textBoxSubs2ExcludedWords.Text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
            Settings.Instance.Subs[1].RemoveNoCounterpart           = checkBoxSubs2RemoveNoCounterpart.Checked;
            Settings.Instance.Subs[1].RemoveStyledLines             = checkBoxSubs2RemoveStyledLines.Checked;
            Settings.Instance.Subs[1].ExcludeDuplicateLinesEnabled  = checkBoxSubs2ExcludeDuplicateLines.Checked;
            Settings.Instance.Subs[1].ExcludeFewerEnabled           = checkBoxSubs2ExcludeFewer.Checked;
            Settings.Instance.Subs[1].ExcludeFewerCount             = (int)numericUpDownSubs2ExcludeFewer.Value;
            Settings.Instance.Subs[1].ExcludeShorterThanTimeEnabled = checkBoxSubs2ExcludeShorterThanTime.Checked;
            Settings.Instance.Subs[1].ExcludeShorterThanTime        = (int)numericUpDownSubs2ExcludeShorterThanTime.Value;
            Settings.Instance.Subs[1].ExcludeLongerThanTimeEnabled  = checkBoxSubs2ExcludeLongerThanTime.Checked;
            Settings.Instance.Subs[1].ExcludeLongerThanTime         = (int)numericUpDownSubs2ExcludeLongerThanTime.Value;
            Settings.Instance.Subs[1].JoinSentencesEnabled          = checkBoxSubs2JoinSentences.Checked;
            Settings.Instance.Subs[1].JoinSentencesCharList         = textBoxSubs2JoinSentenceChars.Text.Trim();
            Settings.Instance.Subs[1].ActorsEnabled                 = radioButtonSubs2Actor.Checked;

            Settings.Instance.ContextLeadingCount             = (int)numericUpDownContextLeading.Value;
            Settings.Instance.ContextTrailingCount            = (int)numericUpDownContextTrailing.Value;
            Settings.Instance.ContextLeadingIncludeAudioClips = checkBoxLeadingIncludeAudioClips.Checked;
            Settings.Instance.ContextLeadingIncludeSnapshots  = checkBoxLeadingIncludeSnapshots.Checked;
            Settings.Instance.ContextLeadingIncludeVideoClips = checkBoxLeadingIncludeVideoClips.Checked;
            Settings.Instance.ContextLeadingRange             = (int)numericUpDownLeadingRange.Value;

            Settings.Instance.ContextTrailingIncludeAudioClips = checkBoxTrailingIncludeAudioClips.Checked;
            Settings.Instance.ContextTrailingIncludeSnapshots  = checkBoxTrailingIncludeSnapshots.Checked;
            Settings.Instance.ContextTrailingIncludeVideoClips = checkBoxTrailingIncludeVideoClips.Checked;
            Settings.Instance.ContextTrailingRange             = (int)numericUpDownTrailingRange.Value;

            Settings.Instance.ActorList.Clear();

            for (int i = 0; i < listBoxActors.Items.Count; i++)
            {
                if (listBoxActors.GetSelected(i))
                {
                    Settings.Instance.ActorList.Add((string)listBoxActors.Items[i]);
                }
            }

            Settings.Instance.LangaugeSpecific.KanjiLinesOnly = checkBoxJapKanjiOnly.Checked;

            Settings.Instance.VobSubColors.Enabled = groupBoxCheckVobsubColors.Checked;

            Settings.Instance.VobSubColors.Colors[0] = panelColorBackground.BackColor;
            Settings.Instance.VobSubColors.Colors[1] = panelColorText.BackColor;
            Settings.Instance.VobSubColors.Colors[2] = panelColorOutline.BackColor;
            Settings.Instance.VobSubColors.Colors[3] = panelColorAntialias.BackColor;

            Settings.Instance.VobSubColors.TransparencyEnabled[0] = checkBoxColorBackground.Checked;
            Settings.Instance.VobSubColors.TransparencyEnabled[1] = checkBoxColorText.Checked;
            Settings.Instance.VobSubColors.TransparencyEnabled[2] = checkBoxColorOutline.Checked;
            Settings.Instance.VobSubColors.TransparencyEnabled[3] = checkBoxColorAntialias.Checked;
        }
Пример #18
0
        /// <summary>
        /// Update GUI based on global settings.
        /// </summary>
        private void updateGUI()
        {
            try
            {
                textBoxSubs1IncludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[0].IncludedWords);
                textBoxSubs1ExcludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[0].ExcludedWords);
                checkBoxSubs1RemoveStyledLines.Checked         = Settings.Instance.Subs[0].RemoveStyledLines;
                checkBoxSubs1RemovedNoCounterpart.Checked      = Settings.Instance.Subs[0].RemoveNoCounterpart;
                checkBoxSubs1ExcludeDuplicateLines.Checked     = Settings.Instance.Subs[0].ExcludeDuplicateLinesEnabled;
                checkBoxSubs1ExcludeFewer.Checked              = Settings.Instance.Subs[0].ExcludeFewerEnabled;
                numericUpDownSubs1ExcludeFewer.Value           = (decimal)Settings.Instance.Subs[0].ExcludeFewerCount;
                checkBoxSubs1ExcludeShorterThanTime.Checked    = Settings.Instance.Subs[0].ExcludeShorterThanTimeEnabled;
                numericUpDownSubs1ExcludeShorterThanTime.Value = (decimal)Settings.Instance.Subs[0].ExcludeShorterThanTime;
                checkBoxSubs1ExcludeLongerThanTime.Checked     = Settings.Instance.Subs[0].ExcludeLongerThanTimeEnabled;
                numericUpDownSubs1ExcludeLongerThanTime.Value  = (decimal)Settings.Instance.Subs[0].ExcludeLongerThanTime;
                checkBoxSubs1JoinSentences.Checked             = Settings.Instance.Subs[0].JoinSentencesEnabled;
                textBoxSubs1JoinSentenceChars.Text             = Settings.Instance.Subs[0].JoinSentencesCharList;
                radioButtonSubs1Actor.Checked = Settings.Instance.Subs[0].ActorsEnabled;

                textBoxSubs2IncludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[1].IncludedWords);
                textBoxSubs2ExcludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[1].ExcludedWords);
                checkBoxSubs2RemoveNoCounterpart.Checked       = Settings.Instance.Subs[1].RemoveNoCounterpart;
                checkBoxSubs2RemoveStyledLines.Checked         = Settings.Instance.Subs[1].RemoveStyledLines;
                checkBoxSubs2ExcludeDuplicateLines.Checked     = Settings.Instance.Subs[1].ExcludeDuplicateLinesEnabled;
                checkBoxSubs2ExcludeFewer.Checked              = Settings.Instance.Subs[1].ExcludeFewerEnabled;
                numericUpDownSubs2ExcludeFewer.Value           = (decimal)Settings.Instance.Subs[1].ExcludeFewerCount;
                checkBoxSubs2ExcludeShorterThanTime.Checked    = Settings.Instance.Subs[1].ExcludeShorterThanTimeEnabled;
                numericUpDownSubs2ExcludeShorterThanTime.Value = Settings.Instance.Subs[1].ExcludeShorterThanTime;
                checkBoxSubs2ExcludeLongerThanTime.Checked     = Settings.Instance.Subs[1].ExcludeLongerThanTimeEnabled;
                numericUpDownSubs2ExcludeLongerThanTime.Value  = Settings.Instance.Subs[1].ExcludeLongerThanTime;
                checkBoxSubs2JoinSentences.Checked             = Settings.Instance.Subs[1].JoinSentencesEnabled;
                textBoxSubs2JoinSentenceChars.Text             = Settings.Instance.Subs[1].JoinSentencesCharList;
                radioButtonSubs2Actor.Checked = Settings.Instance.Subs[1].ActorsEnabled;

                numericUpDownContextLeading.Value        = (decimal)Settings.Instance.ContextLeadingCount;
                checkBoxLeadingIncludeAudioClips.Checked = Settings.Instance.ContextLeadingIncludeAudioClips;
                checkBoxLeadingIncludeSnapshots.Checked  = Settings.Instance.ContextLeadingIncludeSnapshots;
                checkBoxLeadingIncludeVideoClips.Checked = Settings.Instance.ContextLeadingIncludeVideoClips;
                numericUpDownLeadingRange.Value          = (decimal)Settings.Instance.ContextLeadingRange;

                numericUpDownContextTrailing.Value        = (decimal)Settings.Instance.ContextTrailingCount;
                checkBoxTrailingIncludeAudioClips.Checked = Settings.Instance.ContextTrailingIncludeAudioClips;
                checkBoxTrailingIncludeSnapshots.Checked  = Settings.Instance.ContextTrailingIncludeSnapshots;
                checkBoxTrailingIncludeVideoClips.Checked = Settings.Instance.ContextTrailingIncludeVideoClips;
                numericUpDownTrailingRange.Value          = (decimal)Settings.Instance.ContextTrailingRange;

                checkBoxJapKanjiOnly.Checked = Settings.Instance.LangaugeSpecific.KanjiLinesOnly;

                groupBoxCheckVobsubColors.Checked = Settings.Instance.VobSubColors.Enabled;
                panelColorBackground.BackColor    = Settings.Instance.VobSubColors.Colors[0];
                panelColorText.BackColor          = Settings.Instance.VobSubColors.Colors[1];
                panelColorOutline.BackColor       = Settings.Instance.VobSubColors.Colors[2];
                panelColorAntialias.BackColor     = Settings.Instance.VobSubColors.Colors[3];

                checkBoxColorBackground.Checked = Settings.Instance.VobSubColors.TransparencyEnabled[0];
                checkBoxColorText.Checked       = Settings.Instance.VobSubColors.TransparencyEnabled[1];
                checkBoxColorOutline.Checked    = Settings.Instance.VobSubColors.TransparencyEnabled[2];
                checkBoxColorAntialias.Checked  = Settings.Instance.VobSubColors.TransparencyEnabled[3];
            }
            catch (Exception e1)
            {
                UtilsMsg.showErrMsg("Could not completely fill in all settings for this dialog.\n"
                                    + "Did you load a file saved from a previous version?\n\n" + e1);
            }
        }
Пример #19
0
        /// <summary>
        /// Does the expanded file pattern contain vobsubs?
        /// </summary>
        public static bool filePatternContainsVobsubs(string filePattern)
        {
            string[] subsFiles = UtilsCommon.getNonHiddenFiles(filePattern);

            return(subsFiles.Select(file => file.Substring(file.LastIndexOf(".")).ToLower()).Any(ext => ext == ".idx"));
        }