// To be used if the last_write_time to use for comparison is not the
// one obtained from path
public bool IsUpToDateAndFiltered(string path, DateTime last_write_time)
{
FileAttributes attr;
attr = Read(path);
// If there are no attributes set on the file, there is no
// way that we can be up-to-date.
if (attr == null)
{
return(false);
}
if (!FilterFactory.DirtyFilterCache)
{
// If the filters are same as in last run,
// since attr is not null, check the timestamps (bypass HasFilterInfo)
if (last_write_time == DateTime.MaxValue)
{
return(attr.LastWriteTime >= FileSystem.GetLastWriteTimeUtc(path));
}
else
{
return(attr.LastWriteTime >= last_write_time);
}
}
// If there is a new filter in the mean time
// take previous filter information into consideration.
if (!attr.HasFilterInfo)
{
return(false);
}
int current_filter_version;
current_filter_version = FilterFactory.GetFilterVersion(attr.FilterName);
if (current_filter_version > attr.FilterVersion)
{
return(false);
}
if (last_write_time == DateTime.MaxValue)
{
return(attr.LastWriteTime >= FileSystem.GetLastWriteTimeUtc(path));
}
else
{
return(attr.LastWriteTime >= last_write_time);
}
}