Skip to main content

StandardAssetLoader Class

Definition

Assembly:Avalonia.Base
Package:Avalonia

Loads assets compiled into the application binary.

public class StandardAssetLoader

Inheritance: object -> StandardAssetLoader

Implements:IAssetLoader

Constructors

NameDescription
StandardAssetLoaderNo summary available.

StandardAssetLoader Constructor

public StandardAssetLoader(System.Reflection.Assembly assembly)

Parameters

assembly System.Reflection.Assembly

Methods

NameDescription
ExistsChecks if an asset with the specified URI exists.
GetAssemblyNo summary available.
GetAssetsGets all assets of a folder and subfolders that match specified uri.
InvalidateAssemblyCache (2 overloads)No summary available.
OpenOpens the asset with the requested URI.
OpenAndGetAssemblyOpens the asset with the requested URI and returns the asset stream and the assembly containing the asset.
RegisterResUriParsersNo summary available.
SetDefaultAssemblySets the default assembly from which to load assets for which no assembly is specified.

Exists Method

Checks if an asset with the specified URI exists.

public bool Exists(Uri uri, Uri baseUri)

Parameters

uri Uri

The URI.

baseUri Uri

A base URI to use if uri is relative.

Returns

bool

True if the asset could be found; otherwise false.

GetAssembly Method

public System.Reflection.Assembly GetAssembly(Uri uri, Uri baseUri)

Parameters

uri Uri

baseUri Uri

Returns

System.Reflection.Assembly

GetAssets Method

Gets all assets of a folder and subfolders that match specified uri.

public System.Collections.Generic.IEnumerable<Uri> GetAssets(Uri uri, Uri baseUri)

Parameters

uri Uri

The URI.

baseUri Uri

Base URI that is used if uri is relative.

Returns

System.Collections.Generic.IEnumerable<Uri>

All matching assets as a tuple of the absolute path to the asset and the assembly containing the asset

InvalidateAssemblyCache overloads

InvalidateAssemblyCache Method

public void InvalidateAssemblyCache()

InvalidateAssemblyCache Method

public void InvalidateAssemblyCache(string name)
Parameters

name string

Open Method

Opens the asset with the requested URI.

public System.IO.Stream Open(Uri uri, Uri baseUri)

Parameters

uri Uri

The URI.

baseUri Uri

A base URI to use if uri is relative.

Returns

System.IO.Stream

A stream containing the asset contents.

Exceptions

OpenAndGetAssembly Method

Opens the asset with the requested URI and returns the asset stream and the assembly containing the asset.

public ValueTuple<System.IO.Stream, System.Reflection.Assembly> OpenAndGetAssembly(Uri uri, Uri baseUri)

Parameters

uri Uri

The URI.

baseUri Uri

A base URI to use if uri is relative.

Returns

ValueTuple<System.IO.Stream, System.Reflection.Assembly>

The stream containing the resource contents together with the assembly.

Exceptions

RegisterResUriParsers Method

public void RegisterResUriParsers()

SetDefaultAssembly Method

Sets the default assembly from which to load assets for which no assembly is specified.

public void SetDefaultAssembly(System.Reflection.Assembly assembly)

Parameters

assembly System.Reflection.Assembly

The default assembly.