From 64ea43c4921eefefbf0ba5efc6ea4491a7838f08 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sun, 18 Dec 2022 09:02:50 +0100 Subject: [PATCH] Minor refact --- src/libse/Common/MergeLinesSameTextUtils.cs | 11 ++++++----- src/ui/Forms/MergeDoubleLines.cs | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/libse/Common/MergeLinesSameTextUtils.cs b/src/libse/Common/MergeLinesSameTextUtils.cs index b67dfae38..a84c1545f 100644 --- a/src/libse/Common/MergeLinesSameTextUtils.cs +++ b/src/libse/Common/MergeLinesSameTextUtils.cs @@ -11,7 +11,7 @@ namespace Nikse.SubtitleEdit.Core.Common var mergedIndexes = new List(); var removed = new List(); var mergedSubtitle = new Subtitle(); - for (int i = 1; i < subtitle.Paragraphs.Count; i++) + for (var i = 1; i < subtitle.Paragraphs.Count; i++) { if (removed.Contains(i - 1)) { @@ -21,7 +21,7 @@ namespace Nikse.SubtitleEdit.Core.Common var p = new Paragraph(subtitle.GetParagraphOrDefault(i - 1)); mergedSubtitle.Paragraphs.Add(p); - for (int j = i; j < subtitle.Paragraphs.Count; j++) + for (var j = i; j < subtitle.Paragraphs.Count; j++) { if (removed.Contains(j)) { @@ -30,7 +30,7 @@ namespace Nikse.SubtitleEdit.Core.Common var next = subtitle.GetParagraphOrDefault(j); var incrementText = string.Empty; - if ((QualifiesForMerge(p, next, maxMsBetween) || fixIncrementing && QualifiesForMergeIncrement(p, next, maxMsBetween, out incrementText))) + if (QualifiesForMerge(p, next, maxMsBetween) || fixIncrementing && QualifiesForMergeIncrement(p, next, maxMsBetween, out incrementText)) { p.Text = next.Text; if (!string.IsNullOrEmpty(incrementText)) @@ -77,10 +77,11 @@ namespace Nikse.SubtitleEdit.Core.Common if (p.Text != null && next.Text != null) { - string currentTextNoTags = HtmlUtil.RemoveHtmlTags(p.Text.Trim()); - string nextTextNoTags = HtmlUtil.RemoveHtmlTags(next.Text.Trim()); + var currentTextNoTags = HtmlUtil.RemoveHtmlTags(p.Text.Trim()); + var nextTextNoTags = HtmlUtil.RemoveHtmlTags(next.Text.Trim()); return string.Compare(currentTextNoTags, nextTextNoTags, StringComparison.OrdinalIgnoreCase) == 0; } + return false; } diff --git a/src/ui/Forms/MergeDoubleLines.cs b/src/ui/Forms/MergeDoubleLines.cs index cceed3b15..bbeadd584 100644 --- a/src/ui/Forms/MergeDoubleLines.cs +++ b/src/ui/Forms/MergeDoubleLines.cs @@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Forms Paragraph p = null; var lineNumbers = new List(); var listViewItems = new List(); - for (int i = 1; i < subtitle.Paragraphs.Count; i++) + for (var i = 1; i < subtitle.Paragraphs.Count; i++) { if (removed.Contains(i - 1)) { @@ -155,7 +155,7 @@ namespace Nikse.SubtitleEdit.Forms p = new Paragraph(subtitle.GetParagraphOrDefault(i - 1)); mergedSubtitle.Paragraphs.Add(p); - for (int j = i; j < subtitle.Paragraphs.Count; j++) + for (var j = i; j < subtitle.Paragraphs.Count; j++) { if (removed.Contains(j)) { @@ -242,7 +242,7 @@ namespace Nikse.SubtitleEdit.Forms return; } - int index = listViewFixes.SelectedIndices[0]; + var index = listViewFixes.SelectedIndices[0]; foreach (var number in _fixItems[index].LineNumbers) { foreach (var p in _subtitle.Paragraphs) @@ -277,7 +277,7 @@ namespace Nikse.SubtitleEdit.Forms private void UpdateBackgroundColor() { - int colorIdx = 0; + var colorIdx = 0; var colors = new List { Color.Green,