• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Subtitle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Subtitle的典型用法代码示例。如果您正苦于以下问题:C# Subtitle类的具体用法?C# Subtitle怎么用?C# Subtitle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Subtitle类属于命名空间,在下文中一共展示了Subtitle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            // 1
            // 00:00:04:12
            // 00:00:06:05
            // Berniukai, tik pažiūrėkit.

            // 2
            // 00:00:06:16
            // 00:00:07:20
            // Argi ne puiku?

            // 3
            // 00:00:08:02
            // 00:00:10:20
            // Tėti, ar galime čia paplaukioti?
            // -Aišku, kad galim.

            const string paragraphWriteFormat = "{4}{3}{0}{3}{1}{3}{2}{3}";
            var sb = new StringBuilder();
            int count = 0;
            foreach (Paragraph p in subtitle.Paragraphs)
            {
                count++;
                var text = HtmlUtil.RemoveOpenCloseTags(p.Text, HtmlUtil.TagFont);
                sb.AppendLine(string.Format(paragraphWriteFormat, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), text, Environment.NewLine, count));
            }
            return sb.ToString().Trim();
        }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:29,代码来源:UnknownSubtitle64.cs


示例2: LoadSubtitle

        public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
        {
            //<Time begin="0:03:24.8" end="0:03:29.4" /><clear/>Man stjæler ikke fra Chavo, nej.
            subtitle.Paragraphs.Clear();
            _errorCount = 0;
            foreach (string line in lines)
            {
                try
                {
                    if (line.Contains("<Time ") && line.Contains(" begin=") && line.Contains("end="))
                    {
                        int indexOfBegin = line.IndexOf(" begin=", StringComparison.Ordinal);
                        int indexOfEnd = line.IndexOf(" end=", StringComparison.Ordinal);
                        string begin = line.Substring(indexOfBegin + 7, 11);
                        string end = line.Substring(indexOfEnd + 5, 11);

                        string[] startParts = begin.Split(new[] { ':', '.', '"' }, StringSplitOptions.RemoveEmptyEntries);
                        string[] endParts = end.Split(new[] { ':', '.', '"' }, StringSplitOptions.RemoveEmptyEntries);
                        if (startParts.Length == 4 && endParts.Length == 4)
                        {
                            string text = line.Substring(line.LastIndexOf("/>", StringComparison.Ordinal) + 2);
                            var p = new Paragraph(DecodeTimeCode(startParts), DecodeTimeCode(endParts), text);
                            subtitle.Paragraphs.Add(p);
                        }
                    }
                }
                catch
                {
                    _errorCount++;
                }
            }

            subtitle.Renumber();
        }
开发者ID:lalberto8085,项目名称:subtitleedit,代码行数:34,代码来源:RealTime.cs


示例3: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            const string timeCodeFormatNoHours = "{0:00}:{1:00}.{2:000}"; // h:mm:ss.cc
            const string timeCodeFormatHours = "{0}:{1:00}:{2:00}.{3:000}"; // h:mm:ss.cc
            const string paragraphWriteFormat = "{0} --> {1}{4}{2}{3}{4}";

            var sb = new StringBuilder();
            sb.AppendLine("WEBVTT FILE");
            sb.AppendLine();
            int count = 1;
            foreach (Paragraph p in subtitle.Paragraphs)
            {
                string start = string.Format(timeCodeFormatNoHours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds);
                string end = string.Format(timeCodeFormatNoHours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds);

                if (p.StartTime.Hours > 0 || p.EndTime.Hours > 0)
                {
                    start = string.Format(timeCodeFormatHours, p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds);
                    end = string.Format(timeCodeFormatHours, p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds);
                }

                string style = string.Empty;
                if (!string.IsNullOrEmpty(p.Extra) && subtitle.Header == "WEBVTT FILE")
                    style = p.Extra;
                sb.AppendLine(count.ToString());
                sb.AppendLine(string.Format(paragraphWriteFormat, start, end, FormatText(p), style, Environment.NewLine));
                count++;
            }
            return sb.ToString().Trim();
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:30,代码来源:WebVTTFileWithLineNumber.cs


示例4: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            string xmlStructure =
                "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + Environment.NewLine +
                "<transcript/>";

            var xml = new XmlDocument();
            xml.LoadXml(xmlStructure);

            foreach (Paragraph p in subtitle.Paragraphs)
            {
                XmlNode paragraph = xml.CreateElement("text");

                XmlAttribute start = xml.CreateAttribute("start");
                start.InnerText = string.Format("{0}", p.StartTime.TotalMilliseconds / 1000).Replace(",", ".");
                paragraph.Attributes.Append(start);

                XmlAttribute duration = xml.CreateAttribute("dur");
                duration.InnerText = string.Format("{0}", p.Duration.TotalMilliseconds / 1000).Replace(",", ".");
                paragraph.Attributes.Append(duration);

                paragraph.InnerText = p.Text;

                xml.DocumentElement.AppendChild(paragraph);
            }

            return ToUtf8XmlString(xml);
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:28,代码来源:UnknownSubtitle5.cs


示例5: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            var sb = new StringBuilder();
            sb.AppendLine(title);
            sb.AppendLine(@"1ab

10/01/2012
10/01/2012
01:00:22.09
01:00:30.09
**:**:**.**
**:**:**.**
01:00:51.09
01:00:55.22
01:01:10.09
**:**:**.**
**:**:**.**
01:13:23.09");
            sb.AppendLine();
            int count = 1;
            for (int i = 0; i < subtitle.Paragraphs.Count; i++)
            {
                Paragraph p = subtitle.Paragraphs[i];
                string text = HtmlUtil.RemoveHtmlTags(p.Text);
                sb.AppendLine(string.Format("{0}:  {1}  {2}\r\n{3}\r\n", count, MakeTimeCode(p.StartTime), MakeTimeCode(p.EndTime), text));
                count++;
            }

            return sb.ToString();
        }
开发者ID:m1croN,项目名称:subtitleedit,代码行数:30,代码来源:UnknownSubtitle26.cs


示例6: LoadSubtitle

 public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
 {
     _errorCount = 0;
     int number = 0;
     foreach (string line in lines)
     {
         if (line.Trim().Length > 0 && line[0] != '$' && !line.StartsWith("//"))
         {
             if (RegexTimeCodes.Match(line).Success)
             {
                 string[] toPart = line.Substring(0, 25).Split(new[] { " ," }, StringSplitOptions.None);
                 Paragraph p = new Paragraph();
                 if (toPart.Length == 2 &&
                     DvdStudioPro.GetTimeCode(p.StartTime, toPart[0]) &&
                     DvdStudioPro.GetTimeCode(p.EndTime, toPart[1]))
                 {
                     number++;
                     p.Number = number;
                     string text = line.Substring(27).Trim();
                     p.Text = text.Replace(" | ", Environment.NewLine).Replace("|", Environment.NewLine);
                     p.Text = DvdStudioPro.DecodeStyles(p.Text);
                     subtitle.Paragraphs.Add(p);
                 }
             }
             else
             {
                 _errorCount++;
             }
         }
     }
 }
开发者ID:athikan,项目名称:subtitleedit,代码行数:31,代码来源:DvdStudioProSpace.cs


示例7: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            const string paragraphWriteFormat = "{0}-{1}\r\n{2}";
            var sb = new StringBuilder();
            sb.AppendLine();
            sb.AppendLine();
            sb.AppendLine();
            foreach (Paragraph p in subtitle.Paragraphs)
            {
                string text = p.Text;
                if (Utilities.CountTagInText(text, Environment.NewLine) > 1)
                    text = Utilities.AutoBreakLine(text);
                text = Utilities.RemoveHtmlTags(text, true);
                if (p.Text.Contains("<i>"))
                {
                    if (Utilities.CountTagInText(p.Text, "<i>") == 1 && Utilities.CountTagInText(p.Text, "</i>") == 1 &&
                        p.Text.StartsWith("<i>") && p.Text.StartsWith("<i>"))
                    {
                        text = "||" + text.Replace(Environment.NewLine, "||" + Environment.NewLine + "||") + "||";
                    }
                    else if (Utilities.CountTagInText(p.Text, "<i>") == 2 && Utilities.CountTagInText(p.Text, "</i>") == 2 &&
                        p.Text.StartsWith("<i>") && p.Text.StartsWith("<i>") && p.Text.Contains("</i>" + Environment.NewLine + "<i>"))
                    {
                        text = "||" + text.Replace(Environment.NewLine, "||" + Environment.NewLine + "||") + "||";
                    }
                }

                if (!text.Contains(Environment.NewLine))
                    text = Environment.NewLine + text;
                sb.AppendLine(string.Format(paragraphWriteFormat, FormatTime(p.StartTime), FormatTime(p.EndTime), text));
            }
            sb.AppendLine();
            return sb.ToString();
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:34,代码来源:UnknownSubtitle50.cs


示例8: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            var sb = new StringBuilder(@"[");
            int count = 0;

            string guid = Guid.NewGuid().ToString();
            string segmentTypeId = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 24);

            foreach (Paragraph p in subtitle.Paragraphs)
            {
                string id = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 24);
                if (count > 0)
                    sb.Append(',');
                sb.Append("{\"hitType\":\"tag\",\"subTrack\":null,\"tags\":[],\"track\":\"Closed Captioning\",\"startTime\":");
                sb.Append(p.StartTime.TotalSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture));
                sb.Append(",\"guid\":\"" + guid + "\",\"segmentTypeId\":\"" + segmentTypeId + "\",\"endTime\":");
                sb.Append(p.EndTime.TotalSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture));
                sb.Append(",\"id\":\"" + id + "\",\"metadata\":{\"Text\":\"");
                sb.Append(Json.EncodeJsonText(p.Text) + "\"");

                sb.Append(",\"ID\":\"\",\"Language\":\"en\"}}");
                count++;
            }
            sb.Append(']');
            return sb.ToString().Trim();
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:26,代码来源:JsonType4.cs


示例9: IsMine

 public override bool IsMine(List<string> lines, string fileName)
 {
     var subtitle = new Subtitle();
     LoadSubtitle(subtitle, lines, fileName);
     Errors = null;
     return subtitle.Paragraphs.Count > _errorCount;
 }
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:7,代码来源:SubStationAlpha.cs


示例10: LoadSubtitle

        public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
        {
            _errorCount = 0;
            var regexTimeCode = new Regex(@"^E 1 \d:\d\d:\d\d.\d\d \d:\d\d:\d\d.\d\d Default NTP ", RegexOptions.Compiled);
            //E 1 0:50:05.42 0:50:10.06 Default NTP

            subtitle.Paragraphs.Clear();
            foreach (string line in lines)
            {
                if (regexTimeCode.IsMatch(line))
                {
                    try
                    {
                        string timePart = line.Substring(4, 10).Trim();
                        var start = DecodeTimeCode(timePart);
                        timePart = line.Substring(15, 10).Trim();
                        var end = DecodeTimeCode(timePart);
                        var paragraph = new Paragraph();
                        paragraph.StartTime = start;
                        paragraph.EndTime = end;
                        paragraph.Text = line.Substring(38).Replace(" \\n ", Environment.NewLine).Replace("\\n", Environment.NewLine);
                        subtitle.Paragraphs.Add(paragraph);
                    }
                    catch
                    {
                        _errorCount++;
                    }
                }
            }
            subtitle.Renumber();
        }
开发者ID:Team-Vengeance,项目名称:SubtitleEdit,代码行数:31,代码来源:ZeroG.cs


示例11: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            var sb = new StringBuilder();

            sb.AppendLine(" " + subtitle.Paragraphs.Count.ToString() + "           4             1234 ");
            sb.AppendLine(@"NORMAL
00:00:00.00

SRPSKI

00:00:00.00
26.11.2008  18:54:15");

            foreach (Paragraph p in subtitle.Paragraphs)
            {
                string firstLine = string.Empty;
                string secondLine = string.Empty;
                string[] lines = p.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (lines.Length > 2)
                {
                    lines = Utilities.AutoBreakLine(p.Text).Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                }
                if (lines.Length > 0)
                    firstLine = lines[0];
                if (lines.Length > 1)
                    secondLine = lines[1];

                sb.AppendLine(string.Format(" {0}          {1} " + Environment.NewLine +
                                            "1    0    0    0    0    0" + Environment.NewLine +
                                            "{2}" + Environment.NewLine +
                                            "{3}", p.StartTime.TotalMilliseconds / 10, p.EndTime.TotalMilliseconds / 10, firstLine, secondLine));
            }
            return sb.ToString().Trim();
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:34,代码来源:UnknownSubtitle6.cs


示例12: LoadSubtitle

 public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
 {
     _errorCount = 0;
     Paragraph p = null;
     subtitle.Paragraphs.Clear();
     foreach (string line in lines)
     {
         if (regexTimeCodes.IsMatch(line))
         {
             p = new Paragraph(DecodeTimeCode(line), new TimeCode(0,0,0,0), string.Empty);
             subtitle.Paragraphs.Add(p);
         }
         else if (line.Trim().Length == 0)
         {
             // skip these lines
         }
         else if (line.Trim().Length > 0 && p != null)
         {
             if (string.IsNullOrEmpty(p.Text))
                 p.Text = line;
             else
                 p.Text = p.Text + Environment.NewLine + line;
         }
     }
     foreach (Paragraph p2 in subtitle.Paragraphs)
     {
         p2.Text = Utilities.AutoBreakLine(p2.Text);
     }
     subtitle.RecalculateDisplayTimes(Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds, null);
     subtitle.Renumber(1);
 }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:31,代码来源:YouTubeTranscript.cs


示例13: IsMine

        public override bool IsMine(List<string> lines, string fileName)
        {
            var subtitle = new Subtitle();
            LoadSubtitle(subtitle, lines, fileName);

            if (subtitle.Paragraphs.Count > 4)
            {
                bool allStartWithNumber = true;
                foreach (Paragraph p in subtitle.Paragraphs)
                {
                    if (p.Text.Length > 1 && !Utilities.IsInteger(p.Text.Substring(0, 2)))
                    {
                        allStartWithNumber = false;
                        break;
                    }
                }
                if (allStartWithNumber)
                    return false;
            }
            if (subtitle.Paragraphs.Count > _errorCount)
            {
                if (new UnknownSubtitle33().IsMine(lines, fileName) || new UnknownSubtitle36().IsMine(lines, fileName) || new TMPlayer().IsMine(lines, fileName))
                    return false;
                return true;
            }
            return false;
        }
开发者ID:mgziminsky,项目名称:subtitleedit,代码行数:27,代码来源:Lrc.cs


示例14: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            StringBuilder sb = new StringBuilder();
            int index = 0;
            sb.AppendLine("<Window" + Environment.NewLine +
                "  Width    = \"640\"" + Environment.NewLine +
                "  Height   = \"480\"" + Environment.NewLine +
                "  WordWrap = \"true\"" + Environment.NewLine +
                "  Loop     = \"true\"" + Environment.NewLine +
                "  bgcolor  = \"black\"" + Environment.NewLine +
                ">" + Environment.NewLine +
                "<Font" + Environment.NewLine +
                "  Color = \"white\"" + Environment.NewLine +
                "  Face  = \"Arial\"" + Environment.NewLine +
                "  Size  = \"+2\"" + Environment.NewLine +
                ">" + Environment.NewLine +
                "<center>" + Environment.NewLine +
                "<b>" + Environment.NewLine);

            foreach (Paragraph p in subtitle.Paragraphs)
            {
                //<Time begin="0:03:24.8" end="0:03:29.4" /><clear/>Man stjæler ikke fra Chavo, nej.
                sb.AppendLine(string.Format("<Time begin=\"{0}\" end=\"{1}\" /><clear/>{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), p.Text.Replace(Environment.NewLine, " ")));
                index++;
            }
            sb.AppendLine("</b>");
            sb.AppendLine("</center>");
            return sb.ToString();
        }
开发者ID:lalberto8085,项目名称:subtitleedit,代码行数:29,代码来源:RealTime.cs


示例15: Initialize

        /// <summary>
        /// The initialize.
        /// </summary>
        /// <param name="subtitle">
        /// The subtitle.
        /// </param>
        /// <param name="fileName">
        /// The file name.
        /// </param>
        internal void Initialize(Subtitle subtitle, string fileName)
        {
            this._subtitle = subtitle;
            this._fileName = fileName;
            this.textBoxText.ReadOnly = true;
            this.comboBoxTimeCodeSeparator.SelectedIndex = 0;
            this.GeneratePreview();

            this.comboBoxEncoding.Items.Clear();
            int encodingSelectedIndex = 0;
            this.comboBoxEncoding.Items.Add(Encoding.UTF8.EncodingName);
            foreach (EncodingInfo ei in Encoding.GetEncodings())
            {
                if (ei.Name != Encoding.UTF8.BodyName && ei.CodePage >= 949 && !ei.DisplayName.Contains("EBCDIC") && ei.CodePage != 1047)
                {
                    this.comboBoxEncoding.Items.Add(ei.CodePage + ": " + ei.DisplayName);
                    if (ei.Name == Configuration.Settings.General.DefaultEncoding)
                    {
                        encodingSelectedIndex = this.comboBoxEncoding.Items.Count - 1;
                    }
                }
            }

            this.comboBoxEncoding.SelectedIndex = encodingSelectedIndex;
        }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:34,代码来源:ExportText.cs


示例16: LoadSubtitle

 public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
 {
     _errorCount = 0;
     subtitle.Paragraphs.Clear();
     foreach (string line in lines)
     {
         var s = line.Trim();
         if (s.Length > 35 && RegexTimeCodes.IsMatch(s))
         {
             try
             {
                 string timePart = s.Substring(4, 10).TrimEnd();
                 var start = DecodeTimeCode(timePart);
                 timePart = s.Substring(15, 10).Trim();
                 var end = DecodeTimeCode(timePart);
                 var paragraph = new Paragraph { StartTime = start, EndTime = end };
                 paragraph.Text = s.Substring(38).Replace(" \\n ", Environment.NewLine).Replace("\\n", Environment.NewLine);
                 subtitle.Paragraphs.Add(paragraph);
             }
             catch
             {
                 _errorCount++;
             }
         }
     }
     subtitle.Renumber();
 }
开发者ID:LeonCheung,项目名称:subtitleedit,代码行数:27,代码来源:ZeroG.cs


示例17: LoadSubtitle

        public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
        {
            _errorCount = 0;
            var sb = new StringBuilder();
            foreach (string line in lines)
                sb.AppendLine(line);

            string rtf = sb.ToString().Trim();
            if (!rtf.StartsWith("{\\rtf"))
                return;

            string[] arr = null;
            var rtBox = new System.Windows.Forms.RichTextBox();
            try
            {
                rtBox.Rtf = rtf;
                arr = rtBox.Text.Replace("\r", string.Empty).Split('\n');
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception.Message);
                return;
            }
            finally
            {
                rtBox.Dispose();
            }

            lines = new List<string>();
            foreach (string s in arr)
                lines.Add(s);
            base.LoadSubtitle(subtitle, lines, fileName);
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:33,代码来源:UnknownSubtitle24.cs


示例18: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            const string paragraphWriteFormat = "{0:00}:{1:00}:{2:00}.{3:00}, {4:00}:{5:00}:{6:00}.{7:00}{8}{9}";

            //00:00:07.00, 00:00:12.00
            //Welche Auswirkung Mikroversicherungen auf unsere Klienten hat? Lassen wir sie für sich selber sprechen!
            //
            //00:00:22.00, 00:00:27.00
            //Arme Menschen in Uganda leben oft in schlechten Unterkünften.

            var sb = new StringBuilder();
            foreach (Paragraph p in subtitle.Paragraphs)
            {
                string text = p.Text.Replace(Environment.NewLine, "|");

                sb.AppendLine(string.Format(paragraphWriteFormat,
                                        p.StartTime.Hours,
                                        p.StartTime.Minutes,
                                        p.StartTime.Seconds,
                                        RoundTo2Cifres(p.StartTime.Milliseconds),
                                        p.EndTime.Hours,
                                        p.EndTime.Minutes,
                                        p.EndTime.Seconds,
                                        RoundTo2Cifres(p.EndTime.Milliseconds),
                                        Environment.NewLine,
                                        text));
                sb.AppendLine();
            }
            return sb.ToString().Trim();
        }
开发者ID:m1croN,项目名称:subtitleedit,代码行数:30,代码来源:UnknownSubtitle4.cs


示例19: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            var sb = new StringBuilder();
            sb.AppendLine("#\tAppearance\tCaption\t");
            sb.AppendLine();
            int count = 1;
            for (int i = 0; i < subtitle.Paragraphs.Count; i++)
            {
                Paragraph p = subtitle.Paragraphs[i];
                string text = Utilities.RemoveHtmlTags(p.Text);
                sb.AppendLine(string.Format("{0}\t{1}\t{2}\t", count.ToString().PadLeft(5, ' '), MakeTimeCode(p.StartTime), text));
                sb.AppendLine("\t\t\t\t");
                Paragraph next = subtitle.GetParagraphOrDefault(i + 1);
                if (next == null || Math.Abs(p.EndTime.TotalMilliseconds - next.StartTime.TotalMilliseconds) > 50)
                {
                    count++;
                    sb.AppendLine(string.Format("{0}\t{1}", count.ToString().PadLeft(5, ' '), MakeTimeCode(p.EndTime)));
                }
                count++;
            }

            var rtBox = new System.Windows.Forms.RichTextBox();
            rtBox.Text = sb.ToString();
            string rtf = rtBox.Rtf;
            rtBox.Dispose();
            return rtf;
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:27,代码来源:UnknownSubtitle21.cs


示例20: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            //SUBTITLE: 1   TIMEIN: 00:00:07:01 DURATION: 03:11 TIMEOUT: 00:00:10:12
            //Voor de oorlog

            //SUBTITLE: 2   TIMEIN: 00:00:10:16 DURATION: 01:08 TIMEOUT: 00:00:11:24
            //Ik ben Marie Pinhas. Ik ben geboren
            //in Thessaloniki in Griekenland,

            //SUBTITLE: 3   TIMEIN: 00:00:12:12 DURATION: 02:10 TIMEOUT: 00:00:14:22
            //op 6 maart '31,
            //in een heel oude Griekse familie.

            const string paragraphWriteFormat = "SUBTITLE: {1}\tTIMEIN: {0}\tDURATION: {4}\tTIMEOUT: {2}\r\n{3}\r\n";

            var sb = new StringBuilder();
            int count = 1;
            foreach (Paragraph p in subtitle.Paragraphs)
            {
                // to avoid rounding errors in duration
                var startFrame = MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds);
                var endFrame = MillisecondsToFramesMaxFrameRate(p.EndTime.Milliseconds);
                var durationCalc = new Paragraph(
                        new TimeCode(p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, FramesToMillisecondsMax999(startFrame)),
                        new TimeCode(p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, FramesToMillisecondsMax999(endFrame)),
                        string.Empty);

                string startTime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, startFrame);
                string timeOut = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, endFrame);
                string timeDuration = string.Format("{0:00}:{1:00}", durationCalc.Duration.Seconds, MillisecondsToFramesMaxFrameRate(durationCalc.Duration.Milliseconds));
                sb.AppendLine(string.Format(paragraphWriteFormat, startTime, count, timeOut, p.Text, timeDuration));
                count++;
            }
            return sb.ToString().Trim();
        }
开发者ID:aisam97,项目名称:subtitleedit,代码行数:35,代码来源:SwiftTextLineNoAndDur.cs



注:本文中的Subtitle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SuccessCallback类代码示例发布时间:2022-05-24
下一篇:
C# Subsystem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap