From 1ccf288598182ca9917235ac4602b01eb1342a8d Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Tue, 11 Aug 2020 19:14:36 +0200 Subject: [PATCH] Update change + minor refact --- Changelog.txt | 2 ++ .../ScenaristClosedCaptions.cs | 20 ++++--------------- .../ScenaristClosedCaptionsDropFrame.cs | 4 +--- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 1f40f8a68..842fe14bc 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -6,11 +6,13 @@ * Add new subtitle (Excel) format - thx Jecy * Add shortcuts for Tools menu items Split/Append/Join - thx z3us * Add shortcuts for "Merge line with same text/time-code" - thx Mike + * Add shortcuts "Set end and pause" + "Export to PAC" - thx Milenko * Add shortcut for File - Compare * Add context menu item for "Set default fixes" in FCE * Cmd line convert use header from EBU STL file - thx malashin * Add "ocrengine" parameter to cmd line convert * Add "Export to FCP+image" in OCR window - thx Marko + * Add alignment support for .scc files - thx madprogramer * IMPROVED: * Update Bulgarian translation - thx KalinM * Update Hungarian translation - thx Zityi diff --git a/libse/SubtitleFormats/ScenaristClosedCaptions.cs b/libse/SubtitleFormats/ScenaristClosedCaptions.cs index ec8b5b00b..01b4cec20 100644 --- a/libse/SubtitleFormats/ScenaristClosedCaptions.cs +++ b/libse/SubtitleFormats/ScenaristClosedCaptions.cs @@ -455,7 +455,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats var sb = new StringBuilder(); int count = 0; - foreach (string line in lines) + foreach (var line in lines) { if (count < 4) { @@ -468,19 +468,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats private static bool IsAllOkay(List lines) { - if (lines.Count > 4) - { - return false; - } - - for (int i = 0; i < lines.Count; i++) - { - if (lines[i].Length > 32) - { - return false; - } - } - return true; + return lines.Count <= 4 && lines.All(line => line.Length <= 32); } private static int GetLastIndexOfSpace(string s, int endCount) @@ -811,10 +799,10 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats if (columnRest == 3) { - return code + " " + code + " 9723 9723 "; + return $"{code} {code} 9723 9723 "; } - return code + " " + code + " "; + return $"{code} {code} "; } private string ToTimeCode(double totalMilliseconds) diff --git a/libse/SubtitleFormats/ScenaristClosedCaptionsDropFrame.cs b/libse/SubtitleFormats/ScenaristClosedCaptionsDropFrame.cs index 17d108140..4066616f3 100644 --- a/libse/SubtitleFormats/ScenaristClosedCaptionsDropFrame.cs +++ b/libse/SubtitleFormats/ScenaristClosedCaptionsDropFrame.cs @@ -2,19 +2,17 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { - public class ScenaristClosedCaptionsDropFrame : ScenaristClosedCaptions { //00:01:00:29 9420 9420 94ae 94ae 94d0 94d0 4920 f761 7320 ... semi colon (instead of colon) before frame number is used to indicate drop frame private const string TimeCodeRegEx = @"^\d+:\d\d:\d\d[;,]\d\d\t"; private static readonly Regex Regex = new Regex(TimeCodeRegEx, RegexOptions.Compiled); protected override Regex RegexTimeCodes => Regex; + public override string Name => "Scenarist Closed Captions Drop Frame"; public ScenaristClosedCaptionsDropFrame() { DropFrame = true; } - - public override string Name => "Scenarist Closed Captions Drop Frame"; } }