Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    VirtualFileProviderBase Class

    Namespace: Stride.Core.IO
    Assembly: Stride.Core.IO.dll

    Abstract base class for IVirtualFileProvider.

    System.Object → VirtualFileProviderBase
    Derived from VirtualFileProviderBase: DatabaseFileProvider FileSystemProvider NetworkVirtualFileProvider

    public abstract class VirtualFileProviderBase : IVirtualFileProvider, IDisposable
    Name Description
    Constructors
    VirtualFileProviderBase(String)
    Properties
    RootPath

    Gets or sets the root path of this provider. See remarks.

    Methods
    CreateDirectory(String)

    Creates all directories so that url exists.

    DirectoryExists(String)
    Dispose()
    FileDelete(String)

    Deletes the specified file.

    FileExists(String)

    Determines whether the specified path points to an existing file.

    FileMove(String, IVirtualFileProvider, String)

    Move the specified file specified from its sourceUrl to the location pointed by destinationUrl in the destination provider. Do not overwrite, throw IOException if the file can't be moved.

    FileMove(String, String)

    Move the specified file specified from its sourceUrl to the location pointed by destinationUrl. Do not overwrite, throw IOException if the file can't be moved.

    FileSize(String)

    Returns the size of the specified file in bytes

    GetAbsolutePath(String)

    Gets the absolute path for the specified local path from this provider.

    GetLastWriteTime(String)

    Returns the date and time the specified file or directory was last written to.

    ListFiles(String, String, VirtualSearchOption)

    Returns the list of files from the specified path.

    OpenStream(String, VirtualFileMode, VirtualFileAccess, VirtualFileShare, StreamFlags)

    Opens a Stream from the specified path.

    ResolvePath(String)

    Resolves the path (can map virtual to absolute path).

    TryGetFileLocation(String, out String, out Int64, out Int64)

    Gets the absolute path and location if the specified path physically exist on the disk in an uncompressed form (could be inside another file).

    | Improve this Doc View Source

    Constructors


    VirtualFileProviderBase(String)

    protected VirtualFileProviderBase(string rootPath)
    Parameters
    Type Name Description
    System.String rootPath
    | Improve this Doc View Source

    Properties


    RootPath

    Gets or sets the root path of this provider. See remarks.

    public string RootPath { get; }
    Property Value
    Type Description
    System.String

    The root path.

    Remarks

    All path are relative to the root path.

    | Improve this Doc View Source

    Methods


    CreateDirectory(String)

    Creates all directories so that url exists.

    public virtual void CreateDirectory(string url)
    Parameters
    Type Name Description
    System.String url

    The URL.


    DirectoryExists(String)

    public virtual bool DirectoryExists(string url)
    Parameters
    Type Name Description
    System.String url
    Returns
    Type Description
    System.Boolean

    Dispose()

    public void Dispose()

    FileDelete(String)

    Deletes the specified file.

    public virtual void FileDelete(string url)
    Parameters
    Type Name Description
    System.String url

    The URL.


    FileExists(String)

    Determines whether the specified path points to an existing file.

    public virtual bool FileExists(string url)
    Parameters
    Type Name Description
    System.String url

    The path.

    Returns
    Type Description
    System.Boolean

    FileMove(String, IVirtualFileProvider, String)

    Move the specified file specified from its sourceUrl to the location pointed by destinationUrl in the destination provider. Do not overwrite, throw IOException if the file can't be moved.

    public virtual void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl)
    Parameters
    Type Name Description
    System.String sourceUrl

    The source URL.

    IVirtualFileProvider destinationProvider

    The destination provider.

    System.String destinationUrl

    The destination URL, relative to the destination provider.


    FileMove(String, String)

    Move the specified file specified from its sourceUrl to the location pointed by destinationUrl. Do not overwrite, throw IOException if the file can't be moved.

    public virtual void FileMove(string sourceUrl, string destinationUrl)
    Parameters
    Type Name Description
    System.String sourceUrl

    The source URL of the file

    System.String destinationUrl

    The destination URL of the file


    FileSize(String)

    Returns the size of the specified file in bytes

    public virtual long FileSize(string url)
    Parameters
    Type Name Description
    System.String url

    The file or directory for which to obtain size

    Returns
    Type Description
    System.Int64

    A long value representing the file size in bytes


    GetAbsolutePath(String)

    Gets the absolute path for the specified local path from this provider.

    public virtual string GetAbsolutePath(string path)
    Parameters
    Type Name Description
    System.String path

    The path local to this instance.

    Returns
    Type Description
    System.String

    An absolute path.


    GetLastWriteTime(String)

    Returns the date and time the specified file or directory was last written to.

    public virtual DateTime GetLastWriteTime(string url)
    Parameters
    Type Name Description
    System.String url

    The file or directory for which to obtain write date and time information.

    Returns
    Type Description
    System.DateTime

    A DateTime structure set to the date and time that the specified file or directory was last written to.


    ListFiles(String, String, VirtualSearchOption)

    Returns the list of files from the specified path.

    public virtual string[] ListFiles(string url, string searchPattern, VirtualSearchOption searchOption)
    Parameters
    Type Name Description
    System.String url
    System.String searchPattern

    The search pattern.

    VirtualSearchOption searchOption

    The search option.

    Returns
    Type Description
    System.String[]

    A list of files from the specified path


    OpenStream(String, VirtualFileMode, VirtualFileAccess, VirtualFileShare, StreamFlags)

    Opens a Stream from the specified path.

    public abstract Stream OpenStream(string url, VirtualFileMode mode, VirtualFileAccess access, VirtualFileShare share = VirtualFileShare.Read, StreamFlags streamFlags = StreamFlags.None)
    Parameters
    Type Name Description
    System.String url
    VirtualFileMode mode

    The mode.

    VirtualFileAccess access

    The access.

    VirtualFileShare share

    The process sharing mode.

    StreamFlags streamFlags

    The type of stream needed

    Returns
    Type Description
    System.IO.Stream

    The opened stream.


    ResolvePath(String)

    Resolves the path (can map virtual to absolute path).

    protected virtual string ResolvePath(string path)
    Parameters
    Type Name Description
    System.String path

    The path.

    Returns
    Type Description
    System.String

    The resolved path.


    TryGetFileLocation(String, out String, out Int64, out Int64)

    Gets the absolute path and location if the specified path physically exist on the disk in an uncompressed form (could be inside another file).

    public virtual bool TryGetFileLocation(string path, out string filePath, out long start, out long end)
    Parameters
    Type Name Description
    System.String path

    The path.

    System.String filePath

    The file containing the data.

    System.Int64 start

    The start offset in the file.

    System.Int64 end

    The end offset in the file (can be -1 if full file).

    Returns
    Type Description
    System.Boolean

    True if success, false if not supported and entry is found (note: even when true, the file might not actually exists).


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation