Class CsFileFilterRoslyn
- Namespace
- SunamoRoslyn._public
- Assembly
- SunamoRoslyn.dll
Filters C# source files based on path endings and contained substrings. Cannot be derived from FiltersNotTranslateAble because of easy finding of CsFileFilter instances.
public class CsFileFilterRoslyn
- Inheritance
-
CsFileFilterRoslyn
- Inherited Members
- Extension Methods
Constructors
CsFileFilterRoslyn()
Initializes a new instance of the CsFileFilterRoslyn class. In default everything is false. Call a Set method to configure.
public CsFileFilterRoslyn()
Methods
AllowOnly(string)
Determines whether a file path is allowed based on the instance ending filters.
public bool AllowOnly(string path)
Parameters
pathstringThe file path to check.
Returns
- bool
True if the file should be removed from the list; otherwise false.
AllowOnly(string, EndArgs?, ContainsArgs?)
Determines whether a file path is allowed based on ending and contains filters.
public static bool AllowOnly(string path, CsFileFilterRoslyn.EndArgs? end, CsFileFilterRoslyn.ContainsArgs? c)
Parameters
pathstringThe file path to check.
endCsFileFilterRoslyn.EndArgsThe ending filter arguments.
cCsFileFilterRoslyn.ContainsArgsThe contains filter arguments.
Returns
- bool
True if the file is allowed; otherwise false.
AllowOnly(string, EndArgs?, ContainsArgs?, ref bool, bool)
Determines whether a file path is allowed based on ending and contains filters. Also for master.designer.cs and aspx.designer.cs. End and contains args can be null.
public static bool AllowOnly(string path, CsFileFilterRoslyn.EndArgs? end, CsFileFilterRoslyn.ContainsArgs? c, ref bool isEndMatch, bool alsoEnds)
Parameters
pathstringThe file path to check.
endCsFileFilterRoslyn.EndArgsThe ending filter arguments.
cCsFileFilterRoslyn.ContainsArgsThe contains filter arguments.
isEndMatchboolSet to true if the path was rejected by an ending filter.
alsoEndsboolWhether to also check ending filters.
Returns
- bool
True if the file is allowed; otherwise false.
AllowOnly(string, bool)
Determines whether a file path is allowed based on the instance filters.
public bool AllowOnly(string path, bool alsoEnds)
Parameters
Returns
- bool
True if the file should be removed from the list; otherwise false.
AllowOnlyContains(string)
Determines whether a file path is allowed based on the instance contains filters.
public bool AllowOnlyContains(string path)
Parameters
pathstringThe file path to check.
Returns
- bool
True if the file should be removed from the list; otherwise false.
AllowOnlyContains(string, ContainsArgs)
Checks whether a file path is allowed based on contains filters.
public static bool AllowOnlyContains(string path, CsFileFilterRoslyn.ContainsArgs c)
Parameters
pathstringThe file path to check.
cCsFileFilterRoslyn.ContainsArgsThe contains filter arguments.
Returns
- bool
True if the file is allowed; otherwise false.
GetContainsByFlags(bool)
Gets the contains filter strings matching the current flags.
public List<string> GetContainsByFlags(bool isNegating)
Parameters
isNegatingboolWhether to negate the flag check.
Returns
GetEndingByFlags(bool)
Gets the ending filter strings matching the current flags.
public List<string> GetEndingByFlags(bool isNegating)
Parameters
isNegatingboolWhether to negate the flag check.
Returns
GetFilesFiltered(string, string, SearchOption)
Gets files matching the search pattern and filters them.
public List<string> GetFilesFiltered(string path, string searchPattern, SearchOption searchOption)
Parameters
pathstringThe directory path to search in.
searchPatternstringThe file search pattern.
searchOptionSearchOptionThe search option (top directory or all subdirectories).
Returns
Set(EndArgs, ContainsArgs)
Sets the ending and contains filter arguments.
public void Set(CsFileFilterRoslyn.EndArgs endArgs, CsFileFilterRoslyn.ContainsArgs c)
Parameters
endArgsCsFileFilterRoslyn.EndArgsThe ending filter arguments.
cCsFileFilterRoslyn.ContainsArgsThe contains filter arguments.
SetDefault()
Sets the default filter configuration.
public void SetDefault()