logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Interface IFileSystemService

    Interface for file system operations.
    Concrete implementation lives in Infrastructure layer.

    Inherited Members
    IService.LogService
    Namespace: Serenity.FilePersistence.Application.Interfaces
    Assembly: Serenity.Global.Application.dll
    Syntax
    public interface IFileSystemService : IService, IFoundationSettings

    Methods

    CreateDirectory(string)

    Creates a directory at the specified path, including any necessary parent directories.

    Declaration
    void CreateDirectory(string directoryPath)
    Parameters
    Type Name Description
    string directoryPath

    The path of the directory to create.

    Delete(string)

    Deletes the file at the specified path.

    Declaration
    void Delete(string path)
    Parameters
    Type Name Description
    string path

    The path of the file to delete.

    EnumerateFiles(string, string, bool)

    Enumerates files in the specified directory matching the search pattern.

    Declaration
    IEnumerable<string> EnumerateFiles(string directoryPath, string searchPattern, bool recursive)
    Parameters
    Type Name Description
    string directoryPath

    The path of the directory to search.

    string searchPattern

    The search pattern to match files against.

    bool recursive

    Whether to search subdirectories recursively.

    Returns
    Type Description
    IEnumerable<string>

    An enumerable collection of file paths matching the search criteria.

    Exists(string)

    Checks if a file or directory exists at the specified path.

    Declaration
    bool Exists(string path)
    Parameters
    Type Name Description
    string path
    Returns
    Type Description
    bool

    Move(string, string, bool)

    Moves a file to a new location.

    Declaration
    void Move(string sourcePath, string destinationPath, bool overwrite)
    Parameters
    Type Name Description
    string sourcePath

    The path of the file to move.

    string destinationPath

    The new path for the file.

    bool overwrite

    Whether to overwrite the file if it already exists.

    OpenRead(string)

    Opens a file for reading.

    Declaration
    Stream OpenRead(string path)
    Parameters
    Type Name Description
    string path

    The path of the file to open.

    Returns
    Type Description
    Stream

    A stream for reading the file.

    OpenWrite(string, bool)

    Opens a file for writing.

    Declaration
    Stream OpenWrite(string path, bool append)
    Parameters
    Type Name Description
    string path

    The path of the file to open.

    bool append

    Whether to append to the file if it exists.

    Returns
    Type Description
    Stream

    A stream for writing to the file.

    In this article
    © 2026 Serenity. All Rights Reserved