Class FileAssetProvider
Asset provider for direct file access. Typically used in desktop builds where assets are simply contained within a subdirectory of the application.
Implements
Inherited Members
Namespace: Fusee.Base.Imp.Desktop
Assembly: Fusee.Base.Imp.Desktop.dll
Syntax
public class FileAssetProvider : StreamAssetProvider, IAssetProvider
Constructors
FileAssetProvider(IEnumerable<String>)
Initializes a new instance of the FileAssetProvider class.
Declaration
public FileAssetProvider(IEnumerable<string> baseDirs = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | baseDirs | A list of base directories where assets should be looked for. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
FileAssetProvider(String)
Initializes a new instance of the FileAssetProvider class.
Declaration
public FileAssetProvider(string baseDir = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseDir | The base directory where assets should be looked for. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
Methods
CheckExists(String)
Checks the existence of the identified asset using System.IO.File.Exists(System.String)
Declaration
protected override bool CheckExists(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The asset identifier. |
Returns
Type | Description |
---|---|
System.Boolean | true if a stream can be created. |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
CheckExistsAsync(String)
Checks the existence of the identified asset as an async method.
Declaration
protected override Task<bool> CheckExistsAsync(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The asset identifier. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | Implementors should return true if a stream can be created. |
Overrides
GetStream(String)
Creates a stream for the asset identified by id using System.IO.FileStream
Declaration
protected override Stream GetStream(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The asset identifier. |
Returns
Type | Description |
---|---|
System.IO.Stream | A valid stream for reading if the asset ca be retrieved. null otherwise. |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
GetStreamAsync(String)
Create an async stream for the asset identified by id.
Declaration
protected override async Task<Stream> GetStreamAsync(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The asset identifier. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IO.Stream> | Implementors should return null if the asset cannot be retrieved. Otherwise returns a file stream to the asset. |