FileSystemProvider Class
Namespace: Stride.Core.IOAssembly: Stride.Core.IO.dll
A file system implementation for IVirtualFileProvider.
public class FileSystemProvider : VirtualFileProviderBase, IVirtualFileProvider, IDisposable
| Name | Description | |
|---|---|---|
| Constructors | ||
| FileSystemProvider(String, String) | Initializes a new instance of the FileSystemProvider class with the given base path. |
|
| Fields | ||
| AltDirectorySeparatorChar | ||
| DirectorySeparatorChar | ||
| VolumeSeparatorChar | ||
| Methods | ||
| ChangeBasePath(String) | ||
| ConvertFullPathToUrl(String) | ||
| ConvertUrlToFullPath(String) | ||
| CreateDirectory(String) | Creates all directories so that url exists. |
|
| DirectoryExists(String) | ||
| 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) | ||
| GetAbsolutePath(String) | ||
| GetLastWriteTime(String) | ||
| 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). |
|
Constructors
FileSystemProvider(String, String)
Initializes a new instance of the FileSystemProvider class with the given base path.
public FileSystemProvider(string rootPath, string localBasePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | rootPath | The root path of this provider. |
| System.String | localBasePath | The path to a local directory where this instance will load the files from. |
Fields
AltDirectorySeparatorChar
public static readonly char AltDirectorySeparatorChar
Field Value
| Type | Description |
|---|---|
| System.Char |
DirectorySeparatorChar
public static readonly char DirectorySeparatorChar
Field Value
| Type | Description |
|---|---|
| System.Char |
VolumeSeparatorChar
public static readonly char VolumeSeparatorChar
Field Value
| Type | Description |
|---|---|
| System.Char |
Methods
ChangeBasePath(String)
public void ChangeBasePath(string basePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | basePath |
ConvertFullPathToUrl(String)
protected virtual string ConvertFullPathToUrl(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path |
Returns
| Type | Description |
|---|---|
| System.String |
ConvertUrlToFullPath(String)
protected virtual string ConvertUrlToFullPath(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url |
Returns
| Type | Description |
|---|---|
| System.String |
CreateDirectory(String)
Creates all directories so that url exists.
public override void CreateDirectory(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url | The URL. |
Overrides
DirectoryExists(String)
public override bool DirectoryExists(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
FileDelete(String)
Deletes the specified file.
public override void FileDelete(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url | The URL. |
Overrides
FileExists(String)
Determines whether the specified path points to an existing file.
public override bool FileExists(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url | The path. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
FileSize(String)
public override long FileSize(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url |
Returns
| Type | Description |
|---|---|
| System.Int64 |
Overrides
GetAbsolutePath(String)
public override string GetAbsolutePath(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path |
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
GetLastWriteTime(String)
public override DateTime GetLastWriteTime(string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url |
Returns
| Type | Description |
|---|---|
| System.DateTime |
Overrides
ListFiles(String, String, VirtualSearchOption)
Returns the list of files from the specified path.
public override 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 |
Overrides
OpenStream(String, VirtualFileMode, VirtualFileAccess, VirtualFileShare, StreamFlags)
Opens a Stream from the specified path.
public override 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. |
Overrides
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 override 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). |