IVirtualFileProvider Interface
Namespace: Stride.Core.IOAssembly: Stride.Core.IO.dll
A virtual file provider, that can returns a Stream for a given path.
public interface IVirtualFileProvider : IDisposable
Name | Description | |
---|---|---|
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) | Determines whether the specified path points to an existing directory. |
|
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. |
|
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). |
Properties
RootPath
Gets or sets the root path of this provider. See remarks.
string RootPath { get; }
Property Value
Type | Description |
---|---|
System.String | The root path. |
Remarks
All path are relative to the root path.
Methods
CreateDirectory(String)
Creates all directories so that url exists.
void CreateDirectory(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. |
DirectoryExists(String)
Determines whether the specified path points to an existing directory.
bool DirectoryExists(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The path. |
Returns
Type | Description |
---|---|
System.Boolean |
FileDelete(String)
Deletes the specified file.
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.
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.
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.
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
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.
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.
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.
string[] ListFiles(string path, string searchPattern, VirtualSearchOption searchOption)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path. |
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.
Stream OpenStream(string path, VirtualFileMode mode, VirtualFileAccess access, VirtualFileShare share = VirtualFileShare.Read, StreamFlags streamFlags = StreamFlags.None)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path. |
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. |
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).
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). |