'Declaration
Public Enum FileSearchType Inherits System.Enum
'Usage
Dim instance As FileSearchType
public enum FileSearchType : System.Enum
public enum class FileSearchType : public System.Enum
'Declaration
Public Enum FileSearchType Inherits System.Enum
'Usage
Dim instance As FileSearchType
public enum FileSearchType : System.Enum
public enum class FileSearchType : public System.Enum
Member | Description |
---|---|
Boolean | Boolean expression using and/or |
Fuzzy | Levenshtein Fuzzy Match |
PlainText | Plain text match |
RegularExpression | Regular expression pattern |
WholeWord | Match whole words |
Wildcard | Standard windows wildcard matching with * and ? |
using System; using System.Collections.Generic; using KellermanSoftware.FileSearchLibrary; using NUnit.Framework; namespace KellermanSoftware.FileSearchLibraryTests { [TestFixture] public class DocumentationFileMatchLogic { [Test] public void TestFileMatchPlain() { //Create Search Parameters SearchParms parms = new SearchParms(); //This is the directory to search parms.DirectoriesToSearch.Add(@"c:\_git"); //Match file names that contain the word customer parms.FileIncludeSearchType = FileSearchType.PlainText; parms.FilesToInclude.Add("Customer"); //Search for FirstName inside the matching file parms.SearchString = "FirstName"; parms.SearchExpressionType = SearchExpressionType.PlainText; //Search with the parameters FileSearchLogic logic = new FileSearchLogic(); List<string> results = logic.SearchFiles(parms); foreach (var filePath in results) { Console.WriteLine(filePath); } } [Test] public void TestFileMatchWholeWord() { //Create Search Parameters SearchParms parms = new SearchParms(); //This is the directory to search parms.DirectoriesToSearch.Add(@"c:\_git"); //Match file names that contain the word customer parms.FileIncludeSearchType = FileSearchType.WholeWord; parms.FilesToInclude.Add("Customer"); //Search for FirstName inside the matching file parms.SearchString = "FirstName"; parms.SearchExpressionType = SearchExpressionType.PlainText; //Search with the parameters FileSearchLogic logic = new FileSearchLogic(); List<string> results = logic.SearchFiles(parms); foreach (var filePath in results) { Console.WriteLine(filePath); } } [Test] public void TestFileMatchRegularExpression() { //Create Search Parameters SearchParms parms = new SearchParms(); //This is the directory to search parms.DirectoriesToSearch.Add(@"c:\_git"); //Match file names that contain start with the text Cust parms.FileIncludeSearchType = FileSearchType.RegularExpression; parms.FilesToInclude.Add("^Cust"); //Search for FirstName inside the matching file parms.SearchString = "FirstName"; parms.SearchExpressionType = SearchExpressionType.PlainText; //Search with the parameters FileSearchLogic logic = new FileSearchLogic(); List<string> results = logic.SearchFiles(parms); foreach (var filePath in results) { Console.WriteLine(filePath); } } [Test] public void TestFileMatchWildCard() { //Create Search Parameters SearchParms parms = new SearchParms(); //This is the directory to search parms.DirectoriesToSearch.Add(@"c:\_git"); //Match all C# files parms.FileIncludeSearchType = FileSearchType.Wildcard; parms.FilesToInclude.Add("*.cs"); //Search for FirstName inside the matching file parms.SearchString = "FirstName"; parms.SearchExpressionType = SearchExpressionType.PlainText; //Search with the parameters FileSearchLogic logic = new FileSearchLogic(); List<string> results = logic.SearchFiles(parms); foreach (var filePath in results) { Console.WriteLine(filePath); } } [Test] public void TestFileMatchBooleanOr() { //Create Search Parameters SearchParms parms = new SearchParms(); //This is the directory to search parms.DirectoriesToSearch.Add(@"c:\_git"); //Match all files that have the word Order or Orders or OrderDetails parms.FileIncludeSearchType = FileSearchType.Boolean; parms.FilesToInclude.Add("Order or Orders or OrderDetails"); //Search for FirstName inside the matching file parms.SearchString = "FirstName"; parms.SearchExpressionType = SearchExpressionType.PlainText; //Search with the parameters FileSearchLogic logic = new FileSearchLogic(); List<string> results = logic.SearchFiles(parms); foreach (var filePath in results) { Console.WriteLine(filePath); } } [Test] public void TestFileMatchFuzzy() { //Create Search Parameters SearchParms parms = new SearchParms(); //This is the directory to search parms.DirectoriesToSearch.Add(@"c:\_git"); //Match all files like Orders or Order parms.FileIncludeSearchType = FileSearchType.Fuzzy; parms.FilesToInclude.Add("Orders"); //Search for FirstName inside the matching file parms.SearchString = "FirstName"; parms.SearchExpressionType = SearchExpressionType.PlainText; //Search with the parameters FileSearchLogic logic = new FileSearchLogic(); List<string> results = logic.SearchFiles(parms); foreach (var filePath in results) { Console.WriteLine(filePath); } } } }
Option Infer On Imports System Imports System.Collections.Generic Imports KellermanSoftware.FileSearchLibrary Imports NUnit.Framework Namespace KellermanSoftware.FileSearchLibraryTests <TestFixture> Public Class DocumentationFileMatchLogic <Test> Public Sub TestFileMatchPlain() 'Create Search Parameters Dim parms As New SearchParms() 'This is the directory to search parms.DirectoriesToSearch.Add("c:\_git") 'Match file names that contain the word customer parms.FileIncludeSearchType = FileSearchType.PlainText parms.FilesToInclude.Add("Customer") 'Search for FirstName inside the matching file parms.SearchString = "FirstName" parms.SearchExpressionType = SearchExpressionType.PlainText 'Search with the parameters Dim logic As New FileSearchLogic() Dim results As List(Of String) = logic.SearchFiles(parms) For Each filePath In results Console.WriteLine(filePath) Next filePath End Sub <Test> Public Sub TestFileMatchWholeWord() 'Create Search Parameters Dim parms As New SearchParms() 'This is the directory to search parms.DirectoriesToSearch.Add("c:\_git") 'Match file names that contain the word customer parms.FileIncludeSearchType = FileSearchType.WholeWord parms.FilesToInclude.Add("Customer") 'Search for FirstName inside the matching file parms.SearchString = "FirstName" parms.SearchExpressionType = SearchExpressionType.PlainText 'Search with the parameters Dim logic As New FileSearchLogic() Dim results As List(Of String) = logic.SearchFiles(parms) For Each filePath In results Console.WriteLine(filePath) Next filePath End Sub <Test> Public Sub TestFileMatchRegularExpression() 'Create Search Parameters Dim parms As New SearchParms() 'This is the directory to search parms.DirectoriesToSearch.Add("c:\_git") 'Match file names that contain start with the text Cust parms.FileIncludeSearchType = FileSearchType.RegularExpression parms.FilesToInclude.Add("^Cust") 'Search for FirstName inside the matching file parms.SearchString = "FirstName" parms.SearchExpressionType = SearchExpressionType.PlainText 'Search with the parameters Dim logic As New FileSearchLogic() Dim results As List(Of String) = logic.SearchFiles(parms) For Each filePath In results Console.WriteLine(filePath) Next filePath End Sub <Test> Public Sub TestFileMatchWildCard() 'Create Search Parameters Dim parms As New SearchParms() 'This is the directory to search parms.DirectoriesToSearch.Add("c:\_git") 'Match all C# files parms.FileIncludeSearchType = FileSearchType.Wildcard parms.FilesToInclude.Add("*.cs") 'Search for FirstName inside the matching file parms.SearchString = "FirstName" parms.SearchExpressionType = SearchExpressionType.PlainText 'Search with the parameters Dim logic As New FileSearchLogic() Dim results As List(Of String) = logic.SearchFiles(parms) For Each filePath In results Console.WriteLine(filePath) Next filePath End Sub <Test> Public Sub TestFileMatchBooleanOr() 'Create Search Parameters Dim parms As New SearchParms() 'This is the directory to search parms.DirectoriesToSearch.Add("c:\_git") 'Match all files that have the word Order or Orders or OrderDetails parms.FileIncludeSearchType = FileSearchType.Boolean parms.FilesToInclude.Add("Order or Orders or OrderDetails") 'Search for FirstName inside the matching file parms.SearchString = "FirstName" parms.SearchExpressionType = SearchExpressionType.PlainText 'Search with the parameters Dim logic As New FileSearchLogic() Dim results As List(Of String) = logic.SearchFiles(parms) For Each filePath In results Console.WriteLine(filePath) Next filePath End Sub <Test> Public Sub TestFileMatchFuzzy() 'Create Search Parameters Dim parms As New SearchParms() 'This is the directory to search parms.DirectoriesToSearch.Add("c:\_git") 'Match all files like Orders or Order parms.FileIncludeSearchType = FileSearchType.Fuzzy parms.FilesToInclude.Add("Orders") 'Search for FirstName inside the matching file parms.SearchString = "FirstName" parms.SearchExpressionType = SearchExpressionType.PlainText 'Search with the parameters Dim logic As New FileSearchLogic() Dim results As List(Of String) = logic.SearchFiles(parms) For Each filePath In results Console.WriteLine(filePath) Next filePath End Sub End Class End Namespace
System.Object
System.ValueType
System.Enum
KellermanSoftware.FileSearchLibrary.FileSearchType
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2