A free open source "find in files" library for .net.
- Easy to use
- Extensible (without library modifications)
- Fast
- Stable
- Minimal disk and memory usage
- Thread-safe access to results as they arrive
- Providing text editors and IDEs with "find in files" capability
- Support tools for log files
- GREP tools
- .net 4 client profile or better
- MIT (see LICENSE.md)
SearcherFactory factory = new SearcherFactory
{
FileNamePattern = "*.txt",
Path = @"C:\test\",
Recursive = true,
Hidden = false,
LinePattern = "[a-z]+",
LinesNotMatching = false
};
Searcher searcher = factory.ConstructSearcher();
searcher.SearchFinished += s => Debug.Print("Finished with {0} results", s.Matches.Count);
searcher.Begin();
SearcherFactory factory = new SearcherFactory
{
FileNamePattern = "*.txt",
Path = @"C:\test\",
Recursive = true,
Hidden = false,
LinePattern = "[a-z]+",
LinesNotMatching = false
};
Searcher searcher = factory.ConstructSearcher();
// 1 second throttling
using (TimeDelayResultsReturner returner = new TimeDelayResultsReturner(searcher, 1000))
{
returner.NewResults += r => Debug.Print("Found {0} results...", r.Count);
returner.Finished += r => Debug.Print("Finished with {0} results", r.Count);
returner.Begin();
}
- VS2010
- Resharper (preferred)
- NuGet (NUnit for test project)
- No use of "var"
- All functions must have /// comments
- Use yield returns and LINQ to provide optimal memory/processor usage
- Must have unit tests
- Use NuGet for external libraries
- Do not allow construction/execution with invalid arguments
- No long functions or hacks
- No // comments unless it is a TODO item (anything that cannot be explained by /// or understood by code should not be written)
- Braces must always be present and must appear on the line below the statement (exceptions: auto properties, lambdas, array initializers)
- Always include access modifiers
- No third-party dependencies in library (test project is acceptable)