Show / Hide Table of Contents

Class NameFilter

NameFilter is a string matching class which allows for both positive and negative matching. A filter is a sequence of independant System.Text.RegularExpressions.Regex separated by semi-colons ';'. To include a semi-colon it may be quoted as in ;. Each expression can be prefixed by a plus '+' sign or a minus '-' sign to denote the expression is intended to include or exclude names. If neither a plus or minus sign is found include is the default. A given name is tested for inclusion before checking exclusions. Only names matching an include spec and not matching an exclude spec are deemed to match the filter. An empty filter matches any name.

Inheritance
System.Object
NameFilter
Implements
IScanFilter
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: ICSharpCode.SharpZipLib.Core
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class NameFilter : IScanFilter
Examples

The following expression includes all name ending in '.dat' with the exception of 'dummy.dat' "+.dat$;-^dummy.dat$"

Constructors

| Improve this Doc View Source

NameFilter(String)

Construct an instance based on the filter expression passed

Declaration
public NameFilter(string filter)
Parameters
Type Name Description
System.String filter

The filter expression.

Methods

| Improve this Doc View Source

IsExcluded(String)

Test a value to see if it is excluded by the filter.

Declaration
public bool IsExcluded(string name)
Parameters
Type Name Description
System.String name

The value to test.

Returns
Type Description
System.Boolean

True if the value is excluded, false otherwise.

| Improve this Doc View Source

IsIncluded(String)

Test a value to see if it is included by the filter.

Declaration
public bool IsIncluded(string name)
Parameters
Type Name Description
System.String name

The value to test.

Returns
Type Description
System.Boolean

True if the value is included, false otherwise.

| Improve this Doc View Source

IsMatch(String)

Test a value to see if it matches the filter.

Declaration
public bool IsMatch(string name)
Parameters
Type Name Description
System.String name

The value to test.

Returns
Type Description
System.Boolean

True if the value matches, false otherwise.

| Improve this Doc View Source

IsValidExpression(String)

Test a string to see if it is a valid regular expression.

Declaration
public static bool IsValidExpression(string expression)
Parameters
Type Name Description
System.String expression

The expression to test.

Returns
Type Description
System.Boolean

True if expression is a valid System.Text.RegularExpressions.Regex false otherwise.

| Improve this Doc View Source

IsValidFilterExpression(String)

Test an expression to see if it is valid as a filter.

Declaration
public static bool IsValidFilterExpression(string toTest)
Parameters
Type Name Description
System.String toTest

The filter expression to test.

Returns
Type Description
System.Boolean

True if the expression is valid, false otherwise.

| Improve this Doc View Source

SplitQuoted(String)

Split a string into its component pieces

Declaration
public static string[] SplitQuoted(string original)
Parameters
Type Name Description
System.String original

The original string

Returns
Type Description
System.String[]

Returns an array of System.String values containing the individual filter elements.

| Improve this Doc View Source

ToString()

Convert this filter to its string equivalent.

Declaration
public override string ToString()
Returns
Type Description
System.String

The string equivalent for this filter.

Overrides
System.Object.ToString()

Implements

IScanFilter
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2000-2022 SharpZipLib Contributors