public void RemoveLinesInFile(string filePath, IFileLinePredicate predicate, string destinationPath = null)
{
if (destinationPath.IsNull())
{
destinationPath = filePath;
}
string[] lines = File.ReadAllLines(filePath);
int linesCount = lines.Length;
List <string> destinationLines = new List <string>();
for (int r = 0; r < linesCount; r++)
{
string oldLine = lines[r];
if (!predicate.IsTrue(oldLine))
{
destinationLines.Add(oldLine);
}
}
if (predicate.IsSimulation)
{
return;
}
File.WriteAllLines(destinationPath, destinationLines);
}