[VobSubOcr] - No need for keeping the loop ON.

This commit is contained in:
Ivandro Ismael 2017-02-09 16:28:37 +00:00
parent 5fd1ea4fea
commit 47302d4c7c

View File

@ -8828,23 +8828,22 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
Subtitle sub = new Subtitle();
var sub = new Subtitle();
Encoding encoding;
SubtitleFormat format = sub.LoadSubtitle(fileName, out encoding, null);
if (format == null)
return;
int index = 0;
foreach (Paragraph p in sub.Paragraphs)
int newSubCount = sub.Paragraphs.Count;
int currentSubCount = _subtitle.Paragraphs.Count;
while (index < newSubCount && index < currentSubCount)
{
if (index < _subtitle.Paragraphs.Count)
{
Paragraph currentP = _subtitle.Paragraphs[index];
currentP.StartTime.TotalMilliseconds = p.StartTime.TotalMilliseconds;
currentP.EndTime.TotalMilliseconds = p.EndTime.TotalMilliseconds;
subtitleListView1.SetStartTimeAndDuration(index, currentP);
}
index++;
Paragraph newP = sub.Paragraphs[index];
Paragraph currentP = _subtitle.Paragraphs[index];
currentP.StartTime.TotalMilliseconds = newP.StartTime.TotalMilliseconds;
currentP.EndTime.TotalMilliseconds = newP.EndTime.TotalMilliseconds;
subtitleListView1.SetStartTimeAndDuration(index, currentP);
}
}
}