Table of Contents

FileTypeSet Class

Definition

Namespace
GleamTech.FileUltimate.AspNet.UI
Assembly
GleamTech.FileUltimate.dll

Represents a set of file patterns.

When combining patterns in string representation (e.g. when setting in markup), 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.
public sealed class FileTypeSet : HashSet<string>, ISerializable, IDeserializationCallback, ISet<string>, ICollection<string>, IReadOnlyCollection<string>, IEnumerable<string>, IEnumerable
Inheritance
FileTypeSet
Implements

Examples

Setting access control file types in code:

//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"
};
'allow only *.jpg and *.gif
accessControl.AllowedFileTypes = "*.jpg|*.gif"
'or
accessControl.AllowedFileTypes = FileTypeSet.Parse("*.jpg|*.gif")
'or
accessControl.AllowedFileTypes = New FileTypeSet() From {
    "*.jpg",
    "*.gif"
}

'allow all except *.exe and *.dll
accessControl.DeniedFileTypes = "*.exe|*.dll"
'or
accessControl.DeniedFileTypes = FileTypeSet.Parse("*.exe|*.dll")
'or
accessControl.DeniedFileTypes = New FileTypeSet() From {
    "*.exe",
    "*.dll"
}

Setting access control file types in ASPX markup:

<%-- 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

FileTypeSet()

Initializes a new instance of the FileTypeSet class.

FileTypeSet(IEnumerable<string>)

Initializes a new instance of the FileTypeSet class.

Properties

Comparer (Inherited from HashSet<string>)
Count (Inherited from HashSet<string>)

Methods

Add(T) (Inherited from HashSet<string>)
Clear() (Inherited from HashSet<string>)
Contains(T) (Inherited from HashSet<string>)
CopyTo(T[]) (Inherited from HashSet<string>)
CopyTo(T[], int) (Inherited from HashSet<string>)
CopyTo(T[], int, int) (Inherited from HashSet<string>)
CreateSetComparer() (Inherited from HashSet<string>)
ExceptWith(IEnumerable<T>) (Inherited from HashSet<string>)
GetEnumerator() (Inherited from HashSet<string>)
GetObjectData(SerializationInfo, StreamingContext) (Inherited from HashSet<string>)
IntersectWith(IEnumerable<T>) (Inherited from HashSet<string>)
IsProperSubsetOf(IEnumerable<T>) (Inherited from HashSet<string>)
IsProperSupersetOf(IEnumerable<T>) (Inherited from HashSet<string>)
IsSubsetOf(IEnumerable<T>) (Inherited from HashSet<string>)
IsSupersetOf(IEnumerable<T>) (Inherited from HashSet<string>)
OnDeserialization(object) (Inherited from HashSet<string>)
Overlaps(IEnumerable<T>) (Inherited from HashSet<string>)
Parse(string)

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

Remove(T) (Inherited from HashSet<string>)
RemoveWhere(Predicate<T>) (Inherited from HashSet<string>)
SetEquals(IEnumerable<T>) (Inherited from HashSet<string>)
SymmetricExceptWith(IEnumerable<T>) (Inherited from HashSet<string>)
ToRegex()

Converts the current set of file patterns to its Regex equivalent.

ToString()

Converts the current set of file patterns to a string representation with default separator '|'.

ToString(string)

Converts the current set of file patterns to a string representation with a custom separator.

TrimExcess() (Inherited from HashSet<string>)
TryGetValue(T, out T) (Inherited from HashSet<string>)
UnionWith(IEnumerable<T>) (Inherited from HashSet<string>)

Operators

implicit operator FileTypeSet(string)

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