Minor refact

This commit is contained in:
niksedk 2022-12-18 09:02:50 +01:00
parent 03e1d962a5
commit 64ea43c492
2 changed files with 10 additions and 9 deletions

View File

@ -11,7 +11,7 @@ namespace Nikse.SubtitleEdit.Core.Common
var mergedIndexes = new List<int>();
var removed = new List<int>();
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;
}

View File

@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Forms
Paragraph p = null;
var lineNumbers = new List<int>();
var listViewItems = new List<ListViewItem>();
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>
{
Color.Green,