Merge pull request #593 from ivandrofly/optimization/patch-3

Some optimization in RemoveEmptyLines
This commit is contained in:
Nikolaj Olsson 2015-03-02 19:02:36 +01:00
commit 9371fb8f2d

View File

@ -458,8 +458,8 @@ namespace Nikse.SubtitleEdit.Logic
public int RemoveEmptyLines()
{
int count = 0;
if (_paragraphs.Count > 0)
int count = _paragraphs.Count;
if (count > 0)
{
int firstNumber = _paragraphs[0].Number;
for (int i = _paragraphs.Count - 1; i >= 0; i--)
@ -468,14 +468,12 @@ namespace Nikse.SubtitleEdit.Logic
string s = p.Text.Trim();
if (s.Length == 0)
{
_paragraphs.RemoveAt(i);
count++;
}
}
Renumber(firstNumber);
if (count != _paragraphs.Count)
Renumber(firstNumber);
}
return count;
return count - _paragraphs.Count;
}
/// <summary>