mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
parent
8508cf7038
commit
90a8c68880
@ -171,7 +171,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (templateTrimmed == "s")
|
||||
{
|
||||
t = t.Replace("s", $"{timeCode.TotalSeconds}");
|
||||
t = t.Replace("s", $"{(long)Math.Round(timeCode.TotalSeconds, MidpointRounding.AwayFromZero)}");
|
||||
}
|
||||
|
||||
if (templateTrimmed == "zzz")
|
||||
@ -181,7 +181,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (templateTrimmed == "z")
|
||||
{
|
||||
t = t.Replace("z", $"{timeCode.TotalMilliseconds}");
|
||||
t = t.Replace("z", $"{(long)Math.Round(timeCode.TotalMilliseconds, MidpointRounding.AwayFromZero)}");
|
||||
}
|
||||
|
||||
if (templateTrimmed == "ff")
|
||||
@ -189,7 +189,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
t = t.Replace("ff", $"{SubtitleFormat.MillisecondsToFrames(timeCode.TotalMilliseconds)}");
|
||||
}
|
||||
|
||||
var totalSeconds = (int)timeCode.TotalSeconds;
|
||||
var totalSeconds = (int)Math.Round(timeCode.TotalSeconds, MidpointRounding.AwayFromZero);
|
||||
if (t.StartsWith("ssssssss", StringComparison.Ordinal))
|
||||
{
|
||||
t = t.Replace("ssssssss", $"{totalSeconds:00000000}");
|
||||
@ -225,7 +225,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
t = t.Replace("ss", $"{totalSeconds:00}");
|
||||
}
|
||||
|
||||
var totalMilliseconds = (long)timeCode.TotalMilliseconds;
|
||||
var totalMilliseconds = (long)Math.Round(timeCode.TotalMilliseconds, MidpointRounding.AwayFromZero);
|
||||
if (t.StartsWith("zzzzzzzz", StringComparison.Ordinal))
|
||||
{
|
||||
t = t.Replace("zzzzzzzz", $"{totalMilliseconds:00000000}");
|
||||
@ -340,7 +340,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
template = template.Replace("{media-file-name}", string.IsNullOrEmpty(videoFileName) ? videoFileName : Path.GetFileNameWithoutExtension(videoFileName));
|
||||
template = template.Replace("{media-file-name-with-ext}", string.IsNullOrEmpty(videoFileName) ? videoFileName : Path.GetFileName(videoFileName));
|
||||
template = template.Replace("{#lines}", subtitle.Paragraphs.Count.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
|
||||
template = template.Replace("{tab}", "\t");
|
||||
return template;
|
||||
}
|
||||
@ -356,7 +356,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (timeCodeTemplate == "zzz" || timeCodeTemplate == "zz" || timeCodeTemplate == "z")
|
||||
{
|
||||
d = duration.TotalMilliseconds.ToString(CultureInfo.InvariantCulture);
|
||||
d = ((long)Math.Round(duration.TotalMilliseconds, MidpointRounding.AwayFromZero)).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (timeCodeTemplate == "sss" || timeCodeTemplate == "ss" || timeCodeTemplate == "s")
|
||||
@ -446,8 +446,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string.IsNullOrEmpty(videoFileName) ? string.Empty : Path.GetFileName(videoFileName),
|
||||
actorColonSpace,
|
||||
actorUppercaseBracketsSpace
|
||||
)
|
||||
;
|
||||
);
|
||||
s = PostCurly(s, replaceStart, replaceEnd);
|
||||
return s;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user