Skip to content

API reference

Class AssetLoadContext

Namespace: MicroEngine.Content
Assembly: MicroEngine.Content.dll
Guide: Assets

What a loader is asked to load, and the content it reads it from.

C#
public sealed class AssetLoadContext

Inheritance

object ← AssetLoadContext

Properties

Key

The asset asked for (kind, normalized path, options, variant).

C#
public AssetKey Key { get; }

Property Value

AssetKey

Options

The load settings, or null for the loader’s defaults.

C#
public object? Options { get; }

Property Value

object?

Path

The asset’s path in Source.

C#
public string Path { get; }

Property Value

string

Source

Where the files are.

C#
public IContentSource Source { get; }

Property Value

IContentSource

Methods

Files(string?)

The files directly inside folder (the asset’s own path when null), in ordinal order.

C#
public IReadOnlyList<string> Files(string? folder = null)

Parameters

folder string?

Returns

IReadOnlyList<string>

Exceptions

AssetLoadException

The folder is missing or outside the source.

ReadBytes(string?)

The whole file at path (the asset’s own path when null).

C#
public byte[] ReadBytes(string? path = null)

Parameters

path string?

Returns

byte[]

Exceptions

AssetLoadException

The file is missing, wrongly cased or outside the source; the message names this asset.