Table of Contents

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

path string

The 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

path string

The file path to check.

end CsFileFilterRoslyn.EndArgs

The ending filter arguments.

c CsFileFilterRoslyn.ContainsArgs

The 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

path string

The file path to check.

end CsFileFilterRoslyn.EndArgs

The ending filter arguments.

c CsFileFilterRoslyn.ContainsArgs

The contains filter arguments.

isEndMatch bool

Set to true if the path was rejected by an ending filter.

alsoEnds bool

Whether 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

path string

The file path to check.

alsoEnds bool

Whether to also check ending filters.

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

path string

The 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

path string

The file path to check.

c CsFileFilterRoslyn.ContainsArgs

The 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

isNegating bool

Whether to negate the flag check.

Returns

List<string>

A list of contains filter strings.

GetEndingByFlags(bool)

Gets the ending filter strings matching the current flags.

public List<string> GetEndingByFlags(bool isNegating)

Parameters

isNegating bool

Whether to negate the flag check.

Returns

List<string>

A list of ending filter strings.

GetFilesFiltered(string, string, SearchOption)

Gets files matching the search pattern and filters them.

public List<string> GetFilesFiltered(string path, string searchPattern, SearchOption searchOption)

Parameters

path string

The directory path to search in.

searchPattern string

The file search pattern.

searchOption SearchOption

The search option (top directory or all subdirectories).

Returns

List<string>

A filtered list of file paths.

Set(EndArgs, ContainsArgs)

Sets the ending and contains filter arguments.

public void Set(CsFileFilterRoslyn.EndArgs endArgs, CsFileFilterRoslyn.ContainsArgs c)

Parameters

endArgs CsFileFilterRoslyn.EndArgs

The ending filter arguments.

c CsFileFilterRoslyn.ContainsArgs

The contains filter arguments.

SetDefault()

Sets the default filter configuration.

public void SetDefault()