Unosquare
    Show / Hide Table of Contents

    Class FileModuleExtensions

    Provides extension methods for FileModule and derived classes.

    Inheritance
    Object
    FileModuleExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: EmbedIO.Files
    Syntax
    public static class FileModuleExtensions

    Methods

    HandleDirectoryNotListable<TModule>(TModule, FileRequestHandlerCallback)

    Sets a FileRequestHandlerCallback that is called by a module whenever the requested URL path has been mapped to a directory, but directory listing has been disabled.

    Declaration
    public static TModule HandleDirectoryNotListable<TModule>(this TModule this, FileRequestHandlerCallback callback)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    FileRequestHandlerCallback callback

    The method to call.

    Returns
    Type Description
    TModule

    this with its OnDirectoryNotListable property set to callback.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    OnDirectoryNotListable
    FileRequestHandler

    HandleMappingFailed<TModule>(TModule, FileRequestHandlerCallback)

    Sets a FileRequestHandlerCallback that is called by a module whenever the requested URL path could not be mapped to any file or directory.

    Declaration
    public static TModule HandleMappingFailed<TModule>(this TModule this, FileRequestHandlerCallback callback)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    FileRequestHandlerCallback callback

    The method to call.

    Returns
    Type Description
    TModule

    this with its OnMappingFailed property set to callback.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    OnMappingFailed
    FileRequestHandler

    HandleMethodNotAllowed<TModule>(TModule, FileRequestHandlerCallback)

    Sets a FileRequestHandlerCallback that is called by a module whenever the requested URL path has been mapped to a file or directory, but the request's HTTP method is neither GET nor HEAD.

    Declaration
    public static TModule HandleMethodNotAllowed<TModule>(this TModule this, FileRequestHandlerCallback callback)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    FileRequestHandlerCallback callback

    The method to call.

    Returns
    Type Description
    TModule

    this with its OnMethodNotAllowed property set to callback.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    OnMethodNotAllowed
    FileRequestHandler

    WithCache<TModule>(TModule, FileCache)

    Sets the FileCache used by a module to store hashes and, optionally, file contents and rendered directory listings.

    Declaration
    public static TModule WithCache<TModule>(this TModule this, FileCache value)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    FileCache value

    An instance of FileCache.

    Returns
    Type Description
    TModule

    this with its Cache property set to value.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    Cache

    WithContentCaching<TModule>(TModule)

    Enables caching of file contents and directory listings on a module.

    Declaration
    public static TModule WithContentCaching<TModule>(this TModule this)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    Returns
    Type Description
    TModule

    this with its ContentCaching property set to true.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    ContentCaching

    WithContentCaching<TModule>(TModule, Boolean)

    Sets a value indicating whether a module caches the contents of files and directory listings.

    Declaration
    public static TModule WithContentCaching<TModule>(this TModule this, bool value)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    Boolean value

    true to enable caching of contents; false to disable it.

    Returns
    Type Description
    TModule

    this with its ContentCaching property set to value.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    ContentCaching

    WithContentCaching<TModule>(TModule, Int32, Int32)

    Enables caching of file contents and directory listings on a module.

    Declaration
    public static TModule WithContentCaching<TModule>(this TModule this, int maxFileSizeKb, int maxSizeKb)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    Int32 maxFileSizeKb

    true sets the maximum size of a single cached file in kilobytes

    Int32 maxSizeKb

    true sets the maximum total size of cached data in kilobytes

    Returns
    Type Description
    TModule

    this with its ContentCaching property set to true.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    ContentCaching

    WithDefaultDocument<TModule>(TModule, String)

    Sets the name of the default document served, if it exists, instead of a directory listing when the path of a requested URL maps to a directory.

    Declaration
    public static TModule WithDefaultDocument<TModule>(this TModule this, string value)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    String value

    The name of the default document.

    Returns
    Type Description
    TModule

    this with its DefaultDocument property set to value.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    DefaultDocument

    WithDefaultExtension<TModule>(TModule, String)

    Sets the default extension appended to requested URL paths that do not map to any file or directory.

    Declaration
    public static TModule WithDefaultExtension<TModule>(this TModule this, string value)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    String value

    The default extension.

    Returns
    Type Description
    TModule

    this with its DefaultExtension property set to value.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    DefaultExtension

    WithDirectoryLister<TModule>(TModule, IDirectoryLister)

    Sets the IDirectoryLister interface used to generate directory listing in a module.

    Declaration
    public static TModule WithDirectoryLister<TModule>(this TModule this, IDirectoryLister value)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    IDirectoryLister value

    An IDirectoryLister interface, or null to disable the generation of directory listings.

    Returns
    Type Description
    TModule

    this with its DirectoryLister property set to value.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    DirectoryLister

    WithoutContentCaching<TModule>(TModule)

    Disables caching of file contents and directory listings on a module.

    Declaration
    public static TModule WithoutContentCaching<TModule>(this TModule this)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    Returns
    Type Description
    TModule

    this with its ContentCaching property set to false.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    ContentCaching

    WithoutDefaultDocument<TModule>(TModule)

    Sets the name of the default document to null.

    Declaration
    public static TModule WithoutDefaultDocument<TModule>(this TModule this)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    Returns
    Type Description
    TModule

    this with its DefaultDocument property set to null.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    DefaultDocument

    WithoutDefaultExtension<TModule>(TModule)

    Sets the default extension to null.

    Declaration
    public static TModule WithoutDefaultExtension<TModule>(this TModule this)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    Returns
    Type Description
    TModule

    this with its DefaultExtension property set to null.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    DefaultExtension

    WithoutDirectoryLister<TModule>(TModule)

    Sets a module's DirectoryLister property to null, disabling the generation of directory listings.

    Declaration
    public static TModule WithoutDirectoryLister<TModule>(this TModule this)
        where TModule : FileModule
    Parameters
    Type Name Description
    TModule this

    The module on which this method is called.

    Returns
    Type Description
    TModule

    this with its DirectoryLister property set to null.

    Type Parameters
    Name Description
    TModule

    The type of the module on which this method is called.

    See Also
    DirectoryLister

    Comments

    Back to top Copyright © 2017-2019 Unosquare