Table of Contents

Class VirtualFileProviderBase

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

Abstract base class for IVirtualFileProvider.

public abstract class VirtualFileProviderBase : IVirtualFileProvider, IDisposable
Inheritance
VirtualFileProviderBase
Implements
Derived
Extension Methods

Constructors

VirtualFileProviderBase(string)

protected VirtualFileProviderBase(string rootPath)

Parameters

rootPath string

Properties

RootPath

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

public string RootPath { get; }

Property Value

string

The root path.

Remarks

All path are relative to the root path.

Methods

CreateDirectory(string)

Creates all directories so that url exists.

public virtual void CreateDirectory(string url)

Parameters

url string

The URL.

DirectoryExists(string)

Determines whether the specified path points to an existing directory.

public virtual bool DirectoryExists(string url)

Parameters

url string

The path.

Returns

bool

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

FileDelete(string)

Deletes the specified file.

public virtual void FileDelete(string url)

Parameters

url string

The URL.

FileExists(string)

Determines whether the specified path points to an existing file.

public virtual bool FileExists(string url)

Parameters

url string

The path.

Returns

bool

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

sourceUrl string

The source URL.

destinationProvider IVirtualFileProvider

The destination provider.

destinationUrl string

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

sourceUrl string

The source URL of the file

destinationUrl string

The destination URL of the file

FileSize(string)

Returns the size of the specified file in bytes

public virtual long FileSize(string url)

Parameters

url string

The file or directory for which to obtain size

Returns

long

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

path string

The path local to this instance.

Returns

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

url string

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

Returns

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

url string
searchPattern string

The search string to match against the names of files in path. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.

searchOption VirtualSearchOption

One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.

Returns

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

url string
mode VirtualFileMode

The mode.

access VirtualFileAccess

The access.

share VirtualFileShare

The process sharing mode.

streamFlags StreamFlags

The type of stream needed

Returns

Stream

The opened stream.

ResolvePath(string)

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

protected virtual string ResolvePath(string path)

Parameters

path string

The path.

Returns

string

The resolved path.

TryGetFileLocation(string, out string, out long, out long)

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

path string

The path.

filePath string

The file containing the data.

start long

The start offset in the file.

end long

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

Returns

bool

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