本文整理汇总了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;
}
示例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);
}
示例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));
}
}
示例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));
}
}