Пример #1
0
        public string ToSSFF()
        {
            var ts     = TimeSpan;
            var frames = Math.Round(ts.Milliseconds / (BaseUnit / Configuration.Settings.General.CurrentFrameRate));

            if (frames >= Configuration.Settings.General.CurrentFrameRate - 0.001)
            {
                return(string.Format("{0:00}:{1:00}", ts.Seconds + 1, 0));
            }
            return(string.Format("{0:00}:{1:00}", ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds)));
        }
        public void MillisecondsToFramesMaxFrameRate()
        {
            Configuration.Settings.General.CurrentFrameRate = 30;
            var fr = SubtitleFormat.MillisecondsToFramesMaxFrameRate(100);

            Assert.AreEqual(3, fr);
            fr = SubtitleFormat.MillisecondsToFramesMaxFrameRate(1000);
            Assert.AreEqual(29, fr);

            fr = SubtitleFormat.MillisecondsToFramesMaxFrameRate(2000);
            Assert.AreEqual(29, fr);
        }
Пример #3
0
        public string ToShortStringHHMMSSFF()
        {
            var ts = TimeSpan;

            if (ts.Minutes == 0 && ts.Hours == 0)
            {
                return(string.Format("{0:00}:{1:00}", ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds)));
            }
            if (ts.Hours == 0)
            {
                return(string.Format("{0:00}:{1:00}:{2:00}", ts.Minutes, ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds)));
            }
            return(string.Format("{0:00}:{1:00}:{2:00}:{3:00}", ts.Hours, ts.Minutes, ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds)));
        }
Пример #4
0
        public string ToSSFF()
        {
            string s;
            var    ts     = TimeSpan;
            var    frames = Math.Round(ts.Milliseconds / (BaseUnit / Configuration.Settings.General.CurrentFrameRate));

            if (frames >= Configuration.Settings.General.CurrentFrameRate - 0.001)
            {
                s = string.Format("{0:00}:{1:00}", ts.Seconds + 1, 0);
            }
            else
            {
                s = string.Format("{0:00}:{1:00}", ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds));
            }

            if (TotalMilliseconds >= 0)
            {
                return(s);
            }
            return("-" + s.RemoveChar('-'));
        }
Пример #5
0
        public string ToHHMMSSPeriodFF()
        {
            var ts = TimeSpan;

            return(string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds)));
        }
        internal static string GetParagraph(string template, string start, string end, string text, string translation, int number, string actor, TimeCode duration, string timeCodeTemplate, Paragraph p)
        {
            var cps = Utilities.GetCharactersPerSecond(p);
            var 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 = $"{duration.Seconds:00}.{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss:ff", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}:{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss,ff", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00},{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss;ff", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss.zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}.{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss:zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}:{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss,zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00},{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss;zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss.zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}.{Math.Round(duration.Milliseconds / 10.0):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss:zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}:{Math.Round(duration.Milliseconds / 10.0):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss,zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00},{Math.Round(duration.Milliseconds / 10.0):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss;zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{Math.Round(duration.Milliseconds / 10.0):00}";
            }

            var lines = text.SplitToLines();
            var line1 = string.Empty;
            var line2 = string.Empty;

            if (lines.Count > 0)
            {
                line1 = lines[0];
            }

            if (lines.Count > 1)
            {
                line2 = lines[1];
            }

            var s = template;

            s = s.Replace("{{", "@@@@_@@@{");
            s = s.Replace("}}", "}@@@_@@@@");
            s = string.Format(s, start, end, text, translation, number + 1, number, d, actor, line1, line2,
                              cps.ToString(CultureInfo.InvariantCulture).Replace(".", ","),
                              cps.ToString(CultureInfo.InvariantCulture),
                              text.Length,
                              p.Text.RemoveChar('\r', '\n').Length,
                              p.Text.RemoveChar('\r', '\n').Length + lines.Count - 1,
                              p.Text.RemoveChar('\r', '\n').Length + (lines.Count - 1) * 2);
            s = s.Replace("@@@@_@@@", "{");
            s = s.Replace("@@@_@@@@", "}");
            return(s);
        }
        public static string GetTimeCode(TimeCode timeCode, string template)
        {
            var t = template;
            var templateTrimmed = t.Trim();

            if (templateTrimmed == "ss")
            {
                t = t.Replace("ss", $"{timeCode.TotalSeconds:00}");
            }

            if (templateTrimmed == "s")
            {
                t = t.Replace("s", $"{timeCode.TotalSeconds}");
            }

            if (templateTrimmed == "zzz")
            {
                t = t.Replace("zzz", $"{timeCode.TotalMilliseconds:000}");
            }

            if (templateTrimmed == "z")
            {
                t = t.Replace("z", $"{timeCode.TotalMilliseconds}");
            }

            if (templateTrimmed == "ff")
            {
                t = t.Replace("ff", $"{SubtitleFormat.MillisecondsToFrames(timeCode.TotalMilliseconds)}");
            }

            var totalSeconds = (int)timeCode.TotalSeconds;

            if (t.StartsWith("ssssssss", StringComparison.Ordinal))
            {
                t = t.Replace("ssssssss", $"{totalSeconds:00000000}");
            }

            if (t.StartsWith("sssssss", StringComparison.Ordinal))
            {
                t = t.Replace("sssssss", $"{totalSeconds:0000000}");
            }

            if (t.StartsWith("ssssss", StringComparison.Ordinal))
            {
                t = t.Replace("ssssss", $"{totalSeconds:000000}");
            }

            if (t.StartsWith("sssss", StringComparison.Ordinal))
            {
                t = t.Replace("sssss", $"{totalSeconds:00000}");
            }

            if (t.StartsWith("ssss", StringComparison.Ordinal))
            {
                t = t.Replace("ssss", $"{totalSeconds:0000}");
            }

            if (t.StartsWith("sss", StringComparison.Ordinal))
            {
                t = t.Replace("sss", $"{totalSeconds:000}");
            }

            if (t.StartsWith("ss", StringComparison.Ordinal))
            {
                t = t.Replace("ss", $"{totalSeconds:00}");
            }

            var totalMilliseconds = (long)timeCode.TotalMilliseconds;

            if (t.StartsWith("zzzzzzzz", StringComparison.Ordinal))
            {
                t = t.Replace("zzzzzzzz", $"{totalMilliseconds:00000000}");
            }

            if (t.StartsWith("zzzzzzz", StringComparison.Ordinal))
            {
                t = t.Replace("zzzzzzz", $"{totalMilliseconds:0000000}");
            }

            if (t.StartsWith("zzzzzz", StringComparison.Ordinal))
            {
                t = t.Replace("zzzzzz", $"{totalMilliseconds:000000}");
            }

            if (t.StartsWith("zzzzz", StringComparison.Ordinal))
            {
                t = t.Replace("zzzzz", $"{totalMilliseconds:00000}");
            }

            if (t.StartsWith("zzzz", StringComparison.Ordinal))
            {
                t = t.Replace("zzzz", $"{totalMilliseconds:0000}");
            }

            if (t.StartsWith("zzz", StringComparison.Ordinal))
            {
                t = t.Replace("zzz", $"{totalMilliseconds:000}");
            }

            t = t.Replace("hh", $"{timeCode.Hours:00}");
            t = t.Replace("h", $"{timeCode.Hours}");
            t = t.Replace("mm", $"{timeCode.Minutes:00}");
            t = t.Replace("m", $"{timeCode.Minutes}");
            t = t.Replace("ss", $"{timeCode.Seconds:00}");
            t = t.Replace("s", $"{timeCode.Seconds}");
            t = t.Replace("zzz", $"{timeCode.Milliseconds:000}");
            t = t.Replace("zz", $"{Math.Round(timeCode.Milliseconds / 10.0):00}");
            t = t.Replace("z", $"{Math.Round(timeCode.Milliseconds / 100.0):0}");
            t = t.Replace("ff", $"{SubtitleFormat.MillisecondsToFramesMaxFrameRate(timeCode.Milliseconds):00}");
            t = t.Replace("f", $"{SubtitleFormat.MillisecondsToFramesMaxFrameRate(timeCode.Milliseconds)}");
            return(t);
        }
Пример #8
0
        internal static string GetParagraph(string template, string start, string end, string text, string translation, int number, string actor, 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 = $"{duration.Seconds:00}.{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss:ff", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}:{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss,ff", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00},{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss;ff", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss;ff", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss.zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}.{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss:zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}:{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss,zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00},{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss;zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss;zzz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{duration.Milliseconds:000}";
            }
            else if (timeCodeTemplate.EndsWith("ss.zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}.{Math.Round(duration.Milliseconds / 10.0):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss:zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00}:{Math.Round(duration.Milliseconds / 10.0):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss,zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00},{Math.Round(duration.Milliseconds / 10.0):00}";
            }
            else if (timeCodeTemplate.EndsWith("ss;zz", StringComparison.Ordinal))
            {
                d = $"{duration.Seconds:00};{Math.Round(duration.Milliseconds / 10.0):00}";
            }

            string s = template;

            s = s.Replace("{{", "@@@@_@@@{");
            s = s.Replace("}}", "}@@@_@@@@");
            s = string.Format(s, start, end, text, translation, number + 1, number, d, actor);
            s = s.Replace("@@@@_@@@", "{");
            s = s.Replace("@@@_@@@@", "}");
            return(s);
        }
Пример #9
0
        public string ToHHMMSSPeriodFF()
        {
            string s;
            var    ts     = TimeSpan;
            var    frames = Math.Round(ts.Milliseconds / (BaseUnit / Configuration.Settings.General.CurrentFrameRate));

            if (frames >= Configuration.Settings.General.CurrentFrameRate - 0.001)
            {
                s = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Days * 24 + ts.Hours, ts.Minutes, ts.Seconds + 1, 0);
            }
            else
            {
                s = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Days * 24 + ts.Hours, ts.Minutes, ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds));
            }

            return(PrefixSign(s));
        }
Пример #10
0
        public string ToHHMMSSFF()
        {
            string s;
            var    ts     = TimeSpan;
            var    frames = Math.Round(ts.Milliseconds / (BaseUnit / Configuration.Settings.General.CurrentFrameRate));

            if (frames >= Configuration.Settings.General.CurrentFrameRate - 0.001)
            {
                s = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", ts.Days * 24 + ts.Hours, ts.Minutes, ts.Seconds + 1, 0);
            }
            else
            {
                s = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", ts.Days * 24 + ts.Hours, ts.Minutes, ts.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds));
            }

            if (TotalMilliseconds >= 0)
            {
                return(s);
            }
            return("-" + s.Replace("-", string.Empty));
        }
Пример #11
0
        public static string GetTimeCode(TimeCode timeCode, string template)
        {
            if (template.Trim() == "ss")
            {
                template = template.Replace("ss", string.Format("{0:00}", timeCode.TotalSeconds));
            }
            if (template.Trim() == "s")
            {
                template = template.Replace("s", string.Format("{0}", timeCode.TotalSeconds));
            }
            if (template.Trim() == "zzz")
            {
                template = template.Replace("zzz", string.Format("{0:000}", timeCode.TotalMilliseconds));
            }
            if (template.Trim() == "z")
            {
                template = template.Replace("z", string.Format("{0}", timeCode.TotalMilliseconds));
            }
            if (template.Trim() == "ff")
            {
                template = template.Replace("ff", string.Format("{0}", SubtitleFormat.MillisecondsToFrames(timeCode.TotalMilliseconds)));
            }

            if (template.StartsWith("ssssssss"))
            {
                template = template.Replace("ssssssss", string.Format("{0:00000000}", timeCode.TotalSeconds));
            }
            if (template.StartsWith("sssssss"))
            {
                template = template.Replace("sssssss", string.Format("{0:0000000}", timeCode.TotalSeconds));
            }
            if (template.StartsWith("ssssss"))
            {
                template = template.Replace("ssssss", string.Format("{0:000000}", timeCode.TotalSeconds));
            }
            if (template.StartsWith("sssss"))
            {
                template = template.Replace("sssss", string.Format("{0:00000}", timeCode.TotalSeconds));
            }
            if (template.StartsWith("ssss"))
            {
                template = template.Replace("ssss", string.Format("{0:0000}", timeCode.TotalSeconds));
            }
            if (template.StartsWith("sss"))
            {
                template = template.Replace("sss", string.Format("{0:000}", timeCode.TotalSeconds));
            }
            if (template.StartsWith("ss"))
            {
                template = template.Replace("ss", string.Format("{0:00}", timeCode.TotalSeconds));
            }

            if (template.StartsWith("zzzzzzzz"))
            {
                template = template.Replace("zzzzzzzz", string.Format("{0:00000000}", timeCode.TotalMilliseconds));
            }
            if (template.StartsWith("zzzzzzz"))
            {
                template = template.Replace("zzzzzzz", string.Format("{0:0000000}", timeCode.TotalMilliseconds));
            }
            if (template.StartsWith("zzzzzz"))
            {
                template = template.Replace("zzzzzz", string.Format("{0:000000}", timeCode.TotalMilliseconds));
            }
            if (template.StartsWith("zzzzz"))
            {
                template = template.Replace("zzzzz", string.Format("{0:00000}", timeCode.TotalMilliseconds));
            }
            if (template.StartsWith("zzzz"))
            {
                template = template.Replace("zzzz", string.Format("{0:0000}", timeCode.TotalMilliseconds));
            }
            if (template.StartsWith("zzz"))
            {
                template = template.Replace("zzz", string.Format("{0:000}", timeCode.TotalMilliseconds));
            }

            template = template.Replace("hh", string.Format("{0:00}", timeCode.Hours));
            template = template.Replace("h", string.Format("{0}", timeCode.Hours));
            template = template.Replace("mm", string.Format("{0:00}", timeCode.Minutes));
            template = template.Replace("m", string.Format("{0}", timeCode.Minutes));
            template = template.Replace("ss", string.Format("{0:00}", timeCode.Seconds));
            template = template.Replace("s", string.Format("{0}", timeCode.Seconds));
            template = template.Replace("zzz", string.Format("{0:000}", timeCode.Milliseconds));
            template = template.Replace("zz", string.Format("{0:00}", Math.Round(timeCode.Milliseconds / 10.0)));
            template = template.Replace("z", string.Format("{0:0}", Math.Round(timeCode.Milliseconds / 100.0)));
            template = template.Replace("ff", string.Format("{0:00}", SubtitleFormat.MillisecondsToFramesMaxFrameRate(timeCode.Milliseconds)));
            template = template.Replace("f", string.Format("{0}", SubtitleFormat.MillisecondsToFramesMaxFrameRate(timeCode.Milliseconds)));
            return(template);
        }
Пример #12
0
        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();
            }
            if (timeCodeTemplate == "zzz" || timeCodeTemplate == "zz" || timeCodeTemplate == "z")
            {
                d = duration.TotalMilliseconds.ToString();
            }
            if (timeCodeTemplate == "sss" || timeCodeTemplate == "ss" || timeCodeTemplate == "s")
            {
                d = duration.Seconds.ToString();
            }
            else if (timeCodeTemplate.EndsWith("ss.ff"))
            {
                d = string.Format("{0:00}.{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            }
            else if (timeCodeTemplate.EndsWith("ss:ff"))
            {
                d = string.Format("{0:00}:{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            }
            else if (timeCodeTemplate.EndsWith("ss,ff"))
            {
                d = string.Format("{0:00},{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            }
            else if (timeCodeTemplate.EndsWith("ss;ff"))
            {
                d = string.Format("{0:00};{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            }
            else if (timeCodeTemplate.EndsWith("ss;ff"))
            {
                d = string.Format("{0:00};{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            }
            else if (timeCodeTemplate.EndsWith("ss.zzz"))
            {
                d = string.Format("{0:00}.{1:000}", duration.Seconds, duration.Milliseconds);
            }
            else if (timeCodeTemplate.EndsWith("ss:zzz"))
            {
                d = string.Format("{0:00}:{1:000}", duration.Seconds, duration.Milliseconds);
            }
            else if (timeCodeTemplate.EndsWith("ss,zzz"))
            {
                d = string.Format("{0:00},{1:000}", duration.Seconds, duration.Milliseconds);
            }
            else if (timeCodeTemplate.EndsWith("ss;zzz"))
            {
                d = string.Format("{0:00};{1:000}", duration.Seconds, duration.Milliseconds);
            }
            else if (timeCodeTemplate.EndsWith("ss;zzz"))
            {
                d = string.Format("{0:00};{1:000}", duration.Seconds, duration.Milliseconds);
            }
            else if (timeCodeTemplate.EndsWith("ss.zz"))
            {
                d = string.Format("{0:00}.{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            }
            else if (timeCodeTemplate.EndsWith("ss:zz"))
            {
                d = string.Format("{0:00}:{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            }
            else if (timeCodeTemplate.EndsWith("ss,zz"))
            {
                d = string.Format("{0:00},{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            }
            else if (timeCodeTemplate.EndsWith("ss;zz"))
            {
                d = string.Format("{0:00};{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            }

            string s = template;

            s = s.Replace("{{", "@@@@_@@@{");
            s = s.Replace("}}", "}@@@_@@@@");
            s = string.Format(s, start, end, text, translation, number + 1, number, d);
            s = s.Replace("@@@@_@@@", "{");
            s = s.Replace("@@@_@@@@", "}");
            return(s);
        }