public static string FindMoreRecentLastWriteTime(StringCollection fileNames, DateTime targetLastWriteTime)
{
foreach (string fileName in fileNames) {
// only check fully file names that have a full path
if (Path.IsPathRooted(fileName)) {
FileInfo fileInfo = new FileInfo(fileName);
if (!fileInfo.Exists) {
logger.Info(string.Format(CultureInfo.InvariantCulture, "File '{0}' no longer exist (so the target might need to be updated)", fileName, targetLastWriteTime));
return fileName;
}
if (fileInfo.LastWriteTime > targetLastWriteTime) {
logger.Info(string.Format(CultureInfo.InvariantCulture, "'{0}' was newer than {1}", fileName, targetLastWriteTime));
return fileName;
}
}
}
return null;
}