Path: redb-route/redb.Route.GenericFile/IGenericFileFilter.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.GenericFile/IGenericFileFilter.cs
----
namespace redb.Route.GenericFile;
///
/// A filter the route author writes in code and names from the URI (filter=#myFilter),
/// resolved from the route registry — Apache Camel's GenericFileFilter. Use it when the
/// decision needs code: a lookup, a partner table, a calendar. For a condition that fits in a
/// string, filterFile and filterDirectory are simpler, and for a path pattern
/// antInclude/antExclude are simpler still.
///
public interface IGenericFileFilter
{
///
/// Decides whether a polled file is taken. Called after the cheap filters (name patterns, path
/// patterns) and before anything reads or moves the file.
///
/// The file as the listing found it.
/// true to poll the file, false to leave it untouched.
bool Accept(GenericFileInfo file);
///
/// Decides whether a subdirectory is walked into at all, while the listing is still running —
/// so a directory turned down here costs nothing, not even a listing. The default takes every
/// directory, which is what a filter that only cares about files wants.
///
/// Full path of the subdirectory.
/// Its path relative to the directory the endpoint polls.
/// true to walk into it, false to skip it and everything below.
bool AcceptDirectory(string fullPath, string relativePath) => true;
}