Program to join Code Coverage Files

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 991
private static CoverageInfo JoinCoverageFiles(ArrayList files)
{
CoverageInfo result = null;
CoverageInfo current;
CoverageInfo joined = null;
if (files != null)
{
foreach (string[] file in files)
{
// Create from the current file
foreach (string filename in file)
{
try
{
current = CoverageInfo.CreateFromFile(filename);
}
catch (InvalidCoverageFileException ex)
{
continue;
}
catch (FileNotFoundException ex)
{
continue;
}

if (result == null)
{
// First time through, assign to result
result = current;
continue;
}

// Not the first time through, join the result with the current

try
{
joined = CoverageInfo.Join(result, current);
}
catch (Exception ex)
{
continue;
}
finally
{
// Dispose current and result
current.Dispose();
current = null;
}

result = joined;
}
}

}
return result;
}

Comments or Responses

Login to post response