From c87ed8eade74b41e7d24c114e062e50ca70f1be6 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 15 Jul 2023 09:17:18 +0200 Subject: [PATCH] Minor optimization for Paragraph.Duration - thx ivandrofly :) Fix #7054 --- src/Test/Logic/ParagraphTest.cs | 2 +- src/Test/Logic/SplitLongLinesHelperTest.cs | 4 +- src/libse/AudioToText/WhisperTimingFixer.cs | 16 +-- src/libse/Common/FixDurationLimits.cs | 4 +- src/libse/Common/Paragraph.cs | 4 +- src/libse/Common/Subtitle.cs | 6 +- src/libse/Common/UnknownFormatImporter.cs | 6 +- src/libse/Common/UnknownFormatImporterJson.cs | 2 +- src/libse/Common/Utilities.cs | 21 ++-- .../FixCommonErrors/FixLongDisplayTimes.cs | 2 +- .../FixOverlappingDisplayTimes.cs | 18 +-- .../FixCommonErrors/FixShortDisplayTimes.cs | 18 +-- src/libse/Forms/SplitLongLinesHelper.cs | 2 +- .../NetflixCheckMaxDuration.cs | 2 +- .../NetflixCheckMinDuration.cs | 6 +- .../SubtitleFormats/AdobeAfterEffectsFTME.cs | 2 +- src/libse/SubtitleFormats/CaptionsInc.cs | 2 +- src/libse/SubtitleFormats/CheetahCaption.cs | 6 +- .../SubtitleFormats/CheetahCaptionOld.cs | 6 +- src/libse/SubtitleFormats/ElrPrint.cs | 4 +- src/libse/SubtitleFormats/FLVCoreCuePoints.cs | 2 +- src/libse/SubtitleFormats/FinalCutProXCM.cs | 2 +- src/libse/SubtitleFormats/FinalCutProXXml.cs | 6 +- src/libse/SubtitleFormats/FinalCutProXml13.cs | 6 +- src/libse/SubtitleFormats/FinalCutProXml14.cs | 2 +- .../SubtitleFormats/FinalCutProXml14Text.cs | 4 +- .../SubtitleFormats/FinalCutProXmlGap.cs | 2 +- src/libse/SubtitleFormats/GooglePlayJson.cs | 2 +- src/libse/SubtitleFormats/InqScribe.cs | 2 +- src/libse/SubtitleFormats/JsonTed.cs | 2 +- src/libse/SubtitleFormats/JsonType13.cs | 4 +- src/libse/SubtitleFormats/JsonType18.cs | 2 +- src/libse/SubtitleFormats/JsonType19.cs | 2 +- src/libse/SubtitleFormats/JsonType3.cs | 2 +- src/libse/SubtitleFormats/JsonType8.cs | 2 +- src/libse/SubtitleFormats/JsonType8b.cs | 2 +- src/libse/SubtitleFormats/Lrc.cs | 2 +- src/libse/SubtitleFormats/LrcNoEndTime.cs | 2 +- src/libse/SubtitleFormats/NVivoTranscript.cs | 2 +- src/libse/SubtitleFormats/NciCaption.cs | 2 +- src/libse/SubtitleFormats/NkhCuePoints.cs | 2 +- src/libse/SubtitleFormats/Rtf2.cs | 2 +- .../SubtitleFormats/SmilTimesheetData.cs | 2 +- .../SubtitleFormats/SubtitleEditorProject.cs | 2 +- src/libse/SubtitleFormats/Ted20.cs | 6 +- src/libse/SubtitleFormats/Titra.cs | 2 +- src/libse/SubtitleFormats/Ultech130.cs | 2 +- .../SubtitleFormats/UnknownSubtitle100.cs | 2 +- .../SubtitleFormats/UnknownSubtitle104.cs | 2 +- .../SubtitleFormats/UnknownSubtitle105.cs | 4 +- .../SubtitleFormats/UnknownSubtitle106.cs | 2 +- .../SubtitleFormats/UnknownSubtitle25.cs | 2 +- .../SubtitleFormats/UnknownSubtitle27.cs | 2 +- .../SubtitleFormats/UnknownSubtitle44.cs | 2 +- .../SubtitleFormats/UnknownSubtitle46.cs | 2 +- .../SubtitleFormats/UnknownSubtitle47.cs | 2 +- src/libse/SubtitleFormats/UnknownSubtitle5.cs | 2 +- .../SubtitleFormats/UnknownSubtitle59.cs | 2 +- .../SubtitleFormats/UnknownSubtitle82.cs | 2 +- .../SubtitleFormats/UnknownSubtitle83.cs | 2 +- .../SubtitleFormats/UnknownSubtitle85.cs | 2 +- .../SubtitleFormats/UnknownSubtitle86.cs | 2 +- src/libse/SubtitleFormats/UnknownSubtitle9.cs | 2 +- .../SubtitleFormats/UnknownSubtitle98.cs | 2 +- .../SubtitleFormats/UnknownSubtitle99.cs | 2 +- src/libse/SubtitleFormats/Xmp.cs | 2 +- src/libse/VobSub/VobSubWriter.cs | 2 +- src/ui/Controls/AudioVisualizer.cs | 6 +- src/ui/Controls/SubtitleListView.cs | 4 +- src/ui/Forms/ApplyDurationLimits.cs | 4 +- src/ui/Forms/AudioClipsGet.cs | 2 +- src/ui/Forms/BatchConvert.cs | 10 +- src/ui/Forms/BinaryEdit/BinEdit.cs | 16 +-- src/ui/Forms/EffectKaraoke.cs | 8 +- src/ui/Forms/EffectTypewriter.cs | 6 +- src/ui/Forms/ErrorsGoTo.cs | 8 +- src/ui/Forms/ExportPngXml.cs | 2 +- src/ui/Forms/FixCommonErrors.cs | 4 +- src/ui/Forms/ImportText.cs | 2 +- src/ui/Forms/Main.cs | 110 +++++++++--------- src/ui/Forms/ModifySelection.cs | 4 +- src/ui/Forms/Ocr/VobSubOcr.cs | 4 +- src/ui/Forms/SpellCheck.cs | 2 +- src/ui/Forms/SplitLongLines.cs | 12 +- src/ui/Forms/Statistics.cs | 8 +- src/ui/Forms/SyncPointsSync.cs | 2 +- src/ui/Logic/UiUtil.cs | 2 +- 87 files changed, 230 insertions(+), 231 deletions(-) diff --git a/src/Test/Logic/ParagraphTest.cs b/src/Test/Logic/ParagraphTest.cs index dded753c5..eba198128 100644 --- a/src/Test/Logic/ParagraphTest.cs +++ b/src/Test/Logic/ParagraphTest.cs @@ -65,7 +65,7 @@ namespace Test.Logic public void TestDuration() { var p = new Paragraph { Text = string.Empty, StartTime = new TimeCode(0, 1, 0, 0), EndTime = new TimeCode(0, 1, 1, 1) }; - Assert.AreEqual(p.Duration.TotalMilliseconds, 1001); + Assert.AreEqual(p.DurationTotalMilliseconds, 1001); } } diff --git a/src/Test/Logic/SplitLongLinesHelperTest.cs b/src/Test/Logic/SplitLongLinesHelperTest.cs index 1f635fe85..68cbb3bff 100644 --- a/src/Test/Logic/SplitLongLinesHelperTest.cs +++ b/src/Test/Logic/SplitLongLinesHelperTest.cs @@ -65,11 +65,11 @@ namespace Test.Logic Assert.AreEqual("and laugh it off to realise that\r\nlife isn’t so bad after all.", procSubtitle.Paragraphs[6].Text); // timing test - if (procSubtitle.Paragraphs[5].Duration.TotalMilliseconds > procSubtitle.Paragraphs[6].Duration.TotalMilliseconds) + if (procSubtitle.Paragraphs[5].DurationTotalMilliseconds > procSubtitle.Paragraphs[6].DurationTotalMilliseconds) { Assert.IsTrue(procSubtitle.Paragraphs[5].Text.Length > procSubtitle.Paragraphs[6].Text.Length); } - if (procSubtitle.Paragraphs[5].Duration.TotalMilliseconds < procSubtitle.Paragraphs[6].Duration.TotalMilliseconds) + if (procSubtitle.Paragraphs[5].DurationTotalMilliseconds < procSubtitle.Paragraphs[6].DurationTotalMilliseconds) { Assert.IsTrue(procSubtitle.Paragraphs[5].Text.Length < procSubtitle.Paragraphs[6].Text.Length); } diff --git a/src/libse/AudioToText/WhisperTimingFixer.cs b/src/libse/AudioToText/WhisperTimingFixer.cs index 9a271626b..4f274ad74 100644 --- a/src/libse/AudioToText/WhisperTimingFixer.cs +++ b/src/libse/AudioToText/WhisperTimingFixer.cs @@ -61,7 +61,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText var pctHere = FindPercentage(startPos - 0.05, startPos + 0.05, wavePeaks); if (Math.Abs(pctHere - (-1)) < 0.01) { - if (p.Duration.TotalMilliseconds < minDurationMs) + if (p.DurationTotalMilliseconds < minDurationMs) { s.Paragraphs[index] = oldP; } @@ -78,7 +78,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText var pct = FindPercentage(startPosBack - 0.05, startPosBack + 0.05, wavePeaks); if (Math.Abs(pct - (-1)) < 0.01) { - if (p.Duration.TotalMilliseconds < minDurationMs) + if (p.DurationTotalMilliseconds < minDurationMs) { s.Paragraphs[index] = oldP; } @@ -86,7 +86,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText return s; } - if (pct < percentageMax + 1 && p.Duration.TotalSeconds < 5) + if (pct < percentageMax + 1 && p.DurationTotalSeconds < 5) { startPosBack -= 0.025; var pct2 = FindPercentage(startPosBack - 0.05, startPosBack + 0.05, wavePeaks); @@ -127,7 +127,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText var pctF = FindPercentage(startPosForward - 0.05, startPosForward + 0.05, wavePeaks); if (Math.Abs(pctF - (-1)) < 0.01) { - if (p.Duration.TotalMilliseconds < minDurationMs) + if (p.DurationTotalMilliseconds < minDurationMs) { s.Paragraphs[index] = oldP; } @@ -160,7 +160,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText pctHere = FindPercentage(startPos - 0.05, startPos + 0.05, wavePeaks); if (Math.Abs(pctHere - (-1)) < 0.01) { - if (p.Duration.TotalMilliseconds < minDurationMs) + if (p.DurationTotalMilliseconds < minDurationMs) { s.Paragraphs[index] = oldP; } @@ -176,7 +176,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText pctHere = FindPercentage(startPosForward - 0.05, startPosForward + 0.05, wavePeaks); if (Math.Abs(pctHere - (- 1)) < 0.01) { - if (p.Duration.TotalMilliseconds < 1000) + if (p.DurationTotalMilliseconds < 1000) { s.Paragraphs[index] = oldP; } @@ -209,7 +209,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText } } - if (p.Duration.TotalMilliseconds < minDurationMs) + if (p.DurationTotalMilliseconds < minDurationMs) { s.Paragraphs[index] = oldP; } @@ -225,7 +225,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText for (var i = 0; i < subtitle.Paragraphs.Count; i++) { var p = subtitle.Paragraphs[i]; - if (p.Duration.TotalMilliseconds > 8000) + if (p.DurationTotalMilliseconds > 8000) { p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - 5000; } diff --git a/src/libse/Common/FixDurationLimits.cs b/src/libse/Common/FixDurationLimits.cs index 0ac33c7c5..404da7a5d 100644 --- a/src/libse/Common/FixDurationLimits.cs +++ b/src/libse/Common/FixDurationLimits.cs @@ -24,7 +24,7 @@ for (int i = 0; i < subtitle.Paragraphs.Count; i++) { var p = subtitle.Paragraphs[i]; - var displayTime = p.Duration.TotalMilliseconds; + var displayTime = p.DurationTotalMilliseconds; if (displayTime < _minDurationMs) { var next = subtitle.GetParagraphOrDefault(i + 1); @@ -42,7 +42,7 @@ for (int i = 0; i < subtitle.Paragraphs.Count; i++) { var p = subtitle.Paragraphs[i]; - var displayTime = p.Duration.TotalMilliseconds; + var displayTime = p.DurationTotalMilliseconds; if (displayTime > _maxDurationMs) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + _maxDurationMs; diff --git a/src/libse/Common/Paragraph.cs b/src/libse/Common/Paragraph.cs index 1abd9460b..624b6ee9e 100644 --- a/src/libse/Common/Paragraph.cs +++ b/src/libse/Common/Paragraph.cs @@ -14,6 +14,8 @@ namespace Nikse.SubtitleEdit.Core.Common public TimeCode EndTime { get; set; } public TimeCode Duration => new TimeCode(EndTime.TotalMilliseconds - StartTime.TotalMilliseconds); + public double DurationTotalMilliseconds => EndTime.TotalMilliseconds - StartTime.TotalMilliseconds; + public double DurationTotalSeconds => (EndTime.TotalMilliseconds - StartTime.TotalMilliseconds) / TimeCode.BaseUnit; public bool Forced { get; set; } @@ -119,7 +121,7 @@ namespace Nikse.SubtitleEdit.Core.Common return 0; } - return 60.0 / Duration.TotalSeconds * Text.CountWords(); + return 60.0 / DurationTotalSeconds * Text.CountWords(); } } } diff --git a/src/libse/Common/Subtitle.cs b/src/libse/Common/Subtitle.cs index 7fd414977..6b95519cd 100644 --- a/src/libse/Common/Subtitle.cs +++ b/src/libse/Common/Subtitle.cs @@ -511,7 +511,7 @@ namespace Nikse.SubtitleEdit.Core.Common if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MinimumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds) { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; - if (p.Duration.TotalMilliseconds <= 0) + if (p.DurationTotalMilliseconds <= 0) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 1; } @@ -536,7 +536,7 @@ namespace Nikse.SubtitleEdit.Core.Common if (next != null && p.StartTime.TotalMilliseconds + fixedDurationMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds) { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; - if (p.Duration.TotalMilliseconds <= 0) + if (p.DurationTotalMilliseconds <= 0) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 1; } @@ -730,7 +730,7 @@ namespace Nikse.SubtitleEdit.Core.Common Paragraphs = Paragraphs.OrderBy(p => p.EndTime.TotalMilliseconds).ThenBy(p => p.Number).ToList(); break; case SubtitleSortCriteria.Duration: - Paragraphs = Paragraphs.OrderBy(p => p.Duration.TotalMilliseconds).ThenBy(p => p.Number).ToList(); + Paragraphs = Paragraphs.OrderBy(p => p.DurationTotalMilliseconds).ThenBy(p => p.Number).ToList(); break; case SubtitleSortCriteria.Gap: var lookupDictionary = new Dictionary(); diff --git a/src/libse/Common/UnknownFormatImporter.cs b/src/libse/Common/UnknownFormatImporter.cs index 4ad56746c..7a80c7960 100644 --- a/src/libse/Common/UnknownFormatImporter.cs +++ b/src/libse/Common/UnknownFormatImporter.cs @@ -44,13 +44,13 @@ namespace Nikse.SubtitleEdit.Core.Common { var sameLineSub = ImportTimeCodesInFramesAndTextOnSameLine(lines); if (sameLineSub.Paragraphs.Count < 10 && - (sameLineSub.Paragraphs.Count(p => p.Duration.TotalMilliseconds < 0) > 2 || + (sameLineSub.Paragraphs.Count(p => p.DurationTotalMilliseconds < 0) > 2 || sameLineSub.Paragraphs.Count(p => p.Text.Length > 100) > 1)) { // probably not a subtitle } else if (sameLineSub.Paragraphs.Count < 20 && - (sameLineSub.Paragraphs.Count(p => p.Duration.TotalMilliseconds < 0) > 8 || + (sameLineSub.Paragraphs.Count(p => p.DurationTotalMilliseconds < 0) > 8 || sameLineSub.Paragraphs.Count(p => p.Text.Length > 100) > 5)) { // probably not a subtitle @@ -764,7 +764,7 @@ namespace Nikse.SubtitleEdit.Core.Common double averateDuration = 0; foreach (Paragraph a in subtitle.Paragraphs) { - double d = a.Duration.TotalSeconds; + double d = a.DurationTotalSeconds; if (d > 10) { d = 8; diff --git a/src/libse/Common/UnknownFormatImporterJson.cs b/src/libse/Common/UnknownFormatImporterJson.cs index fb580cab8..80a6056ca 100644 --- a/src/libse/Common/UnknownFormatImporterJson.cs +++ b/src/libse/Common/UnknownFormatImporterJson.cs @@ -108,7 +108,7 @@ namespace Nikse.SubtitleEdit.Core.Common int msFound = 0; foreach (var p in subtitle.Paragraphs) { - totalDuration += p.Duration.TotalMilliseconds; + totalDuration += p.DurationTotalMilliseconds; if (p.Style.Contains("\"startMs\"") || p.Style.Contains("\"start_ms\"") || p.Style.Contains("\"startMillis\"") || diff --git a/src/libse/Common/Utilities.cs b/src/libse/Common/Utilities.cs index c9ee0ae35..79d8ac640 100644 --- a/src/libse/Common/Utilities.cs +++ b/src/libse/Common/Utilities.cs @@ -933,36 +933,33 @@ namespace Nikse.SubtitleEdit.Core.Common public static double GetCharactersPerSecond(Paragraph paragraph) { - var duration = paragraph.Duration; - if (duration.TotalMilliseconds < 1) + if (paragraph.DurationTotalMilliseconds < 1) { return 999; } - return (double)paragraph.Text.CountCharacters(true) / duration.TotalSeconds; + return (double)paragraph.Text.CountCharacters(true) / paragraph.DurationTotalSeconds; } public static double GetCharactersPerSecond(Paragraph paragraph, double numberOfCharacters) { - var duration = paragraph.Duration; - if (duration.TotalMilliseconds < 1) + if (paragraph.DurationTotalMilliseconds < 1) { return 999; } - return numberOfCharacters / duration.TotalSeconds; + return numberOfCharacters / paragraph.DurationTotalSeconds; } public static double GetCharactersPerSecond(Paragraph paragraph, ICalcLength calc) { - var duration = paragraph.Duration; - if (duration.TotalMilliseconds < 1) + if (paragraph.DurationTotalMilliseconds < 1) { return 999; } - return (double)calc.CountCharacters(paragraph.Text, true) / duration.TotalSeconds; + return (double)calc.CountCharacters(paragraph.Text, true) / paragraph.DurationTotalSeconds; } public static bool IsRunningOnMono() @@ -1259,7 +1256,7 @@ namespace Nikse.SubtitleEdit.Core.Common return null; } - var middle = paragraph.StartTime.TotalMilliseconds + paragraph.Duration.TotalMilliseconds / 2.0; + var middle = paragraph.StartTime.TotalMilliseconds + paragraph.DurationTotalMilliseconds / 2.0; if (index < originalParagraphs.Count) { var o = originalParagraphs[index]; @@ -2661,7 +2658,7 @@ namespace Nikse.SubtitleEdit.Core.Common for (int i = 0; i < subtitle.Paragraphs.Count; i++) { subtitle.Paragraphs[i].Text = subtitle.Paragraphs[i].Text.TrimEnd(); - if (subtitle.Paragraphs[i].Duration.TotalMilliseconds < 1) + if (subtitle.Paragraphs[i].DurationTotalMilliseconds < 1) { // fix subtitles without duration FixShortDisplayTime(subtitle, i); @@ -2676,7 +2673,7 @@ namespace Nikse.SubtitleEdit.Core.Common { Paragraph p = s.Paragraphs[i]; var minDisplayTime = Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds; - double displayTime = p.Duration.TotalMilliseconds; + double displayTime = p.DurationTotalMilliseconds; if (displayTime < minDisplayTime) { var next = s.GetParagraphOrDefault(i + 1); diff --git a/src/libse/Forms/FixCommonErrors/FixLongDisplayTimes.cs b/src/libse/Forms/FixCommonErrors/FixLongDisplayTimes.cs index d10331d35..83843dd55 100644 --- a/src/libse/Forms/FixCommonErrors/FixLongDisplayTimes.cs +++ b/src/libse/Forms/FixCommonErrors/FixLongDisplayTimes.cs @@ -22,7 +22,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors maxDisplayTime = Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; } - double displayTime = p.Duration.TotalMilliseconds; + double displayTime = p.DurationTotalMilliseconds; bool allowFix = callbacks.AllowFix(p, Language.FixLongDisplayTime); if (allowFix && displayTime > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) diff --git a/src/libse/Forms/FixCommonErrors/FixOverlappingDisplayTimes.cs b/src/libse/Forms/FixCommonErrors/FixOverlappingDisplayTimes.cs index 9a8ec4e80..892617740 100644 --- a/src/libse/Forms/FixCommonErrors/FixOverlappingDisplayTimes.cs +++ b/src/libse/Forms/FixCommonErrors/FixOverlappingDisplayTimes.cs @@ -26,7 +26,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors { var p = subtitle.Paragraphs[i]; var oldP = new Paragraph(p); - if (p.Duration.TotalMilliseconds < 0) // negative display time... + if (p.DurationTotalMilliseconds < 0) // negative display time... { bool isFixed = false; string status = string.Format(Language.StartTimeLaterThanEndTime, i + 1, p.StartTime, p.EndTime, p.Text, Environment.NewLine); @@ -100,18 +100,18 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors { int diffHalf = (int)(diff / 2); if (!Configuration.Settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart && Math.Abs(p.StartTime.TotalMilliseconds - prev.EndTime.TotalMilliseconds) < 0.001 && - prev.Duration.TotalMilliseconds > 100) + prev.DurationTotalMilliseconds > 100) { if (callbacks.AllowFix(target, fixAction)) { if (!canBeEqual) { bool okEqual = true; - if (prev.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (prev.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { prev.EndTime.TotalMilliseconds--; } - else if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + else if (p.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { p.StartTime.TotalMilliseconds++; } @@ -142,8 +142,8 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors callbacks.AddFixToListView(target, fixAction, oldPrevious, prev.ToString()); } } - else if (diff > 0 && currentOptimalDisplayTime <= p.Duration.TotalMilliseconds - diffHalf && - prevOptimalDisplayTime <= prev.Duration.TotalMilliseconds - diffHalf) + else if (diff > 0 && currentOptimalDisplayTime <= p.DurationTotalMilliseconds - diffHalf && + prevOptimalDisplayTime <= prev.DurationTotalMilliseconds - diffHalf) { if (callbacks.AllowFix(p, fixAction)) { @@ -167,8 +167,8 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors callbacks.AddFixToListView(p, fixAction, oldCurrent, p.ToString()); } } - else if (diff > 0 && currentWantedDisplayTime <= p.Duration.TotalMilliseconds - diffHalf && - prevWantedDisplayTime <= prev.Duration.TotalMilliseconds - diffHalf) + else if (diff > 0 && currentWantedDisplayTime <= p.DurationTotalMilliseconds - diffHalf && + prevWantedDisplayTime <= prev.DurationTotalMilliseconds - diffHalf) { if (callbacks.AllowFix(p, fixAction)) { @@ -206,7 +206,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors callbacks.AddFixToListView(p, fixAction, oldCurrent, p.ToString()); } } - else if (Math.Abs(p.StartTime.TotalMilliseconds - prev.EndTime.TotalMilliseconds) < 10 && p.Duration.TotalMilliseconds > 1) + else if (Math.Abs(p.StartTime.TotalMilliseconds - prev.EndTime.TotalMilliseconds) < 10 && p.DurationTotalMilliseconds > 1) { if (callbacks.AllowFix(p, fixAction)) { diff --git a/src/libse/Forms/FixCommonErrors/FixShortDisplayTimes.cs b/src/libse/Forms/FixCommonErrors/FixShortDisplayTimes.cs index b59f2e506..2ed0564b6 100644 --- a/src/libse/Forms/FixCommonErrors/FixShortDisplayTimes.cs +++ b/src/libse/Forms/FixCommonErrors/FixShortDisplayTimes.cs @@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors { Paragraph p = subtitle.Paragraphs[i]; var skip = p.StartTime.IsMaxTime || p.EndTime.IsMaxTime; - double displayTime = p.Duration.TotalMilliseconds; + double displayTime = p.DurationTotalMilliseconds; if (!skip && displayTime < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { Paragraph next = subtitle.GetParagraphOrDefault(i + 1); @@ -78,7 +78,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors Paragraph next = subtitle.GetParagraphOrDefault(i + 1); Paragraph nextNext = subtitle.GetParagraphOrDefault(i + 2); Paragraph prev = subtitle.GetParagraphOrDefault(i - 1); - double diffMs = temp.Duration.TotalMilliseconds - p.Duration.TotalMilliseconds; + double diffMs = temp.DurationTotalMilliseconds - p.DurationTotalMilliseconds; // Normal - just make current subtitle duration longer if (next == null || temp.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines < next.StartTime.TotalMilliseconds) @@ -93,7 +93,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors } // Start current subtitle earlier (max 50 ms) else if (Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && - diffMs < 50 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines)) + diffMs < 50 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.DurationTotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines)) { noOfShortDisplayTimes = MoveStartTime(fixAction, noOfShortDisplayTimes, p, temp, next); } @@ -106,8 +106,8 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors if (callbacks.AllowFix(p, fixAction)) { string oldCurrent = p.ToString(); - p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds; - var nextDurationMs = next.Duration.TotalMilliseconds; + p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + temp.DurationTotalMilliseconds; + var nextDurationMs = next.DurationTotalMilliseconds; next.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines; next.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds + nextDurationMs; noOfShortDisplayTimes++; @@ -116,12 +116,12 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors } // Make next subtitle duration shorter + make current subtitle duration longer else if (diffMs < 1000 && - Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && Utilities.GetCharactersPerSecond(new Paragraph(next.Text, p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines, next.EndTime.TotalMilliseconds)) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds) + Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && Utilities.GetCharactersPerSecond(new Paragraph(next.Text, p.StartTime.TotalMilliseconds + temp.DurationTotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines, next.EndTime.TotalMilliseconds)) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds) { if (callbacks.AllowFix(p, fixAction)) { string oldCurrent = p.ToString(); - next.StartTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines; + next.StartTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + temp.DurationTotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines; p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; noOfShortDisplayTimes++; callbacks.AddFixToListView(p, fixAction, oldCurrent, p.ToString()); @@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors } // Start current subtitle earlier (max 200 ms) else if (Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && - diffMs < 200 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines)) + diffMs < 200 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.DurationTotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines)) { noOfShortDisplayTimes = MoveStartTime(fixAction, noOfShortDisplayTimes, p, temp, next); } @@ -182,7 +182,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; } - p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds; + p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - temp.DurationTotalMilliseconds; noOfShortDisplayTimes++; _callbacks.AddFixToListView(p, fixAction, oldCurrent, p.ToString()); } diff --git a/src/libse/Forms/SplitLongLinesHelper.cs b/src/libse/Forms/SplitLongLinesHelper.cs index d61c61a23..8d8416cb5 100644 --- a/src/libse/Forms/SplitLongLinesHelper.cs +++ b/src/libse/Forms/SplitLongLinesHelper.cs @@ -85,7 +85,7 @@ namespace Nikse.SubtitleEdit.Core.Forms } // calculate milliseconds per char - var millisecondsPerChar = oldParagraph.Duration.TotalMilliseconds / (HtmlUtil.RemoveHtmlTags(text, true).Length - Environment.NewLine.Length); + var millisecondsPerChar = oldParagraph.DurationTotalMilliseconds / (HtmlUtil.RemoveHtmlTags(text, true).Length - Environment.NewLine.Length); oldParagraph.Text = lines[firstLine]; diff --git a/src/libse/NetflixQualityCheck/NetflixCheckMaxDuration.cs b/src/libse/NetflixQualityCheck/NetflixCheckMaxDuration.cs index 91b64954d..d2528338a 100644 --- a/src/libse/NetflixQualityCheck/NetflixCheckMaxDuration.cs +++ b/src/libse/NetflixQualityCheck/NetflixCheckMaxDuration.cs @@ -11,7 +11,7 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck { foreach (Paragraph p in subtitle.Paragraphs) { - if (p.Duration.TotalMilliseconds > 7000) + if (p.DurationTotalMilliseconds > 7000) { var fixedParagraph = new Paragraph(p, false); fixedParagraph.EndTime.TotalMilliseconds = fixedParagraph.StartTime.TotalMilliseconds + 7000; diff --git a/src/libse/NetflixQualityCheck/NetflixCheckMinDuration.cs b/src/libse/NetflixQualityCheck/NetflixCheckMinDuration.cs index 764c59e3a..fe5fcd2b9 100644 --- a/src/libse/NetflixQualityCheck/NetflixCheckMinDuration.cs +++ b/src/libse/NetflixQualityCheck/NetflixCheckMinDuration.cs @@ -16,16 +16,16 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck if (controller.Language == "ja") { - if (p.Duration.TotalMilliseconds < 500) + if (p.DurationTotalMilliseconds < 500) { string comment = "Minimum duration: 0.5 second"; - controller.AddRecord(p, p.StartTime.ToHHMMSSFF(), comment, p.Duration.TotalSeconds.ToString(CultureInfo.InvariantCulture)); + controller.AddRecord(p, p.StartTime.ToHHMMSSFF(), comment, p.DurationTotalSeconds.ToString(CultureInfo.InvariantCulture)); } continue; } var next = subtitle.GetParagraphOrDefault(index + 1); - if (p.Duration.TotalMilliseconds < 833 && !p.StartTime.IsMaxTime) + if (p.DurationTotalMilliseconds < 833 && !p.StartTime.IsMaxTime) { Paragraph fixedParagraph = null; if (next == null || next.StartTime.TotalMilliseconds > p.StartTime.TotalMilliseconds + 834) diff --git a/src/libse/SubtitleFormats/AdobeAfterEffectsFTME.cs b/src/libse/SubtitleFormats/AdobeAfterEffectsFTME.cs index ba82c59a6..bddd9f2df 100644 --- a/src/libse/SubtitleFormats/AdobeAfterEffectsFTME.cs +++ b/src/libse/SubtitleFormats/AdobeAfterEffectsFTME.cs @@ -33,7 +33,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats foreach (Paragraph p in subtitle.Paragraphs) { XmlNode paragraph = xml.CreateElement("marker"); - paragraph.InnerXml = string.Format(CultureInfo.InvariantCulture, innerXml, p.StartTime.TotalSeconds, p.Duration.TotalSeconds); + paragraph.InnerXml = string.Format(CultureInfo.InvariantCulture, innerXml, p.StartTime.TotalSeconds, p.DurationTotalSeconds); paragraph.SelectSingleNode("comment").Attributes["value"].InnerText = HtmlUtil.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, "||"); root.AppendChild(paragraph); } diff --git a/src/libse/SubtitleFormats/CaptionsInc.cs b/src/libse/SubtitleFormats/CaptionsInc.cs index e1f88bba3..b7d4d49de 100644 --- a/src/libse/SubtitleFormats/CaptionsInc.cs +++ b/src/libse/SubtitleFormats/CaptionsInc.cs @@ -252,7 +252,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } } } - if (last != null && last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (last != null && last.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(last.Text); } diff --git a/src/libse/SubtitleFormats/CheetahCaption.cs b/src/libse/SubtitleFormats/CheetahCaption.cs index 8b60c7ef1..14116ac8b 100644 --- a/src/libse/SubtitleFormats/CheetahCaption.cs +++ b/src/libse/SubtitleFormats/CheetahCaption.cs @@ -266,7 +266,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats p.StartTime = DecodeTimestamp(buffer, i + 2); p.EndTime = DecodeTimestamp(buffer, i + 6); if (p.EndTime.Hours == 2 && p.EndTime.Minutes == 1 && p.EndTime.Seconds == 0 && p.EndTime.Milliseconds == 0 && - (p.Duration.TotalMilliseconds < 0 || p.Duration.TotalMilliseconds > 5000)) + (p.DurationTotalMilliseconds < 0 || p.DurationTotalMilliseconds > 5000)) { usedBytes = 20 - 4; } @@ -345,7 +345,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats i += length; } - if (last != null && (last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds || last.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)) + if (last != null && (last.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds || last.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)) { last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(last.Text); } @@ -355,7 +355,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats var current = subtitle.Paragraphs[index]; var next = subtitle.Paragraphs[index + 1]; if (current.EndTime.Hours == 2 && current.EndTime.Minutes == 1 && current.EndTime.Seconds == 0 && current.EndTime.Milliseconds == 0 && - (current.Duration.TotalMilliseconds < 0 || current.Duration.TotalMilliseconds > 5000)) + (current.DurationTotalMilliseconds < 0 || current.DurationTotalMilliseconds > 5000)) { current.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; } diff --git a/src/libse/SubtitleFormats/CheetahCaptionOld.cs b/src/libse/SubtitleFormats/CheetahCaptionOld.cs index 98a07de63..92c090b4a 100644 --- a/src/libse/SubtitleFormats/CheetahCaptionOld.cs +++ b/src/libse/SubtitleFormats/CheetahCaptionOld.cs @@ -76,17 +76,17 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { var paragraph = subtitle.Paragraphs[index]; var next = subtitle.GetParagraphOrDefault(index + 1); - if (paragraph.Duration.TotalSeconds > 100) + if (paragraph.DurationTotalSeconds > 100) { _errorCount++; } - if (Math.Abs(paragraph.EndTime.TotalMilliseconds) < 0.1 || paragraph.Duration.TotalMilliseconds < 0.1) + if (Math.Abs(paragraph.EndTime.TotalMilliseconds) < 0.1 || paragraph.DurationTotalMilliseconds < 0.1) { if (next != null) { paragraph.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; } - if (next == null || paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (next == null || paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/ElrPrint.cs b/src/libse/SubtitleFormats/ElrPrint.cs index e426b3037..454b85a97 100644 --- a/src/libse/SubtitleFormats/ElrPrint.cs +++ b/src/libse/SubtitleFormats/ElrPrint.cs @@ -44,7 +44,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return sb.ToString().Trim(); } - private object GetDuration(Paragraph p) + private static object GetDuration(Paragraph p) { string s; var ts = p.Duration.TimeSpan; @@ -57,7 +57,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { s = $"{ts.Seconds:00}:{MillisecondsToFramesMaxFrameRate(ts.Milliseconds):00}"; } - if (p.Duration.TotalMilliseconds >= 0) + if (p.DurationTotalMilliseconds >= 0) { return s; } diff --git a/src/libse/SubtitleFormats/FLVCoreCuePoints.cs b/src/libse/SubtitleFormats/FLVCoreCuePoints.cs index 7da844d97..3e8fb9673 100644 --- a/src/libse/SubtitleFormats/FLVCoreCuePoints.cs +++ b/src/libse/SubtitleFormats/FLVCoreCuePoints.cs @@ -52,7 +52,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats name = xml.CreateElement("Name"); name.InnerText = "duration"; value = xml.CreateElement("Value"); - value.InnerText = p.Duration.TotalMilliseconds.ToString(); + value.InnerText = p.DurationTotalMilliseconds.ToString(); parameter.AppendChild(name); parameter.AppendChild(value); parameters.AppendChild(parameter); diff --git a/src/libse/SubtitleFormats/FinalCutProXCM.cs b/src/libse/SubtitleFormats/FinalCutProXCM.cs index a0856efe5..5c5220be1 100644 --- a/src/libse/SubtitleFormats/FinalCutProXCM.cs +++ b/src/libse/SubtitleFormats/FinalCutProXCM.cs @@ -58,7 +58,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats XmlNode chapterMarker = xml.CreateElement("chapter-marker"); var attr = xml.CreateAttribute("duration"); - attr.Value = Convert.ToInt64(p.Duration.TotalSeconds * 2400000) + "/2400000s"; + attr.Value = Convert.ToInt64(p.DurationTotalSeconds * 2400000) + "/2400000s"; chapterMarker.Attributes.Append(attr); attr = xml.CreateAttribute("start"); diff --git a/src/libse/SubtitleFormats/FinalCutProXXml.cs b/src/libse/SubtitleFormats/FinalCutProXXml.cs index 422238cfd..fe1cc889f 100644 --- a/src/libse/SubtitleFormats/FinalCutProXXml.cs +++ b/src/libse/SubtitleFormats/FinalCutProXXml.cs @@ -68,7 +68,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats attr = xml.CreateAttribute("duration"); //attr.Value = "9529520/2400000s"; - attr.Value = Convert.ToInt64(p.Duration.TotalSeconds * 2400000) + "/2400000s"; + attr.Value = Convert.ToInt64(p.DurationTotalSeconds * 2400000) + "/2400000s"; clip.Attributes.Append(attr); attr = xml.CreateAttribute("start"); @@ -81,7 +81,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats clip.Attributes.Append(attr); attr = xml.CreateAttribute("audioDuration"); - attr.Value = Convert.ToInt64(p.Duration.TotalSeconds * 2400000) + "/2400000s"; + attr.Value = Convert.ToInt64(p.DurationTotalSeconds * 2400000) + "/2400000s"; clip.Attributes.Append(attr); attr = xml.CreateAttribute("tcFormat"); @@ -91,7 +91,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats XmlNode titleNode = clip.SelectSingleNode("title"); titleNode.Attributes["offset"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s"; titleNode.Attributes["name"].Value = HtmlUtil.RemoveHtmlTags(p.Text); - titleNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds * 60000) + "/60000s"; + titleNode.Attributes["duration"].Value = Convert.ToInt64(p.DurationTotalSeconds * 60000) + "/60000s"; titleNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s"; XmlNode text = clip.SelectSingleNode("title/text"); diff --git a/src/libse/SubtitleFormats/FinalCutProXml13.cs b/src/libse/SubtitleFormats/FinalCutProXml13.cs index f5cfa200d..9c1a48691 100644 --- a/src/libse/SubtitleFormats/FinalCutProXml13.cs +++ b/src/libse/SubtitleFormats/FinalCutProXml13.cs @@ -66,7 +66,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats clip.Attributes.Append(attr); attr = xml.CreateAttribute("duration"); - attr.Value = Convert.ToInt64(p.Duration.TotalSeconds * 2400000) + "/2400000s"; + attr.Value = Convert.ToInt64(p.DurationTotalSeconds * 2400000) + "/2400000s"; clip.Attributes.Append(attr); attr = xml.CreateAttribute("start"); @@ -78,7 +78,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats clip.Attributes.Append(attr); attr = xml.CreateAttribute("audioDuration"); - attr.Value = Convert.ToInt64(p.Duration.TotalSeconds * 2400000) + "/2400000s"; + attr.Value = Convert.ToInt64(p.DurationTotalSeconds * 2400000) + "/2400000s"; clip.Attributes.Append(attr); attr = xml.CreateAttribute("tcFormat"); @@ -88,7 +88,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats XmlNode titleNode = clip.SelectSingleNode("video"); titleNode.Attributes["offset"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s"; titleNode.Attributes["name"].Value = HtmlUtil.RemoveHtmlTags(p.Text); - titleNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds * 60000) + "/60000s"; + titleNode.Attributes["duration"].Value = Convert.ToInt64(p.DurationTotalSeconds * 60000) + "/60000s"; titleNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s"; XmlNode param = clip.SelectSingleNode("video/param"); diff --git a/src/libse/SubtitleFormats/FinalCutProXml14.cs b/src/libse/SubtitleFormats/FinalCutProXml14.cs index fc7d8f673..85703700a 100644 --- a/src/libse/SubtitleFormats/FinalCutProXml14.cs +++ b/src/libse/SubtitleFormats/FinalCutProXml14.cs @@ -76,7 +76,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats XmlNode generatorNode = video.SelectSingleNode("video"); generatorNode.Attributes["offset"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 2400000) + "/2400000s"; - generatorNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds * 2400000) + "/2400000s"; + generatorNode.Attributes["duration"].Value = Convert.ToInt64(p.DurationTotalSeconds * 2400000) + "/2400000s"; generatorNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 2400000) + "/2400000s"; XmlNode param = video.SelectSingleNode("video/param"); diff --git a/src/libse/SubtitleFormats/FinalCutProXml14Text.cs b/src/libse/SubtitleFormats/FinalCutProXml14Text.cs index 2367d956b..4926536d0 100644 --- a/src/libse/SubtitleFormats/FinalCutProXml14Text.cs +++ b/src/libse/SubtitleFormats/FinalCutProXml14Text.cs @@ -88,9 +88,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats generatorNode.Attributes["offset"].Value = FinalCutProXml15.GetFrameTime(p.StartTime); } - if (IsNearleWholeNumber(p.Duration.TotalSeconds)) + if (IsNearleWholeNumber(p.DurationTotalSeconds)) { - generatorNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds) + "s"; + generatorNode.Attributes["duration"].Value = Convert.ToInt64(p.DurationTotalSeconds) + "s"; } else { diff --git a/src/libse/SubtitleFormats/FinalCutProXmlGap.cs b/src/libse/SubtitleFormats/FinalCutProXmlGap.cs index f3a9b3cbf..a1a47ba4b 100644 --- a/src/libse/SubtitleFormats/FinalCutProXmlGap.cs +++ b/src/libse/SubtitleFormats/FinalCutProXmlGap.cs @@ -66,7 +66,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats titleNode = titleNode.SelectSingleNode("title"); titleNode.Attributes["offset"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s"; titleNode.Attributes["name"].Value = HtmlUtil.RemoveHtmlTags(p.Text); - titleNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds * 60000) + "/60000s"; + titleNode.Attributes["duration"].Value = Convert.ToInt64(p.DurationTotalSeconds * 60000) + "/60000s"; titleNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s"; titleNode.SelectSingleNode("text").InnerText = HtmlUtil.RemoveHtmlTags(p.Text); videoNode.AppendChild(titleNode); diff --git a/src/libse/SubtitleFormats/GooglePlayJson.cs b/src/libse/SubtitleFormats/GooglePlayJson.cs index e6d26eeb4..2b3368211 100644 --- a/src/libse/SubtitleFormats/GooglePlayJson.cs +++ b/src/libse/SubtitleFormats/GooglePlayJson.cs @@ -21,7 +21,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { sb.AppendLine(count > 0 ? ", {" : " {"); sb.AppendLine(" \"tStartMs\": " + p.StartTime.TotalMilliseconds.ToString(CultureInfo.InvariantCulture) + ","); - sb.AppendLine(" \"dDurationMs\": " + p.Duration.TotalMilliseconds.ToString(CultureInfo.InvariantCulture) + ","); + sb.AppendLine(" \"dDurationMs\": " + p.DurationTotalMilliseconds.ToString(CultureInfo.InvariantCulture) + ","); sb.AppendLine(" \"segs\": [ {"); sb.AppendLine(" \"utf8\": \"" + Json.EncodeJsonText(p.Text).Replace("
", "\\n") + "\""); sb.AppendLine(" } ]"); diff --git a/src/libse/SubtitleFormats/InqScribe.cs b/src/libse/SubtitleFormats/InqScribe.cs index e641f9292..4199edac0 100644 --- a/src/libse/SubtitleFormats/InqScribe.cs +++ b/src/libse/SubtitleFormats/InqScribe.cs @@ -150,7 +150,7 @@ version=1.1 } var last = subtitle.Paragraphs.Last(); - last.Duration.TotalMilliseconds = Utilities.GetOptimalDisplayMilliseconds(last.Text); + last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(last.Text); subtitle.RemoveEmptyLines(); subtitle.Renumber(); } diff --git a/src/libse/SubtitleFormats/JsonTed.cs b/src/libse/SubtitleFormats/JsonTed.cs index 54b48e9a9..38a5bebd4 100644 --- a/src/libse/SubtitleFormats/JsonTed.cs +++ b/src/libse/SubtitleFormats/JsonTed.cs @@ -38,7 +38,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } sb.Append("{\"duration\":"); - sb.Append(p.Duration.TotalMilliseconds.ToString(System.Globalization.CultureInfo.InvariantCulture)); + sb.Append(p.DurationTotalMilliseconds.ToString(System.Globalization.CultureInfo.InvariantCulture)); sb.Append(",\"content\":\""); sb.Append(Json.EncodeJsonText(p.Text) + "\""); sb.Append(",\"startOfParagraph\":true"); diff --git a/src/libse/SubtitleFormats/JsonType13.cs b/src/libse/SubtitleFormats/JsonType13.cs index 61a2b1168..de6d13d22 100644 --- a/src/libse/SubtitleFormats/JsonType13.cs +++ b/src/libse/SubtitleFormats/JsonType13.cs @@ -21,7 +21,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats var last = subtitle.Paragraphs.LastOrDefault(); if (last != null) { - duration = (last.StartTime.TotalSeconds + last.Duration.TotalSeconds).ToString(CultureInfo.InvariantCulture); + duration = (last.StartTime.TotalSeconds + last.DurationTotalSeconds).ToString(CultureInfo.InvariantCulture); } var createdAt = ""; @@ -47,7 +47,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } sb.AppendLine(" {"); - sb.AppendLine(" \"duration\": \"" + p.Duration.TotalSeconds.ToString(CultureInfo.InvariantCulture) + "\","); + sb.AppendLine(" \"duration\": \"" + p.DurationTotalSeconds.ToString(CultureInfo.InvariantCulture) + "\","); sb.AppendLine(" \"confidence\": null,"); sb.AppendLine(" \"name\": \"" + Json.EncodeJsonText(p.Text) + "\","); sb.AppendLine(" \"time\": \"" + p.StartTime.TotalSeconds.ToString(CultureInfo.InvariantCulture) + "\""); diff --git a/src/libse/SubtitleFormats/JsonType18.cs b/src/libse/SubtitleFormats/JsonType18.cs index 32d66ae2d..977cfc16c 100644 --- a/src/libse/SubtitleFormats/JsonType18.cs +++ b/src/libse/SubtitleFormats/JsonType18.cs @@ -26,7 +26,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats sb.AppendLine(); sb.AppendLine(" {"); sb.AppendLine($" \"s\": {p.StartTime.TotalSeconds.ToString(CultureInfo.InvariantCulture)},"); - sb.AppendLine($" \"d\": {p.Duration.TotalSeconds.ToString(CultureInfo.InvariantCulture)},"); + sb.AppendLine($" \"d\": {p.DurationTotalSeconds.ToString(CultureInfo.InvariantCulture)},"); sb.AppendLine($" \"n\": \"{Json.EncodeJsonText(p.Text, "\\n")}\""); sb.Append(" }"); } diff --git a/src/libse/SubtitleFormats/JsonType19.cs b/src/libse/SubtitleFormats/JsonType19.cs index bbb7ec860..a7b06887e 100644 --- a/src/libse/SubtitleFormats/JsonType19.cs +++ b/src/libse/SubtitleFormats/JsonType19.cs @@ -29,7 +29,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats sb.AppendLine(); sb.AppendLine(" {"); sb.AppendLine($" \"tStartMs\": {p.StartTime.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)},"); - sb.AppendLine($" \"dDurationMs\": {p.Duration.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)},"); + sb.AppendLine($" \"dDurationMs\": {p.DurationTotalMilliseconds.ToString(CultureInfo.InvariantCulture)},"); sb.AppendLine($" \"segs\": [{{ \"utf8\": \"{Json.EncodeJsonText(p.Text, "\\n")}\" }} ]"); sb.Append(" }"); } diff --git a/src/libse/SubtitleFormats/JsonType3.cs b/src/libse/SubtitleFormats/JsonType3.cs index 00b956f1a..de2aa8def 100644 --- a/src/libse/SubtitleFormats/JsonType3.cs +++ b/src/libse/SubtitleFormats/JsonType3.cs @@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } sb.Append("{\"duration\":"); - sb.Append(p.Duration.TotalMilliseconds.ToString(System.Globalization.CultureInfo.InvariantCulture)); + sb.Append(p.DurationTotalMilliseconds.ToString(System.Globalization.CultureInfo.InvariantCulture)); sb.Append(",\"content\":\""); sb.Append(Json.EncodeJsonText(p.Text) + "\""); sb.Append(",\"startOfParagraph\":false"); diff --git a/src/libse/SubtitleFormats/JsonType8.cs b/src/libse/SubtitleFormats/JsonType8.cs index 7ce998300..74d74e678 100644 --- a/src/libse/SubtitleFormats/JsonType8.cs +++ b/src/libse/SubtitleFormats/JsonType8.cs @@ -20,7 +20,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { return false; } - var avgDurSecs = subtitle.Paragraphs.Average(p => p.Duration.TotalSeconds); + var avgDurSecs = subtitle.Paragraphs.Average(p => p.DurationTotalSeconds); return avgDurSecs < 60; } diff --git a/src/libse/SubtitleFormats/JsonType8b.cs b/src/libse/SubtitleFormats/JsonType8b.cs index f76489fa8..a6856d452 100644 --- a/src/libse/SubtitleFormats/JsonType8b.cs +++ b/src/libse/SubtitleFormats/JsonType8b.cs @@ -20,7 +20,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { return false; } - var avgDurSecs = subtitle.Paragraphs.Average(p => p.Duration.TotalSeconds); + var avgDurSecs = subtitle.Paragraphs.Average(p => p.DurationTotalSeconds); return avgDurSecs < 60 && avgDurSecs > 0.1; } diff --git a/src/libse/SubtitleFormats/Lrc.cs b/src/libse/SubtitleFormats/Lrc.cs index acca04552..e8029fd8a 100644 --- a/src/libse/SubtitleFormats/Lrc.cs +++ b/src/libse/SubtitleFormats/Lrc.cs @@ -290,7 +290,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; } - if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { double duration = Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; p.EndTime = new TimeCode(p.StartTime.TotalMilliseconds + duration); diff --git a/src/libse/SubtitleFormats/LrcNoEndTime.cs b/src/libse/SubtitleFormats/LrcNoEndTime.cs index 27ced8978..bc8019438 100644 --- a/src/libse/SubtitleFormats/LrcNoEndTime.cs +++ b/src/libse/SubtitleFormats/LrcNoEndTime.cs @@ -269,7 +269,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats if (next != null && !p.StartTime.IsMaxTime && !next.StartTime.IsMaxTime) { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; - if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text + "!"); } diff --git a/src/libse/SubtitleFormats/NVivoTranscript.cs b/src/libse/SubtitleFormats/NVivoTranscript.cs index f27850c3c..2bb0e0a19 100644 --- a/src/libse/SubtitleFormats/NVivoTranscript.cs +++ b/src/libse/SubtitleFormats/NVivoTranscript.cs @@ -98,7 +98,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Configuration.Settings.General.NewEmptyDefaultMs; } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/NciCaption.cs b/src/libse/SubtitleFormats/NciCaption.cs index 8e057ea35..cde4c17f5 100644 --- a/src/libse/SubtitleFormats/NciCaption.cs +++ b/src/libse/SubtitleFormats/NciCaption.cs @@ -233,7 +233,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { Paragraph p = subtitle.GetParagraphOrDefault(i); Paragraph next = subtitle.GetParagraphOrDefault(i + 1); - if (p.Duration.TotalMilliseconds <= 0 && next != null) + if (p.DurationTotalMilliseconds <= 0 && next != null) { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - 1; } diff --git a/src/libse/SubtitleFormats/NkhCuePoints.cs b/src/libse/SubtitleFormats/NkhCuePoints.cs index 278c4fe9c..463de2007 100644 --- a/src/libse/SubtitleFormats/NkhCuePoints.cs +++ b/src/libse/SubtitleFormats/NkhCuePoints.cs @@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats name = xml.CreateElement("Name"); name.InnerText = "duration"; value = xml.CreateElement("Value"); - value.InnerText = p.Duration.TotalMilliseconds.ToString(); + value.InnerText = p.DurationTotalMilliseconds.ToString(); parameter.AppendChild(name); parameter.AppendChild(value); parameters.AppendChild(parameter); diff --git a/src/libse/SubtitleFormats/Rtf2.cs b/src/libse/SubtitleFormats/Rtf2.cs index 39089c24b..a9c15ca07 100644 --- a/src/libse/SubtitleFormats/Rtf2.cs +++ b/src/libse/SubtitleFormats/Rtf2.cs @@ -100,7 +100,7 @@ TimeCode Format: " + Configuration.Settings.General.CurrentFrameRate + @" frames subtitle.Paragraphs.Add(p); } - if (subtitle.Paragraphs.Count > 0 && subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].Duration.TotalMilliseconds < 0.01) + if (subtitle.Paragraphs.Count > 0 && subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].DurationTotalMilliseconds < 0.01) { p = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1]; p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text); diff --git a/src/libse/SubtitleFormats/SmilTimesheetData.cs b/src/libse/SubtitleFormats/SmilTimesheetData.cs index c02f1f97f..0807fb073 100644 --- a/src/libse/SubtitleFormats/SmilTimesheetData.cs +++ b/src/libse/SubtitleFormats/SmilTimesheetData.cs @@ -217,7 +217,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/SubtitleEditorProject.cs b/src/libse/SubtitleFormats/SubtitleEditorProject.cs index fd231b5d4..f0376ff75 100644 --- a/src/libse/SubtitleFormats/SubtitleEditorProject.cs +++ b/src/libse/SubtitleFormats/SubtitleEditorProject.cs @@ -62,7 +62,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats XmlNode paragraph = xml.CreateElement("subtitle"); XmlAttribute duration = xml.CreateAttribute("duration"); - duration.InnerText = ((int)Math.Round(p.Duration.TotalMilliseconds)).ToString(CultureInfo.InvariantCulture); + duration.InnerText = ((int)Math.Round(p.DurationTotalMilliseconds)).ToString(CultureInfo.InvariantCulture); paragraph.Attributes.Append(duration); XmlAttribute effect = xml.CreateAttribute("effect"); diff --git a/src/libse/SubtitleFormats/Ted20.cs b/src/libse/SubtitleFormats/Ted20.cs index c04bb78a2..c3978ec49 100644 --- a/src/libse/SubtitleFormats/Ted20.cs +++ b/src/libse/SubtitleFormats/Ted20.cs @@ -102,17 +102,17 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } var next = subtitle.GetParagraphOrDefault(index + 1); - if (paragraph.Duration.TotalSeconds > 100) + if (paragraph.DurationTotalSeconds > 100) { _errorCount++; } - if (Math.Abs(paragraph.EndTime.TotalMilliseconds) < 0.1 || paragraph.Duration.TotalMilliseconds < 0.1) + if (Math.Abs(paragraph.EndTime.TotalMilliseconds) < 0.1 || paragraph.DurationTotalMilliseconds < 0.1) { if (next != null) { paragraph.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; } - if (next == null || paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (next == null || paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/Titra.cs b/src/libse/SubtitleFormats/Titra.cs index ddfe8b0ef..3b057985d 100644 --- a/src/libse/SubtitleFormats/Titra.cs +++ b/src/libse/SubtitleFormats/Titra.cs @@ -43,7 +43,7 @@ ATTENTION : Pas plus de 40 caractères PAR LIGNE { index++; var text = HtmlUtil.RemoveHtmlTags(p.Text, true); - sb.AppendLine(string.Format(writeFormat, index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), GetMaxCharsForDuration(p.Duration.TotalSeconds) + "c", Environment.NewLine, text)); + sb.AppendLine(string.Format(writeFormat, index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), GetMaxCharsForDuration(p.DurationTotalSeconds) + "c", Environment.NewLine, text)); sb.AppendLine(); if (!text.Contains(Environment.NewLine)) { diff --git a/src/libse/SubtitleFormats/Ultech130.cs b/src/libse/SubtitleFormats/Ultech130.cs index 04cfeb2a9..ec3606cb9 100644 --- a/src/libse/SubtitleFormats/Ultech130.cs +++ b/src/libse/SubtitleFormats/Ultech130.cs @@ -283,7 +283,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + 2500; } - if (last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (last.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(last.Text); } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle100.cs b/src/libse/SubtitleFormats/UnknownSubtitle100.cs index 7bae14314..7b08660f1 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle100.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle100.cs @@ -26,7 +26,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats private static string GetTimeCodeString(Paragraph paragraph) { - return $"#{paragraph.StartTime.TotalMilliseconds:00000000}{paragraph.Duration.TotalMilliseconds:000000}"; + return $"#{paragraph.StartTime.TotalMilliseconds:00000000}{paragraph.DurationTotalMilliseconds:000000}"; } public override void LoadSubtitle(Subtitle subtitle, List lines, string fileName) diff --git a/src/libse/SubtitleFormats/UnknownSubtitle104.cs b/src/libse/SubtitleFormats/UnknownSubtitle104.cs index bd4d01fbe..dd432bc02 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle104.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle104.cs @@ -76,7 +76,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats else { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; - if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle105.cs b/src/libse/SubtitleFormats/UnknownSubtitle105.cs index ba96f5535..ce720a5ba 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle105.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle105.cs @@ -18,10 +18,10 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats for (var index = 0; index < subtitle.Paragraphs.Count; index++) { var p = subtitle.Paragraphs[index]; - sb.AppendLine($"{EncodeTime(p.Duration.TotalSeconds)}"); + sb.AppendLine($"{EncodeTime(p.DurationTotalSeconds)}"); sb.AppendLine(p.Text); - seconds += p.Duration.TotalSeconds; + seconds += p.DurationTotalSeconds; var next = subtitle.GetParagraphOrDefault(index + 1); if (next != null && (next.StartTime.TotalMilliseconds - p.EndTime.TotalMilliseconds) > 100) { diff --git a/src/libse/SubtitleFormats/UnknownSubtitle106.cs b/src/libse/SubtitleFormats/UnknownSubtitle106.cs index b1f5dba09..db8c5ef7c 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle106.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle106.cs @@ -82,7 +82,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Configuration.Settings.General.NewEmptyDefaultMs; } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle25.cs b/src/libse/SubtitleFormats/UnknownSubtitle25.cs index 7cc007749..4c3e339f0 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle25.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle25.cs @@ -32,7 +32,7 @@ NOTE= Paragraph last = null; foreach (var p in subtitle.Paragraphs) { - sb.AppendLine($"{MakeTimeCode(p.StartTime, last)} {MakeTimeCode(p.Duration.TotalSeconds)}\r\n{p.Text}\r\n"); + sb.AppendLine($"{MakeTimeCode(p.StartTime, last)} {MakeTimeCode(p.DurationTotalSeconds)}\r\n{p.Text}\r\n"); last = p; } return sb.ToString().Trim().Replace(Environment.NewLine, "\n"); diff --git a/src/libse/SubtitleFormats/UnknownSubtitle27.cs b/src/libse/SubtitleFormats/UnknownSubtitle27.cs index a173f4f41..e1923e976 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle27.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle27.cs @@ -93,7 +93,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats current.EndTime.TotalMilliseconds = current.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(current.Text); } - if (current.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (current.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { current.EndTime.TotalMilliseconds = current.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle44.cs b/src/libse/SubtitleFormats/UnknownSubtitle44.cs index 1b6a7a552..ee422cbea 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle44.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle44.cs @@ -124,7 +124,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats current.EndTime.TotalMilliseconds = current.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(current.Text); } - if (current.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (current.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { current.EndTime.TotalMilliseconds = current.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle46.cs b/src/libse/SubtitleFormats/UnknownSubtitle46.cs index dbdb4ca8c..c909e46a0 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle46.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle46.cs @@ -79,7 +79,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { paragraph.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - 1; } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text); } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle47.cs b/src/libse/SubtitleFormats/UnknownSubtitle47.cs index a09544b69..5327fc766 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle47.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle47.cs @@ -81,7 +81,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle5.cs b/src/libse/SubtitleFormats/UnknownSubtitle5.cs index dc7ab39de..3cca5eca5 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle5.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle5.cs @@ -30,7 +30,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats paragraph.Attributes.Append(start); XmlAttribute duration = xml.CreateAttribute("dur"); - duration.InnerText = $"{p.Duration.TotalMilliseconds / 1000}".Replace(',', '.'); + duration.InnerText = $"{p.DurationTotalMilliseconds / 1000}".Replace(',', '.'); paragraph.Attributes.Append(duration); paragraph.InnerText = p.Text; diff --git a/src/libse/SubtitleFormats/UnknownSubtitle59.cs b/src/libse/SubtitleFormats/UnknownSubtitle59.cs index d5b7aa7be..e8a16a7a3 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle59.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle59.cs @@ -176,7 +176,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats foreach (var p2 in subtitle.Paragraphs) { - if (p2.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p2.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { p2.EndTime.TotalMilliseconds = p2.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle82.cs b/src/libse/SubtitleFormats/UnknownSubtitle82.cs index 1a127a655..4a7d0456c 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle82.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle82.cs @@ -32,7 +32,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats paragraph.Attributes.Append(tAttribute); XmlAttribute dAttribute = xml.CreateAttribute("d"); - dAttribute.InnerText = Convert.ToInt64(p.Duration.TotalMilliseconds).ToString(); + dAttribute.InnerText = Convert.ToInt64(p.DurationTotalMilliseconds).ToString(); paragraph.Attributes.Append(dAttribute); paragraphInsertNode.AppendChild(paragraph); diff --git a/src/libse/SubtitleFormats/UnknownSubtitle83.cs b/src/libse/SubtitleFormats/UnknownSubtitle83.cs index cf46a19b7..333f7d7ec 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle83.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle83.cs @@ -32,7 +32,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats for (int index = 0; index < subtitle.Paragraphs.Count;) { var p = subtitle.Paragraphs[index++]; - var lis = (int)Math.Round(MillisecondsToFrames(p.Duration.TotalMilliseconds) / 2.0); + var lis = (int)Math.Round(MillisecondsToFrames(p.DurationTotalMilliseconds) / 2.0); sb.AppendLine(string.Format(format, index, p.StartTime.ToHHMMSSFF(), p.EndTime.ToHHMMSSFF(), p.Duration.ToSSFF(), lis, p.Text.Length, p.Text)); } return sb.ToString().ToRtf(); diff --git a/src/libse/SubtitleFormats/UnknownSubtitle85.cs b/src/libse/SubtitleFormats/UnknownSubtitle85.cs index 8cbc6d539..2a329f32f 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle85.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle85.cs @@ -125,7 +125,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats if (next.StartTime.TotalMilliseconds < p.EndTime.TotalMilliseconds) { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; - if (p.Duration.TotalMilliseconds < 0) + if (p.DurationTotalMilliseconds < 0) { _errorCount++; } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle86.cs b/src/libse/SubtitleFormats/UnknownSubtitle86.cs index a419ac667..87e41dd66 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle86.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle86.cs @@ -74,7 +74,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; } - if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle9.cs b/src/libse/SubtitleFormats/UnknownSubtitle9.cs index 5453ab7f9..29440bbb2 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle9.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle9.cs @@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats sb.AppendLine("
"); foreach (Paragraph p in subtitle.Paragraphs) { - sb.AppendLine($" {p.Text.Replace(Environment.NewLine, "
")}
"); + sb.AppendLine($" {p.Text.Replace(Environment.NewLine, "
")}
"); } sb.AppendLine("
"); sb.AppendLine(" "); diff --git a/src/libse/SubtitleFormats/UnknownSubtitle98.cs b/src/libse/SubtitleFormats/UnknownSubtitle98.cs index 3b13ab007..128dfdde4 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle98.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle98.cs @@ -85,7 +85,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { paragraph.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - 1; } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/UnknownSubtitle99.cs b/src/libse/SubtitleFormats/UnknownSubtitle99.cs index 1277ebcec..f213415af 100644 --- a/src/libse/SubtitleFormats/UnknownSubtitle99.cs +++ b/src/libse/SubtitleFormats/UnknownSubtitle99.cs @@ -104,7 +104,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { paragraph.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - 1; } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(paragraph.Text); } diff --git a/src/libse/SubtitleFormats/Xmp.cs b/src/libse/SubtitleFormats/Xmp.cs index 4114fe5be..09e4833c9 100644 --- a/src/libse/SubtitleFormats/Xmp.cs +++ b/src/libse/SubtitleFormats/Xmp.cs @@ -68,7 +68,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats li.AppendChild(comment); var duration = xml.CreateElement("xmpDM", "duration", NamespaceDescription); - duration.InnerText = MillisecondsToFrames(paragraph.Duration.TotalMilliseconds).ToString(CultureInfo.InvariantCulture); + duration.InnerText = MillisecondsToFrames(paragraph.DurationTotalMilliseconds).ToString(CultureInfo.InvariantCulture); li.AppendChild(duration); var startTime = xml.CreateElement("xmpDM", "startTime", NamespaceDescription); diff --git a/src/libse/VobSub/VobSubWriter.cs b/src/libse/VobSub/VobSubWriter.cs index 976fd905b..7b22d93ec 100644 --- a/src/libse/VobSub/VobSubWriter.cs +++ b/src/libse/VobSub/VobSubWriter.cs @@ -124,7 +124,7 @@ namespace Nikse.SubtitleEdit.Core.VobSub // Control Sequence Table // Write delay - subtitle duration - WriteEndianWord(Convert.ToInt32(p.Duration.TotalMilliseconds * 90.0) >> 10, ms); + WriteEndianWord(Convert.ToInt32(p.DurationTotalMilliseconds * 90.0) >> 10, ms); // next display control sequence table address (use current is last) WriteEndianWord(startDisplayControlSequenceTableAddress + 24, ms); // start of display control sequence table address diff --git a/src/ui/Controls/AudioVisualizer.cs b/src/ui/Controls/AudioVisualizer.cs index 52fd4bee9..1780e477a 100644 --- a/src/ui/Controls/AudioVisualizer.cs +++ b/src/ui/Controls/AudioVisualizer.cs @@ -451,7 +451,7 @@ namespace Nikse.SubtitleEdit.Controls foreach (var p in displayableParagraphs) { if (displayableParagraphs.Count > 30 && - (p.Duration.TotalMilliseconds < 0.01 || p.StartTime.TotalMilliseconds - lastStartTime < 90)) + (p.DurationTotalMilliseconds < 0.01 || p.StartTime.TotalMilliseconds - lastStartTime < 90)) { continue; } @@ -1827,7 +1827,7 @@ namespace Nikse.SubtitleEdit.Controls } else if (_mouseDownParagraphType == MouseDownParagraphType.Whole) { - var durationMilliseconds = _mouseDownParagraph.Duration.TotalMilliseconds; + var durationMilliseconds = _mouseDownParagraph.DurationTotalMilliseconds; var oldStart = _mouseDownParagraph.StartTime.TotalMilliseconds; _mouseDownParagraph.StartTime.TotalMilliseconds = milliseconds - _moveWholeStartDifferenceMilliseconds; _mouseDownParagraph.EndTime.TotalMilliseconds = _mouseDownParagraph.StartTime.TotalMilliseconds + durationMilliseconds; @@ -2129,7 +2129,7 @@ namespace Nikse.SubtitleEdit.Controls { _oldParagraph = new Paragraph(SelectedParagraph); _mouseDownParagraph = SelectedParagraph; - var durationMilliseconds = _mouseDownParagraph.Duration.TotalMilliseconds; + var durationMilliseconds = _mouseDownParagraph.DurationTotalMilliseconds; _mouseDownParagraph.StartTime.TotalMilliseconds = milliseconds; _mouseDownParagraph.EndTime.TotalMilliseconds = _mouseDownParagraph.StartTime.TotalMilliseconds + durationMilliseconds; OnTimeChanged?.Invoke(this, new ParagraphEventArgs(seconds, _mouseDownParagraph, _oldParagraph)); diff --git a/src/ui/Controls/SubtitleListView.cs b/src/ui/Controls/SubtitleListView.cs index 318d8a85a..3052c5514 100644 --- a/src/ui/Controls/SubtitleListView.cs +++ b/src/ui/Controls/SubtitleListView.cs @@ -1472,13 +1472,13 @@ namespace Nikse.SubtitleEdit.Controls item.SubItems[ColumnIndexDuration].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; } } - if (paragraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && ColumnIndexDuration >= 0) + if (paragraph.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && ColumnIndexDuration >= 0) { item.SubItems[ColumnIndexDuration].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; } } if (_settings.Tools.ListViewSyntaxColorDurationBig && - paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds && + paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds && ColumnIndexDuration >= 0) { item.SubItems[ColumnIndexDuration].BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; diff --git a/src/ui/Forms/ApplyDurationLimits.cs b/src/ui/Forms/ApplyDurationLimits.cs index cfbd068b1..9a2d68bd5 100644 --- a/src/ui/Forms/ApplyDurationLimits.cs +++ b/src/ui/Forms/ApplyDurationLimits.cs @@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Forms for (int i = 0; i < _working.Paragraphs.Count; i++) { var p = _working.Paragraphs[i]; - var displayTime = p.Duration.TotalMilliseconds; + var displayTime = p.DurationTotalMilliseconds; if (displayTime < minDisplayTime) { var next = _working.GetParagraphOrDefault(i + 1); @@ -198,7 +198,7 @@ namespace Nikse.SubtitleEdit.Forms for (int i = 0; i < _working.Paragraphs.Count; i++) { var p = _working.Paragraphs[i]; - var displayTime = p.Duration.TotalMilliseconds; + var displayTime = p.DurationTotalMilliseconds; if (displayTime > maxDisplayTime) { AddFix(p, p.StartTime.TotalMilliseconds + maxDisplayTime, DefaultBackColor); diff --git a/src/ui/Forms/AudioClipsGet.cs b/src/ui/Forms/AudioClipsGet.cs index beceae7c7..5b87425b5 100644 --- a/src/ui/Forms/AudioClipsGet.cs +++ b/src/ui/Forms/AudioClipsGet.cs @@ -59,7 +59,7 @@ namespace Nikse.SubtitleEdit.Forms } var start = $"{item.StartTime.TotalSeconds:0.000}".Replace(",", "."); - var duration = $"{item.Duration.TotalSeconds:0.000}".Replace(",", "."); + var duration = $"{item.DurationTotalSeconds:0.000}".Replace(",", "."); var fFmpegWaveTranscodeSettings = "-ss " + start + " -t " + duration + " -i \"{0}\" -vn -ar 16000 -ac 1 -ab 32k -af volume=1.75 -f wav {2} \"{1}\""; if (useCenterChannelOnly) { diff --git a/src/ui/Forms/BatchConvert.cs b/src/ui/Forms/BatchConvert.cs index 49c20adfd..2ac2eb8d2 100644 --- a/src/ui/Forms/BatchConvert.cs +++ b/src/ui/Forms/BatchConvert.cs @@ -1255,7 +1255,7 @@ namespace Nikse.SubtitleEdit.Forms if (fromFormat != null && fromFormat.GetType() == typeof(MicroDvd)) { - if (sub != null && sub.Paragraphs.Count > 0 && sub.Paragraphs[0].Duration.TotalMilliseconds < 1001) + if (sub != null && sub.Paragraphs.Count > 0 && sub.Paragraphs[0].DurationTotalMilliseconds < 1001) { if (sub.Paragraphs[0].Text.StartsWith("29.", StringComparison.Ordinal) || sub.Paragraphs[0].Text.StartsWith("23.", StringComparison.Ordinal) || sub.Paragraphs[0].Text.StartsWith("29,", StringComparison.Ordinal) || sub.Paragraphs[0].Text.StartsWith("23,", StringComparison.Ordinal) || @@ -1885,10 +1885,10 @@ namespace Nikse.SubtitleEdit.Forms if (pes == null && subtitle.Paragraphs.Count > 0) { var last = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1]; - if (last.Duration.TotalMilliseconds < 100) + if (last.DurationTotalMilliseconds < 100) { last.EndTime.TotalMilliseconds = msub.Start; - if (last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (last.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + 3000; } @@ -1916,7 +1916,7 @@ namespace Nikse.SubtitleEdit.Forms for (var index = 0; index < subtitle.Paragraphs.Count; index++) { var p = subtitle.Paragraphs[index]; - if (p.Duration.TotalMilliseconds < 200) + if (p.DurationTotalMilliseconds < 200) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 3000; } @@ -2612,7 +2612,7 @@ namespace Nikse.SubtitleEdit.Forms var current = p.Subtitle.GetParagraphOrDefault(i); var next = p.Subtitle.GetParagraphOrDefault(i + 1); var gapsBetween = next.StartTime.TotalMilliseconds - current.EndTime.TotalMilliseconds; - if (gapsBetween < minimumMillisecondsBetweenLines && current.Duration.TotalMilliseconds > minimumMillisecondsBetweenLines) + if (gapsBetween < minimumMillisecondsBetweenLines && current.DurationTotalMilliseconds > minimumMillisecondsBetweenLines) { current.EndTime.TotalMilliseconds -= (minimumMillisecondsBetweenLines - gapsBetween); } diff --git a/src/ui/Forms/BinaryEdit/BinEdit.cs b/src/ui/Forms/BinaryEdit/BinEdit.cs index 105d2dddf..f3d80b4b5 100644 --- a/src/ui/Forms/BinaryEdit/BinEdit.cs +++ b/src/ui/Forms/BinaryEdit/BinEdit.cs @@ -716,11 +716,11 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit if (_columnIndexDuration >= 0) { - if (paragraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && _columnIndexDuration >= 0) + if (paragraph.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && _columnIndexDuration >= 0) { colorDuration = true; } - else if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + else if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { colorDuration = true; } @@ -1139,10 +1139,10 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit if (pes == null && subtitle.Paragraphs.Count > 0) { var last = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1]; - if (last.Duration.TotalMilliseconds < 100) + if (last.DurationTotalMilliseconds < 100) { last.EndTime.TotalMilliseconds = msub.Start; - if (last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (last.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + 3000; } @@ -1170,7 +1170,7 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit for (var index = 0; index < subtitle.Paragraphs.Count; index++) { var p = subtitle.Paragraphs[index]; - if (p.Duration.TotalMilliseconds < 200) + if (p.DurationTotalMilliseconds < 200) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 3000; } @@ -1701,7 +1701,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + ntsc = "TRUE"; } - var duration = SubtitleFormat.MillisecondsToFrames(p.Duration.TotalMilliseconds, _frameRate); + var duration = SubtitleFormat.MillisecondsToFrames(p.DurationTotalMilliseconds, _frameRate); var start = SubtitleFormat.MillisecondsToFrames(p.StartTime.TotalMilliseconds, _frameRate); var end = SubtitleFormat.MillisecondsToFrames(p.EndTime.TotalMilliseconds, _frameRate); @@ -3985,11 +3985,11 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + if (string.IsNullOrEmpty(errorText)) { - if (paragraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && _columnIndexDuration >= 0) + if (paragraph.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds && _columnIndexDuration >= 0) { errorText = "Duration too small"; } - else if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds && _columnIndexDuration >= 0) + else if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds && _columnIndexDuration >= 0) { errorText = "Duration too large"; } diff --git a/src/ui/Forms/EffectKaraoke.cs b/src/ui/Forms/EffectKaraoke.cs index a34cf11ca..a699d0fa9 100644 --- a/src/ui/Forms/EffectKaraoke.cs +++ b/src/ui/Forms/EffectKaraoke.cs @@ -52,8 +52,8 @@ namespace Nikse.SubtitleEdit.Forms AddToPreview(richTextBoxPreview, paragraph.Text); RefreshPreview(); - labelTotalMilliseconds.Text = $"{paragraph.Duration.TotalMilliseconds / TimeCode.BaseUnit:#,##0.000}"; - numericUpDownDelay.Maximum = (decimal)((paragraph.Duration.TotalMilliseconds - 500) / TimeCode.BaseUnit); + labelTotalMilliseconds.Text = $"{paragraph.DurationTotalMilliseconds / TimeCode.BaseUnit:#,##0.000}"; + numericUpDownDelay.Maximum = (decimal)((paragraph.DurationTotalMilliseconds - 500) / TimeCode.BaseUnit); numericUpDownDelay.Minimum = 0; numericUpDownDelay.Left = labelEndDelay.Left + labelEndDelay.Width + 5; @@ -108,13 +108,13 @@ namespace Nikse.SubtitleEdit.Forms { _animation = new List(); - if (HtmlUtil.RemoveHtmlTags(_paragraph.Text, true).Length == 0 || _paragraph.Duration.TotalMilliseconds < 0.001) + if (HtmlUtil.RemoveHtmlTags(_paragraph.Text, true).Length == 0 || _paragraph.DurationTotalMilliseconds < 0.001) { _animation.Add(new Paragraph(_paragraph)); return; } - var duration = _paragraph.Duration.TotalMilliseconds - ((double)numericUpDownDelay.Value * TimeCode.BaseUnit); + var duration = _paragraph.DurationTotalMilliseconds - ((double)numericUpDownDelay.Value * TimeCode.BaseUnit); var partsBase = EffectAnimationPart.MakeBase(_paragraph.Text); var stepsLength = duration / partsBase.Count+1; for (var index = 0; index <= partsBase.Count; index++) diff --git a/src/ui/Forms/EffectTypewriter.cs b/src/ui/Forms/EffectTypewriter.cs index 6caa31f28..ab6cb2b07 100644 --- a/src/ui/Forms/EffectTypewriter.cs +++ b/src/ui/Forms/EffectTypewriter.cs @@ -59,8 +59,8 @@ namespace Nikse.SubtitleEdit.Forms AddToPreview(richTextBoxPreview, paragraph.Text); RefreshPreview(); - labelTotalMilliseconds.Text = $"{paragraph.Duration.TotalMilliseconds / TimeCode.BaseUnit:#,##0.000}"; - numericUpDownDelay.Maximum = (decimal)((paragraph.Duration.TotalMilliseconds - 500) / TimeCode.BaseUnit); + labelTotalMilliseconds.Text = $"{paragraph.DurationTotalMilliseconds / TimeCode.BaseUnit:#,##0.000}"; + numericUpDownDelay.Maximum = (decimal)((paragraph.DurationTotalMilliseconds - 500) / TimeCode.BaseUnit); numericUpDownDelay.Minimum = 0; numericUpDownDelay.Left = labelEndDelay.Left + labelEndDelay.Width + 5; @@ -273,7 +273,7 @@ namespace Nikse.SubtitleEdit.Forms public void MakeAnimation() { TypewriterParagraphs = new List(); - var duration = _paragraph.Duration.TotalMilliseconds - (double)numericUpDownDelay.Value * TimeCode.BaseUnit; + var duration = _paragraph.DurationTotalMilliseconds - (double)numericUpDownDelay.Value * TimeCode.BaseUnit; var stepsLength = CalculateStepLength(_paragraph.Text, duration); double startMilliseconds; double endMilliseconds; diff --git a/src/ui/Forms/ErrorsGoTo.cs b/src/ui/Forms/ErrorsGoTo.cs index d7b7b8717..16fa738b6 100644 --- a/src/ui/Forms/ErrorsGoTo.cs +++ b/src/ui/Forms/ErrorsGoTo.cs @@ -78,14 +78,14 @@ namespace Nikse.SubtitleEdit.Forms errors.Add($"CPS: {charactersPerSecond:#,###.00} > {Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds}"); } - if (paragraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { - errors.Add($"Min duration: {paragraph.Duration.TotalMilliseconds:#,###.00} < {Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds}"); + errors.Add($"Min duration: {paragraph.DurationTotalMilliseconds:#,###.00} < {Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds}"); } - if (paragraph.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (paragraph.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { - errors.Add($"Max duration: {paragraph.Duration.TotalMilliseconds:#,###.00} > {Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds}"); + errors.Add($"Max duration: {paragraph.DurationTotalMilliseconds:#,###.00} > {Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds}"); } if (i > 0 && i < paragraphs.Count) diff --git a/src/ui/Forms/ExportPngXml.cs b/src/ui/Forms/ExportPngXml.cs index 77391688a..1e231b52d 100644 --- a/src/ui/Forms/ExportPngXml.cs +++ b/src/ui/Forms/ExportPngXml.cs @@ -2118,7 +2118,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + ntsc = "TRUE"; } - var duration = SubtitleFormat.MillisecondsToFrames(param.P.Duration.TotalMilliseconds, param.FramesPerSeconds); + var duration = SubtitleFormat.MillisecondsToFrames(param.P.DurationTotalMilliseconds, param.FramesPerSeconds); var start = SubtitleFormat.MillisecondsToFrames(param.P.StartTime.TotalMilliseconds, param.FramesPerSeconds); var end = SubtitleFormat.MillisecondsToFrames(param.P.EndTime.TotalMilliseconds, param.FramesPerSeconds); diff --git a/src/ui/Forms/FixCommonErrors.cs b/src/ui/Forms/FixCommonErrors.cs index 0880179db..344cf53db 100644 --- a/src/ui/Forms/FixCommonErrors.cs +++ b/src/ui/Forms/FixCommonErrors.cs @@ -1382,7 +1382,7 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBox_TextChanged; numericUpDownDuration.ValueChanged -= NumericUpDownDurationValueChanged; - numericUpDownDuration.Value = (decimal)(p.Duration.TotalMilliseconds / TimeCode.BaseUnit); + numericUpDownDuration.Value = (decimal)(p.DurationTotalMilliseconds / TimeCode.BaseUnit); numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged; } @@ -1939,7 +1939,7 @@ namespace Nikse.SubtitleEdit.Forms startFactor = 0.80; } - double middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.Duration.TotalMilliseconds * startFactor); + double middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.DurationTotalMilliseconds * startFactor); if (splitSeconds.HasValue && splitSeconds.Value > (currentParagraph.StartTime.TotalSeconds + 0.2) && splitSeconds.Value < (currentParagraph.EndTime.TotalSeconds - 0.2)) { middle = splitSeconds.Value * TimeCode.BaseUnit; diff --git a/src/ui/Forms/ImportText.cs b/src/ui/Forms/ImportText.cs index 1675da3f8..03c84c12e 100644 --- a/src/ui/Forms/ImportText.cs +++ b/src/ui/Forms/ImportText.cs @@ -555,7 +555,7 @@ namespace Nikse.SubtitleEdit.Forms double millisecondsIndex = millisecondsInterval; foreach (Paragraph p in FixedSubtitle.Paragraphs) { - p.EndTime.TotalMilliseconds = millisecondsIndex + p.Duration.TotalMilliseconds; + p.EndTime.TotalMilliseconds = millisecondsIndex + p.DurationTotalMilliseconds; p.StartTime.TotalMilliseconds = millisecondsIndex; millisecondsIndex += (p.EndTime.TotalMilliseconds - p.StartTime.TotalMilliseconds) + millisecondsInterval; } diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 8676446f5..42c23b22a 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -1289,17 +1289,17 @@ namespace Nikse.SubtitleEdit.Forms { // so we don't get weird rounds we'll use whole frames when moving start time double fr = TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate; if (e.BeforeParagraph != null && e.BeforeParagraph.StartTime.TotalMilliseconds != e.Paragraph.StartTime.TotalMilliseconds && - e.BeforeParagraph.Duration.TotalMilliseconds == e.Paragraph.Duration.TotalMilliseconds) + e.BeforeParagraph.DurationTotalMilliseconds == e.Paragraph.DurationTotalMilliseconds) { // move paragraph paragraph.StartTime.TotalMilliseconds = ((int)Math.Round(paragraph.StartTime.TotalMilliseconds / fr)) * fr; - paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + e.BeforeParagraph.Duration.TotalMilliseconds; + paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + e.BeforeParagraph.DurationTotalMilliseconds; } else if (e.BeforeParagraph != null && e.BeforeParagraph.EndTime.TotalMilliseconds == e.Paragraph.EndTime.TotalMilliseconds) { paragraph.EndTime.TotalMilliseconds = ((int)Math.Round(paragraph.EndTime.TotalMilliseconds / fr)) * fr; int end = SubtitleFormat.MillisecondsToFrames(paragraph.EndTime.TotalMilliseconds); - int dur = SubtitleFormat.MillisecondsToFrames(paragraph.Duration.TotalMilliseconds); + int dur = SubtitleFormat.MillisecondsToFrames(paragraph.DurationTotalMilliseconds); paragraph.StartTime.TotalMilliseconds = SubtitleFormat.FramesToMilliseconds(end - dur); } } @@ -1309,7 +1309,7 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; SubtitleListview1.SetStartTimeAndDurationBackground(index, paragraph, _subtitle.GetParagraphOrDefault(index + 1), _subtitle.GetParagraphOrDefault(index - 1)); - var durationInSeconds = (decimal)paragraph.Duration.TotalSeconds; + var durationInSeconds = (decimal)paragraph.DurationTotalSeconds; if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum) { SetDurationInSeconds((double)durationInSeconds); @@ -1353,7 +1353,7 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged -= MaskedTextBoxTextChanged; timeUpDownStartTime.TimeCode = paragraph.StartTime; timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; - var durationInSeconds = (decimal)(paragraph.Duration.TotalSeconds); + var durationInSeconds = (decimal)(paragraph.DurationTotalSeconds); if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum) { SetDurationInSeconds((double)durationInSeconds); @@ -1430,7 +1430,7 @@ namespace Nikse.SubtitleEdit.Forms private void MoveSelectedLines(AudioVisualizer.ParagraphEventArgs e, Paragraph paragraph, int index, int[] selectedIndices) { // calculate move min/max values related to current idx - var newMultiMoveHash = paragraph.Duration.TotalMilliseconds.GetHashCode() + index.GetHashCode() + selectedIndices.Length.GetHashCode(); + var newMultiMoveHash = paragraph.DurationTotalMilliseconds.GetHashCode() + index.GetHashCode() + selectedIndices.Length.GetHashCode(); if (newMultiMoveHash != _lastMultiMoveHash) { var currentStart = _subtitle.Paragraphs[index].StartTime.TotalMilliseconds; @@ -1463,7 +1463,7 @@ namespace Nikse.SubtitleEdit.Forms if (p != paragraph) { var oldParagraph = new Paragraph(p, false); - var dur = p.Duration.TotalMilliseconds; + var dur = p.DurationTotalMilliseconds; p.StartTime.TotalMilliseconds += e.AdjustMs; p.EndTime.TotalMilliseconds += e.AdjustMs; SubtitleListview1.SetStartTimeAndDurationBackground(idx, p, _subtitle.GetParagraphOrDefault(idx + 1), _subtitle.GetParagraphOrDefault(idx - 1)); @@ -1508,7 +1508,7 @@ namespace Nikse.SubtitleEdit.Forms if (curIdx == index - 1) { - var durationInSeconds = (decimal)(prev.Duration.TotalSeconds); + var durationInSeconds = (decimal)(prev.DurationTotalSeconds); if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum) { SetDurationInSeconds((double)durationInSeconds); @@ -1539,7 +1539,7 @@ namespace Nikse.SubtitleEdit.Forms if (curIdx == index + 1) { timeUpDownStartTime.TimeCode = next.StartTime; - var durationInSeconds = (decimal)(next.Duration.TotalSeconds); + var durationInSeconds = (decimal)(next.DurationTotalSeconds); if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum) { SetDurationInSeconds((double)durationInSeconds); @@ -6099,7 +6099,7 @@ namespace Nikse.SubtitleEdit.Forms for (var index = 0; index < _subtitle.Paragraphs.Count; index++) { var p = _subtitle.Paragraphs[index]; - if (p.Duration.TotalMilliseconds < 0 && !p.StartTime.IsMaxTime && !p.EndTime.IsMaxTime) + if (p.DurationTotalMilliseconds < 0 && !p.StartTime.IsMaxTime && !p.EndTime.IsMaxTime) { if (sb.Length < 20) { @@ -7478,7 +7478,7 @@ namespace Nikse.SubtitleEdit.Forms _makeHistoryPaused = true; var idx = SubtitleListview1.SelectedItems[0].Index; _subtitle.RecalculateDisplayTime(Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds, idx, Configuration.Settings.General.SubtitleOptimalCharactersPerSeconds, onlyOptimal: onlyOptimal); - SetDurationInSeconds(_subtitle.Paragraphs[idx].Duration.TotalSeconds); + SetDurationInSeconds(_subtitle.Paragraphs[idx].DurationTotalSeconds); _makeHistoryPaused = false; } } @@ -7491,7 +7491,7 @@ namespace Nikse.SubtitleEdit.Forms _makeHistoryPaused = true; var idx = SubtitleListview1.SelectedItems[0].Index; _subtitle.RecalculateDisplayTime(Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds, idx, Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds); - SetDurationInSeconds(_subtitle.Paragraphs[idx].Duration.TotalSeconds); + SetDurationInSeconds(_subtitle.Paragraphs[idx].DurationTotalSeconds); _makeHistoryPaused = false; } } @@ -10050,7 +10050,7 @@ namespace Nikse.SubtitleEdit.Forms newParagraph.StartTime.TotalMilliseconds = prev.EndTime.TotalMilliseconds + 1; } - if (newParagraph.Duration.TotalMilliseconds < 100) + if (newParagraph.DurationTotalMilliseconds < 100) { newParagraph.EndTime.TotalMilliseconds += 100; } @@ -10101,7 +10101,7 @@ namespace Nikse.SubtitleEdit.Forms { newParagraph.StartTime.TotalMilliseconds = 1000; newParagraph.EndTime.TotalMilliseconds = 3000; - if (newParagraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (newParagraph.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { newParagraph.EndTime.TotalMilliseconds = newParagraph.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds; @@ -10225,7 +10225,7 @@ namespace Nikse.SubtitleEdit.Forms { newParagraph.StartTime.TotalMilliseconds = 1000; newParagraph.EndTime.TotalMilliseconds = 3000; - if (newParagraph.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (newParagraph.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { newParagraph.EndTime.TotalMilliseconds = newParagraph.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds; @@ -10362,7 +10362,7 @@ namespace Nikse.SubtitleEdit.Forms if (startTime != null && last != null && _subtitle != null && Math.Abs(last.StartTime.TotalMilliseconds - startTime.TotalMilliseconds) > 0.5) { - var dur = last.Duration.TotalMilliseconds; + var dur = last.DurationTotalMilliseconds; last.StartTime.TotalMilliseconds = startTime.TotalMilliseconds; last.EndTime.TotalMilliseconds = startTime.TotalMilliseconds + dur; SubtitleListview1.SetStartTimeAndDuration(_subtitleListViewIndex, last, _subtitle.GetParagraphOrDefault(_subtitleListViewIndex + 1), _subtitle.GetParagraphOrDefault(_subtitleListViewIndex - 1)); @@ -10370,7 +10370,7 @@ namespace Nikse.SubtitleEdit.Forms } var duration = GetDurationInMilliseconds(); - if (last != null && duration > 0 && duration < 100000 && Math.Abs(duration - last.Duration.TotalMilliseconds) > 0.5 && _subtitle != null) + if (last != null && duration > 0 && duration < 100000 && Math.Abs(duration - last.DurationTotalMilliseconds) > 0.5 && _subtitle != null) { last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + duration; SubtitleListview1.SetDuration(_subtitleListViewIndex, last, _subtitle.GetParagraphOrDefault(_subtitleListViewIndex + 1)); @@ -10452,7 +10452,7 @@ namespace Nikse.SubtitleEdit.Forms private void UpdateListViewTextCharactersPerSeconds(Label charsPerSecond, Paragraph paragraph) { - if (paragraph.Duration.TotalSeconds > 0) + if (paragraph.DurationTotalSeconds > 0) { double charactersPerSecond = Utilities.GetCharactersPerSecond(paragraph); if (charactersPerSecond > Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds && @@ -11837,7 +11837,7 @@ namespace Nikse.SubtitleEdit.Forms if (_networkSession != null) { _networkSession.TimerStop(); - SetDurationInSeconds(currentParagraph.Duration.TotalSeconds); + SetDurationInSeconds(currentParagraph.DurationTotalSeconds); _networkSession.UpdateLine(_subtitle.GetIndex(currentParagraph), currentParagraph); NetworkGetSendUpdates(new List(), firstSelectedIndex + 1, newParagraph); } @@ -11980,7 +11980,7 @@ namespace Nikse.SubtitleEdit.Forms private void SetSplitTime(double? splitSeconds, Paragraph currentParagraph, Paragraph newParagraph, string oldText) { - double middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.Duration.TotalMilliseconds / 2); + double middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.DurationTotalMilliseconds / 2); if (!string.IsNullOrWhiteSpace(HtmlUtil.RemoveHtmlTags(oldText))) { var lineOneTextNoHtml = HtmlUtil.RemoveHtmlTags(currentParagraph.Text, true).Replace(Environment.NewLine, string.Empty); @@ -12000,7 +12000,7 @@ namespace Nikse.SubtitleEdit.Forms startFactor = 0.75; } - middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.Duration.TotalMilliseconds * startFactor); + middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.DurationTotalMilliseconds * startFactor); } } @@ -12009,7 +12009,7 @@ namespace Nikse.SubtitleEdit.Forms newParagraph.StartTime.TotalMilliseconds = TimeCode.MaxTimeTotalMilliseconds; newParagraph.EndTime.TotalMilliseconds = TimeCode.MaxTimeTotalMilliseconds; } - else if (currentParagraph.Duration.TotalMilliseconds <= 1) + else if (currentParagraph.DurationTotalMilliseconds <= 1) { newParagraph.StartTime.TotalMilliseconds = currentParagraph.EndTime.TotalMilliseconds; newParagraph.EndTime.TotalMilliseconds = currentParagraph.EndTime.TotalMilliseconds; @@ -12109,7 +12109,7 @@ namespace Nikse.SubtitleEdit.Forms } } - durationMilliseconds += p.Duration.TotalMilliseconds; + durationMilliseconds += p.DurationTotalMilliseconds; } if (sb1.Length > 150 || sb2.Length > 150) @@ -12645,7 +12645,7 @@ namespace Nikse.SubtitleEdit.Forms if (_networkSession != null) { _networkSession.TimerStop(); - SetDurationInSeconds(currentParagraph.Duration.TotalSeconds); + SetDurationInSeconds(currentParagraph.DurationTotalSeconds); _networkSession.UpdateLine(_subtitle.GetIndex(currentParagraph), currentParagraph); var deleteIndices = new List(); deleteIndices.Add(_subtitle.GetIndex(nextParagraph)); @@ -12980,13 +12980,13 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; numericUpDownDuration.ValueChanged -= NumericUpDownDurationValueChanged; - if (p.Duration.TotalSeconds > (double)numericUpDownDuration.Maximum) + if (p.DurationTotalSeconds > (double)numericUpDownDuration.Maximum) { SetDurationInSeconds((double)numericUpDownDuration.Maximum); } else { - SetDurationInSeconds(p.Duration.TotalSeconds); + SetDurationInSeconds(p.DurationTotalSeconds); } numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged; @@ -13011,13 +13011,13 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; numericUpDownDuration.ValueChanged -= NumericUpDownDurationValueChanged; - if (p.Duration.TotalSeconds > (double)numericUpDownDuration.Maximum) + if (p.DurationTotalSeconds > (double)numericUpDownDuration.Maximum) { SetDurationInSeconds((double)numericUpDownDuration.Maximum); } else { - SetDurationInSeconds(p.Duration.TotalSeconds); + SetDurationInSeconds(p.DurationTotalSeconds); } numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged; @@ -14820,10 +14820,10 @@ namespace Nikse.SubtitleEdit.Forms if (pes == null && subtitle.Paragraphs.Count > 0) { var last = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1]; - if (last.Duration.TotalMilliseconds < 100) + if (last.DurationTotalMilliseconds < 100) { last.EndTime.TotalMilliseconds = msub.Start; - if (last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (last.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + 3000; } @@ -14850,7 +14850,7 @@ namespace Nikse.SubtitleEdit.Forms for (int index = 0; index < subtitle.Paragraphs.Count; index++) { var p = subtitle.Paragraphs[index]; - if (p.Duration.TotalMilliseconds < 200) + if (p.DurationTotalMilliseconds < 200) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 3000; } @@ -18185,7 +18185,7 @@ namespace Nikse.SubtitleEdit.Forms var p = _subtitle.Paragraphs[index]; p.EndTime = TimeCode.FromSeconds(videoPosition); - if (p.Duration.TotalMilliseconds - MinGapBetweenLines > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (p.DurationTotalMilliseconds - MinGapBetweenLines > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { var newEndTime = new TimeCode(p.EndTime.TotalMilliseconds - MinGapBetweenLines); double charactersPerSecond = Utilities.GetCharactersPerSecond(new Paragraph(p) { EndTime = newEndTime }); @@ -18196,7 +18196,7 @@ namespace Nikse.SubtitleEdit.Forms } SubtitleListview1.SetStartTimeAndDuration(index, _subtitle.Paragraphs[index], _subtitle.GetParagraphOrDefault(index + 1), _subtitle.GetParagraphOrDefault(index - 1)); - SetDurationInSeconds(_subtitle.Paragraphs[index].Duration.TotalSeconds); + SetDurationInSeconds(_subtitle.Paragraphs[index].DurationTotalSeconds); ButtonInsertNewTextClick(null, null); UpdateSourceView(); } @@ -19186,14 +19186,14 @@ namespace Nikse.SubtitleEdit.Forms { var temp = new Paragraph(p); temp.StartTime.TotalMilliseconds = newStartTimeMs; - if (temp.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds || + if (temp.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds || Utilities.GetCharactersPerSecond(temp) > Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds) { var next = _subtitle.GetParagraphOrDefault(index + 1); if (next == null || - next.StartTime.TotalMilliseconds > newStartTimeMs + p.Duration.TotalMilliseconds + MinGapBetweenLines) + next.StartTime.TotalMilliseconds > newStartTimeMs + p.DurationTotalMilliseconds + MinGapBetweenLines) { - newEndTimeMs = newStartTimeMs + p.Duration.TotalMilliseconds; + newEndTimeMs = newStartTimeMs + p.DurationTotalMilliseconds; } } } @@ -19627,7 +19627,7 @@ namespace Nikse.SubtitleEdit.Forms { isClose = true; prevGap = p.StartTime.TotalMilliseconds - prev.EndTime.TotalMilliseconds; - if (ms < 0 && prev.Duration.TotalMilliseconds + ms < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (ms < 0 && prev.DurationTotalMilliseconds + ms < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { return; } @@ -19645,7 +19645,7 @@ namespace Nikse.SubtitleEdit.Forms } else { - if (p.Duration.TotalMilliseconds + Math.Abs(ms) > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p.DurationTotalMilliseconds + Math.Abs(ms) > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { return; } @@ -19673,7 +19673,7 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged -= MaskedTextBoxTextChanged; timeUpDownStartTime.TimeCode = p.StartTime; timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; - SetDurationInSeconds(p.Duration.TotalSeconds); + SetDurationInSeconds(p.DurationTotalSeconds); if (keepGapPrevIfClose && isClose && prev != null) { @@ -19739,7 +19739,7 @@ namespace Nikse.SubtitleEdit.Forms { isClose = true; nextGap = next.StartTime.TotalMilliseconds - p.EndTime.TotalMilliseconds; - if (ms > 0 && next.Duration.TotalMilliseconds + ms < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (ms > 0 && next.DurationTotalMilliseconds + ms < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { return; } @@ -19748,7 +19748,7 @@ namespace Nikse.SubtitleEdit.Forms if (ms > 0) { - if (p.Duration.TotalMilliseconds + ms > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p.DurationTotalMilliseconds + ms > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { return; } @@ -19780,7 +19780,7 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged -= MaskedTextBoxTextChanged; timeUpDownStartTime.TimeCode = p.StartTime; timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; - SetDurationInSeconds(p.Duration.TotalSeconds); + SetDurationInSeconds(p.DurationTotalSeconds); if (keepGapNextIfClose && isClose && next != null) { @@ -23627,7 +23627,7 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.TimeCode = TimeCode.FromSeconds(videoPosition); - var duration = p.Duration.TotalMilliseconds; + var duration = p.DurationTotalMilliseconds; p.StartTime.TotalMilliseconds = videoPosition * TimeCode.BaseUnit; if (adjustEndTime) @@ -23646,7 +23646,7 @@ namespace Nikse.SubtitleEdit.Forms if (!adjustEndTime) { - SetDurationInSeconds(p.Duration.TotalSeconds); + SetDurationInSeconds(p.DurationTotalSeconds); } UpdateOriginalTimeCodes(oldParagraph); @@ -23721,7 +23721,7 @@ namespace Nikse.SubtitleEdit.Forms } SubtitleListview1.SetStartTimeAndDuration(index, _subtitle.Paragraphs[index], _subtitle.GetParagraphOrDefault(index + 1), _subtitle.GetParagraphOrDefault(index - 1)); - SetDurationInSeconds(_subtitle.Paragraphs[index].Duration.TotalSeconds); + SetDurationInSeconds(_subtitle.Paragraphs[index].DurationTotalSeconds); UpdateSourceView(); } } @@ -24664,7 +24664,7 @@ namespace Nikse.SubtitleEdit.Forms _subtitle.Paragraphs[index].EndTime.TotalSeconds = videoPosition; SubtitleListview1.SetDuration(index, _subtitle.Paragraphs[index], _subtitle.GetParagraphOrDefault(index + 1)); checkBoxSyncListViewWithVideoWhilePlaying.Checked = oldSync; - numericUpDownDuration.Value = (decimal)_subtitle.Paragraphs[index].Duration.TotalSeconds; + numericUpDownDuration.Value = (decimal)_subtitle.Paragraphs[index].DurationTotalSeconds; numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged; RefreshSelectedParagraph(); @@ -24748,7 +24748,7 @@ namespace Nikse.SubtitleEdit.Forms } SubtitleListview1.SetDuration(index, _subtitle.Paragraphs[index], _subtitle.GetParagraphOrDefault(index + 1)); - SetDurationInSeconds(_subtitle.Paragraphs[index].Duration.TotalSeconds); + SetDurationInSeconds(_subtitle.Paragraphs[index].DurationTotalSeconds); if (index + 1 < _subtitle.Paragraphs.Count) { @@ -29041,7 +29041,7 @@ namespace Nikse.SubtitleEdit.Forms } timeUpDownStartTime.TimeCode = p.StartTime; - var durationInSeconds = (decimal)p.Duration.TotalSeconds; + var durationInSeconds = (decimal)p.DurationTotalSeconds; if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum) { SetDurationInSeconds((double)durationInSeconds); @@ -29091,7 +29091,7 @@ namespace Nikse.SubtitleEdit.Forms //} // current movie Position - double durationTotalMilliseconds = p.Duration.TotalMilliseconds; + double durationTotalMilliseconds = p.DurationTotalMilliseconds; double totalMillisecondsEnd = mediaPlayer.CurrentPosition * TimeCode.BaseUnit; var tc = new TimeCode(totalMillisecondsEnd - durationTotalMilliseconds); @@ -29110,7 +29110,7 @@ namespace Nikse.SubtitleEdit.Forms } timeUpDownStartTime.TimeCode = p.StartTime; - var durationInSeconds = (decimal)(p.Duration.TotalSeconds); + var durationInSeconds = (decimal)(p.DurationTotalSeconds); if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum) { SetDurationInSeconds((double)durationInSeconds); @@ -29233,14 +29233,14 @@ namespace Nikse.SubtitleEdit.Forms timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; } - if (p.Duration.TotalSeconds < 0) + if (p.DurationTotalSeconds < 0) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text); } SubtitleListview1.SetStartTimeAndDuration(index, p, _subtitle.GetParagraphOrDefault(index + 1), _subtitle.GetParagraphOrDefault(index - 1)); - SetDurationInSeconds(_subtitle.Paragraphs[index].Duration.TotalSeconds + 0.001); + SetDurationInSeconds(_subtitle.Paragraphs[index].DurationTotalSeconds + 0.001); if (next != null) { int addMilliseconds = MinGapBetweenLines; @@ -29249,7 +29249,7 @@ namespace Nikse.SubtitleEdit.Forms addMilliseconds = 1; } - var oldDuration = next.Duration.TotalMilliseconds; + var oldDuration = next.DurationTotalMilliseconds; if (next.StartTime.IsMaxTime || next.EndTime.IsMaxTime) { oldDuration = Utilities.GetOptimalDisplayMilliseconds(p.Text); @@ -30332,7 +30332,7 @@ namespace Nikse.SubtitleEdit.Forms { // current sub } - else if (p.Duration.TotalSeconds < 10 && p.StartTime.TotalMilliseconds > ms) + else if (p.DurationTotalSeconds < 10 && p.StartTime.TotalMilliseconds > ms) { mediaPlayer.CurrentPosition = p.StartTime.TotalSeconds; SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(p), true); @@ -30355,7 +30355,7 @@ namespace Nikse.SubtitleEdit.Forms { // current sub } - else if (p.Duration.TotalSeconds < 10 && p.StartTime.TotalMilliseconds < ms) + else if (p.DurationTotalSeconds < 10 && p.StartTime.TotalMilliseconds < ms) { mediaPlayer.CurrentPosition = p.StartTime.TotalSeconds; SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(p), true); diff --git a/src/ui/Forms/ModifySelection.cs b/src/ui/Forms/ModifySelection.cs index 32719210d..2549a4281 100644 --- a/src/ui/Forms/ModifySelection.cs +++ b/src/ui/Forms/ModifySelection.cs @@ -384,14 +384,14 @@ namespace Nikse.SubtitleEdit.Forms } else if (comboBoxRule.SelectedIndex == FunctionDurationLessThan) // Duration less than { - if (p.Duration.TotalMilliseconds < (double)numericUpDownDuration.Value) + if (p.DurationTotalMilliseconds < (double)numericUpDownDuration.Value) { listViewItems.Add(MakeListViewItem(p, i)); } } else if (comboBoxRule.SelectedIndex == FunctionDurationGreaterThan) // Duration greater than { - if (p.Duration.TotalMilliseconds > (double)numericUpDownDuration.Value) + if (p.DurationTotalMilliseconds > (double)numericUpDownDuration.Value) { listViewItems.Add(MakeListViewItem(p, i)); } diff --git a/src/ui/Forms/Ocr/VobSubOcr.cs b/src/ui/Forms/Ocr/VobSubOcr.cs index d0ea2fa33..6ac7d2ae1 100644 --- a/src/ui/Forms/Ocr/VobSubOcr.cs +++ b/src/ui/Forms/Ocr/VobSubOcr.cs @@ -1476,7 +1476,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr Paragraph p = new Paragraph(string.Empty, x.StartTime.TotalMilliseconds, x.EndTime.TotalMilliseconds); if (checkBoxUseTimeCodesFromIdx.Checked && x.IdxLine != null) { - double durationMilliseconds = p.Duration.TotalMilliseconds; + double durationMilliseconds = p.DurationTotalMilliseconds; p.StartTime = new TimeCode(x.IdxLine.StartTime.TotalMilliseconds); p.EndTime = new TimeCode(x.IdxLine.StartTime.TotalMilliseconds + durationMilliseconds); } @@ -7512,7 +7512,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr foreach (var old in oldSubtitle.Paragraphs) { if (Math.Abs(current.StartTime.TotalMilliseconds - old.StartTime.TotalMilliseconds) < 0.01 && - Math.Abs(current.Duration.TotalMilliseconds - old.Duration.TotalMilliseconds) < 0.01) + Math.Abs(current.DurationTotalMilliseconds - old.DurationTotalMilliseconds) < 0.01) { current.Text = old.Text; break; diff --git a/src/ui/Forms/SpellCheck.cs b/src/ui/Forms/SpellCheck.cs index cc853de30..fcc60edf2 100644 --- a/src/ui/Forms/SpellCheck.cs +++ b/src/ui/Forms/SpellCheck.cs @@ -424,7 +424,7 @@ namespace Nikse.SubtitleEdit.Forms if (imageSub == null) { - var mean = _currentParagraph.StartTime.TotalMilliseconds + _currentParagraph.Duration.TotalMilliseconds / 2; + var mean = _currentParagraph.StartTime.TotalMilliseconds + _currentParagraph.DurationTotalMilliseconds / 2; imageSub = _binSubtitles.FirstOrDefault(p => mean >= p.StartTimeCode.TotalMilliseconds && mean <= _currentParagraph.EndTime.TotalMilliseconds); } diff --git a/src/ui/Forms/SplitLongLines.cs b/src/ui/Forms/SplitLongLines.cs index 451559bd1..d719ec63d 100644 --- a/src/ui/Forms/SplitLongLines.cs +++ b/src/ui/Forms/SplitLongLines.cs @@ -203,7 +203,7 @@ namespace Nikse.SubtitleEdit.Forms var newParagraph2 = new Paragraph(p); newParagraph1.Text = Utilities.AutoBreakLine(arr[0], language); - var middle = p.StartTime.TotalMilliseconds + p.Duration.TotalMilliseconds / 2; + var middle = p.StartTime.TotalMilliseconds + p.DurationTotalMilliseconds / 2; if (!string.IsNullOrWhiteSpace(oldText)) { var startFactor = (double)HtmlUtil.RemoveHtmlTags(newParagraph1.Text).Length / oldText.Length; @@ -217,7 +217,7 @@ namespace Nikse.SubtitleEdit.Forms startFactor = 0.75; } - middle = p.StartTime.TotalMilliseconds + p.Duration.TotalMilliseconds * startFactor; + middle = p.StartTime.TotalMilliseconds + p.DurationTotalMilliseconds * startFactor; } newParagraph1.EndTime.TotalMilliseconds = middle - spacing1; @@ -302,7 +302,7 @@ namespace Nikse.SubtitleEdit.Forms } else { - var durationMs = p.Duration.TotalMilliseconds / arr.Count; + var durationMs = p.DurationTotalMilliseconds / arr.Count; for (var index = 0; index < arr.Count; index++) { var line = arr[index]; @@ -318,7 +318,7 @@ namespace Nikse.SubtitleEdit.Forms { var minGap = Configuration.Settings.General.MinimumMillisecondsBetweenLines; if (minGap > 0 && - newParagraph.Duration.TotalMilliseconds - minGap > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + newParagraph.DurationTotalMilliseconds - minGap > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { newParagraph.EndTime.TotalMilliseconds -= minGap; } @@ -421,7 +421,7 @@ namespace Nikse.SubtitleEdit.Forms var newParagraph2 = new Paragraph(p); newParagraph1.Text = Utilities.AutoBreakLine(arr[0], language); - var middle = p.StartTime.TotalMilliseconds + p.Duration.TotalMilliseconds / 2; + var middle = p.StartTime.TotalMilliseconds + p.DurationTotalMilliseconds / 2; if (!string.IsNullOrWhiteSpace(oldText)) { var startFactor = (double)HtmlUtil.RemoveHtmlTags(newParagraph1.Text).Length / oldText.Length; @@ -435,7 +435,7 @@ namespace Nikse.SubtitleEdit.Forms startFactor = 0.75; } - middle = p.StartTime.TotalMilliseconds + p.Duration.TotalMilliseconds * startFactor; + middle = p.StartTime.TotalMilliseconds + p.DurationTotalMilliseconds * startFactor; } newParagraph1.EndTime.TotalMilliseconds = middle - spacing1; diff --git a/src/ui/Forms/Statistics.cs b/src/ui/Forms/Statistics.cs index 9bab95a54..9eab10731 100644 --- a/src/ui/Forms/Statistics.cs +++ b/src/ui/Forms/Statistics.cs @@ -138,7 +138,7 @@ https://github.com/SubtitleEdit/subtitleedit maximumLineLength = Math.Max(len, maximumLineLength); totalLineLength += len; - var duration = p.Duration.TotalMilliseconds; + var duration = p.DurationTotalMilliseconds; minimumDuration = Math.Min(duration, minimumDuration); maximumDuration = Math.Max(duration, maximumDuration); totalDuration += duration; @@ -218,11 +218,11 @@ https://github.com/SubtitleEdit/subtitleedit aboveMaximumWpmCount++; } - if (p.Duration.TotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) + if (p.DurationTotalMilliseconds < Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds) { belowMinimumDurationCount++; } - if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) + if (p.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds) { aboveMaximumDurationCount++; } @@ -324,7 +324,7 @@ https://github.com/SubtitleEdit/subtitleedit for (var i = 0; i < _subtitle.Paragraphs.Count; i++) { var p = _subtitle.Paragraphs[i]; - if (Math.Abs(p.Duration.TotalMilliseconds - duration) < 0.01) + if (Math.Abs(p.DurationTotalMilliseconds - duration) < 0.01) { if (indices.Count >= NumberOfLinesToShow) { diff --git a/src/ui/Forms/SyncPointsSync.cs b/src/ui/Forms/SyncPointsSync.cs index 39c9eeef4..731d294e7 100644 --- a/src/ui/Forms/SyncPointsSync.cs +++ b/src/ui/Forms/SyncPointsSync.cs @@ -149,7 +149,7 @@ namespace Nikse.SubtitleEdit.Forms if (_synchronizationPoints.ContainsKey(i)) { var p = new Paragraph { StartTime = { TotalMilliseconds = _synchronizationPoints[i].TotalMilliseconds } }; - p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + _subtitle.Paragraphs[i].Duration.TotalMilliseconds; + p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + _subtitle.Paragraphs[i].DurationTotalMilliseconds; SubtitleListview1.SetStartTimeAndDuration(i, p, _subtitle.GetParagraphOrDefault(i + 1), _subtitle.GetParagraphOrDefault(i - 1)); var item = new ListBoxSyncPoint { Index = i, Text = _subtitle.Paragraphs[i].Number + " - " + p.StartTime }; diff --git a/src/ui/Logic/UiUtil.cs b/src/ui/Logic/UiUtil.cs index 3e8726952..03ddd30e2 100644 --- a/src/ui/Logic/UiUtil.cs +++ b/src/ui/Logic/UiUtil.cs @@ -84,7 +84,7 @@ namespace Nikse.SubtitleEdit.Logic if (p.StartTime.TotalMilliseconds <= positionInMilliseconds + 0.01 && p.EndTime.TotalMilliseconds >= positionInMilliseconds - 0.01) { string text = p.Text.Replace("|", Environment.NewLine); - bool isInfo = p == subtitle.Paragraphs[0] && (Math.Abs(p.StartTime.TotalMilliseconds) < 0.01 && Math.Abs(p.Duration.TotalMilliseconds) < 0.01 || Math.Abs(p.StartTime.TotalMilliseconds - Pac.PacNullTime.TotalMilliseconds) < 0.01); + bool isInfo = p == subtitle.Paragraphs[0] && (Math.Abs(p.StartTime.TotalMilliseconds) < 0.01 && Math.Abs(p.DurationTotalMilliseconds) < 0.01 || Math.Abs(p.StartTime.TotalMilliseconds - Pac.PacNullTime.TotalMilliseconds) < 0.01); if (!isInfo) { if (videoPlayerContainer.LastParagraph != p)