Show / Hide Table of Contents

Class AssetProvider

Asset provider for direct file access. Typically used in desktop builds where assets are simply contained within a subdirectory of the application.

Inheritance
System.Object
StreamAssetProvider
AssetProvider
Implements
IAssetProvider
Inherited Members
StreamAssetProvider.CanHandleType(Type)
StreamAssetProvider.GetAsset(String, Type)
StreamAssetProvider.GetAssetAsync(String, Type)
StreamAssetProvider.CanGet(String, Type)
StreamAssetProvider.CanGetAsync(String, Type)
StreamAssetProvider.BeginGetAsset(String, GetCallback)
StreamAssetProvider.RegisterTypeHandler(AssetHandler)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fusee.Base.Imp.Blazor
Assembly: Fusee.Base.Imp.Blazor.dll
Syntax
public class AssetProvider : StreamAssetProvider, IAssetProvider

Constructors

AssetProvider(IJSRuntime, String)

Initializes a new instance of the AssetProvider class.

Declaration
public AssetProvider(IJSRuntime runtime, string baseDir = null)
Parameters
Type Name Description
IJSRuntime runtime

The JSRuntime

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

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
StreamAssetProvider.CheckExists(String)
Exceptions
Type Condition
System.ArgumentNullException

CheckExistsAsync(String)

Checks the existence of the identified asset in an async manner

Declaration
protected override async Task<bool> CheckExistsAsync(string id)
Parameters
Type Name Description
System.String id

The asset identifier.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

true if a stream can be created.

Overrides
StreamAssetProvider.CheckExistsAsync(String)
Exceptions
Type Condition
System.ArgumentNullException

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
StreamAssetProvider.GetStream(String)
Exceptions
Type Condition
System.ArgumentNullException

GetStreamAsync(String)

Creates an async stream for the asset identified by id using System.IO.FileStream

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>

A valid stream for reading if the asset ca be retrieved. null otherwise.

Overrides
StreamAssetProvider.GetStreamAsync(String)
Exceptions
Type Condition
System.ArgumentNullException

Implements

IAssetProvider
Generated by DocFX
GitHub Repo
Back to top