当前位置: 首页>>代码示例>>C#>>正文


C# TimeCode.ToString方法代码示例

本文整理汇总了C#中Nikse.SubtitleEdit.Core.TimeCode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TimeCode.ToString方法的具体用法?C# TimeCode.ToString怎么用?C# TimeCode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nikse.SubtitleEdit.Core.TimeCode的用法示例。


在下文中一共展示了TimeCode.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetParagraph

        internal static string GetParagraph(string template, string start, string end, string text, string translation, int number, TimeCode duration, string timeCodeTemplate)
        {
            string d = duration.ToString();
            if (timeCodeTemplate == "ff" || timeCodeTemplate == "f")
                d = SubtitleFormat.MillisecondsToFrames(duration.TotalMilliseconds).ToString(CultureInfo.InvariantCulture);
            if (timeCodeTemplate == "zzz" || timeCodeTemplate == "zz" || timeCodeTemplate == "z")
                d = duration.TotalMilliseconds.ToString(CultureInfo.InvariantCulture);
            if (timeCodeTemplate == "sss" || timeCodeTemplate == "ss" || timeCodeTemplate == "s")
                d = duration.Seconds.ToString(CultureInfo.InvariantCulture);
            else if (timeCodeTemplate.EndsWith("ss.ff", StringComparison.Ordinal))
                d = string.Format("{0:00}.{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss:ff", StringComparison.Ordinal))
                d = string.Format("{0:00}:{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss,ff", StringComparison.Ordinal))
                d = string.Format("{0:00},{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss;ff", StringComparison.Ordinal))
                d = string.Format("{0:00};{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss;ff", StringComparison.Ordinal))
                d = string.Format("{0:00};{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss.zzz", StringComparison.Ordinal))
                d = string.Format("{0:00}.{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss:zzz", StringComparison.Ordinal))
                d = string.Format("{0:00}:{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss,zzz", StringComparison.Ordinal))
                d = string.Format("{0:00},{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss;zzz", StringComparison.Ordinal))
                d = string.Format("{0:00};{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss;zzz", StringComparison.Ordinal))
                d = string.Format("{0:00};{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss.zz", StringComparison.Ordinal))
                d = string.Format("{0:00}.{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            else if (timeCodeTemplate.EndsWith("ss:zz", StringComparison.Ordinal))
                d = string.Format("{0:00}:{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            else if (timeCodeTemplate.EndsWith("ss,zz", StringComparison.Ordinal))
                d = string.Format("{0:00},{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            else if (timeCodeTemplate.EndsWith("ss;zz", StringComparison.Ordinal))
                d = string.Format("{0:00};{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));

            string s = template;
            s = s.Replace("{{", "@@@@[email protected]@@{");
            s = s.Replace("}}", "}@@@[email protected]@@@");
            s = string.Format(s, start, end, text, translation, number + 1, number, d);
            s = s.Replace("@@@@[email protected]@@", "{");
            s = s.Replace("@@@[email protected]@@@", "}");
            return s;
        }
开发者ID:leeyikkong,项目名称:testing,代码行数:46,代码来源:ExportCustomTextFormat.cs

示例2: ToTimeCode

 /// <summary>
 /// The to time code.
 /// </summary>
 /// <param name="tc">
 /// The tc.
 /// </param>
 /// <returns>
 /// The <see cref="string"/>.
 /// </returns>
 private static string ToTimeCode(TimeCode tc)
 {
     int last = (int)(tc.Milliseconds / 10.0D + 0.5D);
     return tc.ToString().Substring(0, 8) + ":" + string.Format("{0:0#}", last);
 }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:14,代码来源:UnknownSubtitle15.cs

示例3: SetTotalMilliseconds

 public void SetTotalMilliseconds(double milliseconds)
 {
     if (Mode == TimeMode.HHMMSSMS)
     {
         if (milliseconds < 0)
             maskedTextBox1.Mask = "-00:00:00.000";
         else
             maskedTextBox1.Mask = "00:00:00.000";
         maskedTextBox1.Text = new TimeCode(milliseconds).ToString();
     }
     else
     {
         var tc = new TimeCode(milliseconds);
         maskedTextBox1.Text = tc.ToString().Substring(0, 9) + string.Format("{0:00}", Core.SubtitleFormats.SubtitleFormat.MillisecondsToFrames(tc.Milliseconds));
     }
 }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:16,代码来源:TimeUpDown.cs

示例4: SetTotalMilliseconds

 public void SetTotalMilliseconds(double milliseconds)
 {
     if (UseVideoOffset)
     {
         milliseconds += Configuration.Settings.General.CurrentVideoOffsetInMs;
     }
     if (Mode == TimeMode.HHMMSSMS)
     {
         if (milliseconds < 0)
             maskedTextBox1.Mask = "-00:00:00.000";
         else
             maskedTextBox1.Mask = "00:00:00.000";
         maskedTextBox1.Text = new TimeCode(milliseconds).ToString();
     }
     else
     {
         var tc = new TimeCode(milliseconds);
         maskedTextBox1.Text = tc.ToString().Substring(0, 9) + string.Format("{0:00}", Core.SubtitleFormats.SubtitleFormat.MillisecondsToFrames(tc.Milliseconds));
     }
 }
开发者ID:YangEunYong,项目名称:subtitleedit,代码行数:20,代码来源:TimeUpDown.cs


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