DataWeb
Search Results for

    Show / Hide Table of Contents

    Class ThumbnailStorageStore

    Thumbnail storage implementation using the local file system. Provides operations to check, download, upload, and delete thumbnail files stored under the configured thumbnail path.

    Inheritance
    object
    ThumbnailStorageStore
    Implements
    IThumbnailStorageStore
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Storage.FileSystem
    Assembly: DataWeb.Storage.FileSystem.dll
    Syntax
    public class ThumbnailStorageStore : IThumbnailStorageStore

    Constructors

    ThumbnailStorageStore(IEnvironmentService)

    Thumbnail storage implementation using the local file system. Provides operations to check, download, upload, and delete thumbnail files stored under the configured thumbnail path.

    Declaration
    public ThumbnailStorageStore(IEnvironmentService environmentService)
    Parameters
    Type Name Description
    IEnvironmentService environmentService

    Properties

    Name

    Gets the name of the storage store.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    Methods

    DeleteThumbnailsAsync(CancellationToken)

    Deletes all thumbnail files by removing the entire thumbnail directory and its contents. Does nothing if the directory does not exist.

    Declaration
    public Task DeleteThumbnailsAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task

    DownloadThumbnailStreamAsync(string, CancellationToken)

    Opens and returns a sequential read-only stream for the specified thumbnail file.

    Declaration
    public Task<Stream> DownloadThumbnailStreamAsync(string thumbnailName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string thumbnailName

    The thumbnail file name.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<Stream>

    A readable Stream for the thumbnail.

    Exceptions
    Type Condition
    FileNotFoundException

    Thrown if the thumbnail file does not exist.

    IsThumbnailUpToDateAsync(string, DateTimeOffset, CancellationToken)

    Determines whether the thumbnail file is up to date by comparing its last write time (UTC) with the provided fileDateModified. If the file does not exist, GetLastWriteTimeUtc(SafeFileHandle) returns MinValue, so the method returns false.

    Declaration
    public Task<bool> IsThumbnailUpToDateAsync(string thumbnailName, DateTimeOffset fileDateModified, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string thumbnailName

    The thumbnail file name.

    DateTimeOffset fileDateModified

    The reference modification date to compare against.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<bool>

    true if the thumbnail is up to date; otherwise false.

    ThumbnailExistsAsync(string, CancellationToken)

    Determines whether a thumbnail file exists on the local file system. The thumbnailName parameter is used as the file name within the thumbnail path.

    Declaration
    public Task<bool> ThumbnailExistsAsync(string thumbnailName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string thumbnailName

    The thumbnail file name.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<bool>

    true if the thumbnail exists; otherwise false.

    UploadThumbnailStreamAsync(Stream, string, CancellationToken)

    Uploads a thumbnail stream to the local file system, creating the thumbnail directory if it does not exist. The stream is read from the beginning regardless of its current position. Any existing file with the same name is overwritten.

    Declaration
    public Task UploadThumbnailStreamAsync(Stream stream, string thumbnailName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Stream stream

    The stream containing the thumbnail data.

    string thumbnailName

    The thumbnail file name.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task

    Implements

    IThumbnailStorageStore
    In this article
    Back to top Generated by DocFX