Class CsFileFilter
- Namespace
- SunamoDevCode
- Assembly
- SunamoDevCode.dll
EN: Filter for C# files with configurable filtering rules CZ: Filtr pro C# soubory s konfigurovatelными pravidly filtrování
public class CsFileFilter : ICsFileFilter
- Inheritance
-
CsFileFilter
- Implements
- Inherited Members
- Extension Methods
Remarks
Cannot be derived from FiltersNotTranslateAble to make finding instances of CsFileFilter easier
Constructors
CsFileFilter()
In default is everything in false Call some Set* method
public CsFileFilter()
Methods
AllowOnly(string)
Checks whether the given file path passes all filter criteria including both contains and end checks.
public bool AllowOnly(string filePath)
Parameters
filePathstringFile path to evaluate.
Returns
- bool
True if the file is allowed by the filter.
AllowOnly(string, EndArgs, ContainsArgs)
Checks if a file path is allowed based on end and contains filtering rules.
public static bool AllowOnly(string filePath, CsFileFilter.EndArgs end, CsFileFilter.ContainsArgs containsArgs)
Parameters
filePathstringFile path to check
endCsFileFilter.EndArgsEnd arguments for filtering
containsArgsCsFileFilter.ContainsArgsContains arguments for filtering
Returns
- bool
True if the file is allowed, false if it should be filtered out
AllowOnly(string, EndArgs, ContainsArgs, ref bool, bool)
A2 is also for master.designer.cs and aspx.designer.cs A2,3 can be null
public static bool AllowOnly(string filePath, CsFileFilter.EndArgs end, CsFileFilter.ContainsArgs containsArgs, ref bool hasEndMatch, bool isAlsoCheckingEnds)
Parameters
filePathstringFile path to check
endCsFileFilter.EndArgsEnd arguments for filtering
containsArgsCsFileFilter.ContainsArgsContains arguments for filtering
hasEndMatchboolOutput parameter indicating if end pattern matched
isAlsoCheckingEndsboolWhether to also check end patterns
Returns
- bool
True if the file is allowed, false if it should be filtered out
AllowOnly(string, bool)
Checks whether the given file path passes filter criteria, optionally including end-of-path checks.
public bool AllowOnly(string filePath, bool isAlsoCheckingEnds)
Parameters
filePathstringFile path to evaluate.
isAlsoCheckingEndsboolWhether to also check file path endings.
Returns
- bool
True if the file is allowed by the filter.
AllowOnlyContains(string)
Checks whether the given file path passes the contains-only filter criteria.
public bool AllowOnlyContains(string itemPath)
Parameters
itemPathstringFile path to evaluate.
Returns
- bool
True if the file is allowed by the contains filter.
AllowOnlyContains(string, ContainsArgs)
Checks if a file path is allowed based on contains filtering rules only.
public static bool AllowOnlyContains(string itemPath, CsFileFilter.ContainsArgs containsArgs)
Parameters
itemPathstringFile path to check
containsArgsCsFileFilter.ContainsArgsContains arguments for filtering
Returns
- bool
True if the file is allowed, false if it should be filtered out
GetContainsByFlags(bool)
Gets list of "contains" patterns based on flags
public List<string> GetContainsByFlags(bool negate)
Parameters
negateboolWhether to negate the flag values
Returns
GetEndingByFlags(bool)
Gets list of file ending patterns based on configured flags.
public List<string> GetEndingByFlags(bool negate)
Parameters
negateboolWhether to negate the flag values
Returns
GetFilesFiltered(string, string, SearchOption)
Gets filtered list of C# files based on configured filtering rules.
public List<string> GetFilesFiltered(string path, string searchPattern, SearchOption searchOption)
Parameters
pathstringDirectory path to search
searchPatternstringFile search pattern (e.g., "*.cs")
searchOptionSearchOptionSearch option (TopDirectoryOnly or AllDirectories)
Returns
Set(EndArgs, ContainsArgs)
Sets the end and contains arguments for filtering.
public void Set(CsFileFilter.EndArgs endArguments, CsFileFilter.ContainsArgs containsArguments)
Parameters
endArgumentsCsFileFilter.EndArgsEnd arguments for filtering
containsArgumentsCsFileFilter.ContainsArgsContains arguments for filtering
SetDefault()
Sets the default filtering configuration with standard exclusion patterns.
public void SetDefault()