private bool ShouldExclude(Regex[] excludeList, Regex[] includeList, string name)
{
if (excludeList != null)
{
// check against regex's in our exclude list
foreach (Regex regex in excludeList)
{
if (regex.Match(name).Success)
{
// if the name matches an entry in the exclude list, we SHOULD exclude it
return true;
}
}
// no matches in exclude list, we should NOT exclude it
return false;
}
else if (includeList != null)
{
foreach (Regex regex in includeList)
{
if (regex.Match(name).Success)
{
// if the name matches an entry in the include list, we should NOT exclude it
return false;
}
}
// no matches in include list, we SHOULD exclude it
return true;
}
return false;
}