Search Results for

    Show / Hide Table of Contents
    View Source

    Class PhysicalFileSystem

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.IO
    Assembly: Umbraco.Core.dll
    Syntax
    public class PhysicalFileSystem : IPhysicalFileSystem, IFileSystem, IFileProviderFactory

    Constructors

    View Source

    PhysicalFileSystem(IIOHelper, IHostingEnvironment, ILogger<PhysicalFileSystem>, String, String)

    Declaration
    public PhysicalFileSystem(IIOHelper ioHelper, IHostingEnvironment hostingEnvironment, ILogger<PhysicalFileSystem> logger, string rootPath, string rootUrl)
    Parameters
    Type Name Description
    IIOHelper ioHelper
    IHostingEnvironment hostingEnvironment
    ILogger<PhysicalFileSystem> logger
    System.String rootPath
    System.String rootUrl

    Properties

    View Source

    CanAddPhysical

    Declaration
    public bool CanAddPhysical { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    View Source

    AddFile(String, Stream)

    Saves a file.

    Declaration
    public void AddFile(string path, Stream stream)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path of the file.

    Stream stream

    A stream containing the file data.

    Remarks

    Overrides the existing file, if any.

    View Source

    AddFile(String, Stream, Boolean)

    Saves a file.

    Declaration
    public void AddFile(string path, Stream stream, bool overrideExisting)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path of the file.

    Stream stream

    A stream containing the file data.

    System.Boolean overrideExisting

    A value indicating whether to override the existing file, if any.

    Remarks

    If a file exists and overrideExisting is false, an exception is thrown.

    View Source

    AddFile(String, String, Boolean, Boolean)

    Declaration
    public void AddFile(string path, string physicalPath, bool overrideIfExists = true, bool copy = false)
    Parameters
    Type Name Description
    System.String path
    System.String physicalPath
    System.Boolean overrideIfExists
    System.Boolean copy
    View Source

    Create()

    Declaration
    public IFileProvider Create()
    Returns
    Type Description
    IFileProvider
    View Source

    DeleteDirectory(String)

    Deletes a directory.

    Declaration
    public void DeleteDirectory(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path of the directory.

    View Source

    DeleteDirectory(String, Boolean)

    Deletes a directory.

    Declaration
    public void DeleteDirectory(string path, bool recursive)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path of the directory.

    System.Boolean recursive

    A value indicating whether to recursively delete sub-directories.

    View Source

    DeleteFile(String)

    Deletes a file.

    Declaration
    public void DeleteFile(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path to the file.

    View Source

    DirectoryExists(String)

    Gets a value indicating whether a directory exists.

    Declaration
    public bool DirectoryExists(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path of the directory.

    Returns
    Type Description
    System.Boolean

    A value indicating whether a directory exists.

    View Source

    EnsureDirectory(String)

    Declaration
    protected virtual void EnsureDirectory(string path)
    Parameters
    Type Name Description
    System.String path
    View Source

    EnsureDirectorySeparatorChar(String)

    Declaration
    protected string EnsureDirectorySeparatorChar(string path)
    Parameters
    Type Name Description
    System.String path
    Returns
    Type Description
    System.String
    View Source

    EnsureTrailingSeparator(String)

    Declaration
    protected string EnsureTrailingSeparator(string path)
    Parameters
    Type Name Description
    System.String path
    Returns
    Type Description
    System.String
    View Source

    EnsureUrlSeparatorChar(String)

    Declaration
    protected string EnsureUrlSeparatorChar(string path)
    Parameters
    Type Name Description
    System.String path
    Returns
    Type Description
    System.String
    View Source

    FileExists(String)

    Gets a value indicating whether a file exists.

    Declaration
    public bool FileExists(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path to the file.

    Returns
    Type Description
    System.Boolean

    A value indicating whether the file exists.

    View Source

    GetCreated(String)

    Gets the created date of a directory or file.

    Declaration
    public DateTimeOffset GetCreated(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path to the directory or the file.

    Returns
    Type Description
    DateTimeOffset

    The created date of the directory or the file.

    View Source

    GetDirectories(String)

    Gets directories in a directory.

    Declaration
    public IEnumerable<string> GetDirectories(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path to the directory.

    Returns
    Type Description
    IEnumerable<System.String>

    The filesystem-relative path to the directories in the directory.

    Remarks

    Filesystem-relative paths use forward-slashes as directory separators.

    View Source

    GetFiles(String)

    Gets files in a directory.

    Declaration
    public IEnumerable<string> GetFiles(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path of the directory.

    Returns
    Type Description
    IEnumerable<System.String>

    The filesystem-relative path to the files in the directory.

    Remarks

    Filesystem-relative paths use forward-slashes as directory separators.

    View Source

    GetFiles(String, String)

    Gets files in a directory.

    Declaration
    public IEnumerable<string> GetFiles(string path, string filter)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path of the directory.

    System.String filter

    A filter.

    Returns
    Type Description
    IEnumerable<System.String>

    The filesystem-relative path to the matching files in the directory.

    Remarks

    Filesystem-relative paths use forward-slashes as directory separators.

    View Source

    GetFullPath(String)

    Gets the full path.

    Declaration
    public string GetFullPath(string path)
    Parameters
    Type Name Description
    System.String path

    The full or filesystem-relative path.

    Returns
    Type Description
    System.String

    The full path.

    Remarks

    On the physical filesystem, the full path is the rooted (ie non-relative), safe (ie within this filesystem's root) path. All separators are Path.DirectorySeparatorChar.

    View Source

    GetLastModified(String)

    Gets the last-modified date of a directory or file.

    Declaration
    public DateTimeOffset GetLastModified(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path to the directory or the file.

    Returns
    Type Description
    DateTimeOffset

    The last modified date of the directory or the file.

    View Source

    GetRelativePath(String)

    Gets the filesystem-relative path of a full path or of an URL.

    Declaration
    public string GetRelativePath(string fullPathOrUrl)
    Parameters
    Type Name Description
    System.String fullPathOrUrl

    The full path or URL.

    Returns
    Type Description
    System.String

    The path, relative to this filesystem's root.

    Remarks

    The relative path is relative to this filesystem's root, not starting with any directory separator. All separators are forward-slashes.

    View Source

    GetSize(String)

    Gets the size of a file.

    Declaration
    public long GetSize(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path to the file.

    Returns
    Type Description
    System.Int64

    The file of the size, in bytes.

    Remarks

    If the file does not exist, returns -1.

    View Source

    GetUrl(String)

    Gets the URL.

    Declaration
    public string GetUrl(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path.

    Returns
    Type Description
    System.String

    The URL.

    Remarks

    All separators are forward-slashes.

    View Source

    OpenFile(String)

    Opens a file.

    Declaration
    public Stream OpenFile(string path)
    Parameters
    Type Name Description
    System.String path

    The filesystem-relative path to the file.

    Returns
    Type Description
    Stream
    View Source

    WithRetry(Action)

    Declaration
    protected void WithRetry(Action action)
    Parameters
    Type Name Description
    Action action
    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • PhysicalFileSystem(IIOHelper, IHostingEnvironment, ILogger<PhysicalFileSystem>, String, String)
    • Properties
      • CanAddPhysical
    • Methods
      • AddFile(String, Stream)
      • AddFile(String, Stream, Boolean)
      • AddFile(String, String, Boolean, Boolean)
      • Create()
      • DeleteDirectory(String)
      • DeleteDirectory(String, Boolean)
      • DeleteFile(String)
      • DirectoryExists(String)
      • EnsureDirectory(String)
      • EnsureDirectorySeparatorChar(String)
      • EnsureTrailingSeparator(String)
      • EnsureUrlSeparatorChar(String)
      • FileExists(String)
      • GetCreated(String)
      • GetDirectories(String)
      • GetFiles(String)
      • GetFiles(String, String)
      • GetFullPath(String)
      • GetLastModified(String)
      • GetRelativePath(String)
      • GetSize(String)
      • GetUrl(String)
      • OpenFile(String)
      • WithRetry(Action)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX