public bool IsMatch(FileSystemInfo itemInfo) { string path = itemInfo.FullName; if (PathFilters.Any(reg => reg.IsMatch(path))) { return(true); } string name = itemInfo.Name; if (CommonFilters.Any(reg => reg.IsMatch(name))) { return(true); } if (itemInfo is FileInfo fileInfo) { return(FileFilters.Any(reg => reg.IsMatch(name))); } else if (itemInfo is DirectoryInfo directoryInfo) { return(DirectoryFilters.Any(reg => reg.IsMatch(name))); } else { return(false); } }
public bool IsMatch(string name, string path, ItemType type) { if (PathFilters.Any(reg => reg.IsMatch(path))) { return(true); } if (CommonFilters.Any(reg => reg.IsMatch(name))) { return(true); } if (type == ItemType.File) { return(FileFilters.Any(reg => reg.IsMatch(name))); } else if (type == ItemType.Directory) { return(DirectoryFilters.Any(reg => reg.IsMatch(name))); } else { return(false); } }
protected virtual void createFilesList() { IEnumerable <FileInfo> files = Destinations[SOURCE_DIRECTORY_TYPE_NAME].GetFiles(); Files = files.Where(file => FileFilters.Any(filter => filter.isMatch(file))); }