FileTypeSet Class

Represents a set of file patterns.

When combining patterns in string representation, they should be separated by vertical bar (|).

In a pattern, you can use these wildcards:

  • * matches zero or more characters.
  • ? matches exactly one character.

Some pattern examples:

  • *.* matches files with any extension (does not match files without an extension)
  • *.jpg matches files only with jpg extension
  • picture*.jpg matches files only with jpg extension and which names start with 'picture'
  • picture.* matches files with any extension and which names start with 'picture'
  • picture matches files with no extension and which names are exactly 'picture'
  • *.jp* matches files like 'picture.jpg', 'otherpicture.jpe', 'somepicture.jpeg' etc.
  • *.jp? matches files like 'picture.jpg', 'otherpicture.jpe' etc.
  • picture?.jpg matches files like 'picture1.jpg', 'picture2.jpg', 'pictures.jpg' etc.

Definition

Namespace: GleamTech.FileUltimate.AspNet.UI
Assembly: GleamTech.FileUltimate (in GleamTech.FileUltimate.dll) Version: 9.2.0
C#
public sealed class FileTypeSet : HashSet<string>
Inheritance
Object    HashSetString    FileTypeSet

Example

Setting access control file types in code:

C#
//allow only *.jpg and *.gif
accessControl.AllowedFileTypes = "*.jpg|*.gif";
//or
accessControl.AllowedFileTypes = FileTypeSet.Parse("*.jpg|*.gif");
//or
accessControl.AllowedFileTypes = new FileTypeSet
{
    "*.jpg",
    "*.gif"
};

//allow all except *.exe and *.dll
accessControl.DeniedFileTypes = "*.exe|*.dll";
//or
accessControl.DeniedFileTypes = FileTypeSet.Parse("*.exe|*.dll");
//or
accessControl.DeniedFileTypes = new FileTypeSet
{
    "*.exe",
    "*.dll"
};

Setting access control file types in ASPX markup:

ASPX
<%-- allow only *.jpg and *.gif --%>
<GleamTech:FileManagerAccessControl 
    Path="\" 
    AllowedPermissions="Full" 
    AllowedFileTypes="*.jpg|*.gif" /> 

<%-- allow all except *.exe and *.dll --%>
<GleamTech:FileManagerAccessControl 
    Path="\" 
    AllowedPermissions="Full" 
    DeniedFileTypes="*.exe|*.dll" />

Constructors

FileTypeSetInitializes a new instance of the FileTypeSet class.
FileTypeSet(IEnumerableString)Initializes a new instance of the FileTypeSet class.

Properties

ComparerGets the IEqualityComparerT object that is used to determine equality for the values in the set.
(Inherited from HashSetString)
CountGets the number of elements that are contained in a set.
(Inherited from HashSetString)

Methods

AddAdds the specified element to a set.
(Inherited from HashSetString)
ClearRemoves all elements from a HashSetT object.
(Inherited from HashSetString)
ContainsDetermines whether a HashSetT object contains the specified element.
(Inherited from HashSetString)
CopyTo(T)Copies the elements of a HashSetT object to an array.
(Inherited from HashSetString)
CopyTo(T, Int32)Copies the elements of a HashSetT object to an array, starting at the specified array index.
(Inherited from HashSetString)
CopyTo(T, Int32, Int32)Copies the specified number of elements of a HashSetT object to an array, starting at the specified array index.
(Inherited from HashSetString)
ExceptWithRemoves all elements in the specified collection from the current HashSetT object.
(Inherited from HashSetString)
GetEnumeratorReturns an enumerator that iterates through a HashSetT object.
(Inherited from HashSetString)
GetObjectDataImplements the ISerializable interface and returns the data needed to serialize a HashSetT object.
(Inherited from HashSetString)
IntersectWithModifies the current HashSetT object to contain only elements that are present in that object and in the specified collection.
(Inherited from HashSetString)
IsProperSubsetOfDetermines whether a HashSetT object is a proper subset of the specified collection.
(Inherited from HashSetString)
IsProperSupersetOfDetermines whether a HashSetT object is a proper superset of the specified collection.
(Inherited from HashSetString)
IsSubsetOfDetermines whether a HashSetT object is a subset of the specified collection.
(Inherited from HashSetString)
IsSupersetOfDetermines whether a HashSetT object is a superset of the specified collection.
(Inherited from HashSetString)
OnDeserializationImplements the ISerializable interface and raises the deserialization event when the deserialization is complete.
(Inherited from HashSetString)
OverlapsDetermines whether the current HashSetT object and a specified collection share common elements.
(Inherited from HashSetString)
ParseConverts the string representation of a set of file patterns to its FileTypeSet equivalent.
RemoveRemoves the specified element from a HashSetT object.
(Inherited from HashSetString)
RemoveWhereRemoves all elements that match the conditions defined by the specified predicate from a HashSetT collection.
(Inherited from HashSetString)
SetEqualsDetermines whether a HashSetT object and the specified collection contain the same elements.
(Inherited from HashSetString)
SymmetricExceptWithModifies the current HashSetT object to contain only elements that are present either in that object or in the specified collection, but not both.
(Inherited from HashSetString)
ToRegexConverts the current set of file patterns to its Regex equivalent.
ToStringConverts the current set of file patterns to a string representation with default separator '|'.
(Overrides ObjectToString)
ToString(String)Converts the current set of file patterns to a string representation with a custom separator.
TrimExcessSets the capacity of a HashSetT object to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.
(Inherited from HashSetString)
TryGetValueSearches the set for a given value and returns the equal value it finds, if any.
(Inherited from HashSetString)
UnionWithModifies the current HashSetT object to contain all elements that are present in itself, the specified collection, or both.
(Inherited from HashSetString)

Operators

(String to FileTypeSet)Converts the string representation of a set of file patterns to its FileTypeSet equivalent.

See Also