コード例 #1
0
        private Subtitles ParsedSubtitlesPlain(string path, Encoding fileEncoding, string text, bool withCharacterNames, TimingMode timingMode, string lineSeparator)
        {
            SubtitleCollection collection        = null;
            PlainTextParser    plainParser       = new PlainTextParser(withCharacterNames, lineSeparator);
            ParsingProperties  parsingProperties = plainParser.Parse(text, timingMode, fileEncoding, out collection);

            SubtitleProperties subtitleProperties = new SubtitleProperties(parsingProperties);

            collection.SetPropertiesForAll(subtitleProperties);

            Subtitles subtitles = new Subtitles(collection, subtitleProperties);

            CompleteTimingsAfterParsing(subtitles, parsingProperties);

            fileProperties = new FileProperties(path, fileEncoding, parsingProperties.TimingMode);

            Logger.Info("[SubtitleFactory] Opened {0} with encoding {1}", path, fileEncoding);
            return(subtitles);
        }
コード例 #2
0
        /* Private members */

        private Subtitles ParsedSubtitles(string path, Encoding fileEncoding, SubtitleFormat format, float inputFrameRate, string text)
        {
            SubtitleCollection collection        = null;
            SubtitleParser     subtitleParser    = new SubtitleParser(includeIncompleteSubtitles);
            ParsingProperties  parsingProperties = subtitleParser.Parse(text, format, inputFrameRate, out collection, out incompleteSubtitles);

            SubtitleProperties subtitleProperties = new SubtitleProperties(parsingProperties);

            collection.SetPropertiesForAll(subtitleProperties);

            Subtitles subtitles = new Subtitles(collection, subtitleProperties);

            CompleteTimingsAfterParsing(subtitles, parsingProperties);

            fileProperties = new FileProperties(path, fileEncoding, format.Type, parsingProperties.TimingMode);

            Logger.Info("[SubtitleFactory] Opened \"{0}\" with encoding \"{1}\", format \"{2}\", timing mode \"{3}\" and frame rate \"{4}\" (input frame rate was \"{5}\")",
                        path, fileEncoding, format.Name, parsingProperties.TimingMode, subtitleProperties.CurrentFrameRate, inputFrameRate);

            return(subtitles);
        }