Table of Contents

Class AssetContext

Namespace
Icy.Assets
Assembly
IcyUI.dll

Represents context to load assets.

public record AssetContext : IAssetContext, IEquatable<AssetContext>
Inheritance
AssetContext
Implements
Inherited Members
Extension Methods

Constructors

AssetContext(string)

Initializes a new instance of the AssetContext class.

public AssetContext(string rootPath)

Parameters

rootPath string

Root path to create context to.

AssetContext(Uri)

Represents context to load assets.

public AssetContext(Uri RootPath)

Parameters

RootPath Uri

Properties

ApplicationContext

Gets an instance of the asset context that locates application domain directory.

public static AssetContext ApplicationContext { get; }

Property Value

AssetContext

RootPath

Gets the root path for this context.

public Uri RootPath { get; init; }

Property Value

Uri

Methods

Combine(string)

Combines the asset context instance with a relative path to produce a new local asset context.

public IAssetContext Combine(string relativePath)

Parameters

relativePath string

A relative path to create a new context for.

Returns

IAssetContext

New instance of the IAssetContext that refers to the combined path.

GetAbsolutePath(string?)

Gets the absolute path to the given relative path relative to this IAssetContext instance.

public string GetAbsolutePath(string? relativePath = null)

Parameters

relativePath string

A relative path to make absolute path for.

Returns

string

An absolute path for the specified path combination.

GetDataFormat(string?)

Tries to get data format of the resource specified by current asset context state.

public string? GetDataFormat(string? relativePath = null)

Parameters

relativePath string

A relative path to get the format for.

Returns

string

A string representing MIME-type for the specified Uri or null in case when format cannot be determined.

IsAvailable(string?)

Checks if the path represented by the given relative path exists.

public bool IsAvailable(string? relativePath = null)

Parameters

relativePath string

Relative path part for this context.

Returns

bool

true if the path exists; false otherwise.

OpenStream(string?)

Opens a stream to the specified relative path.

public Stream OpenStream(string? relativePath = null)

Parameters

relativePath string

Optional relative path to open the stream to.

Returns

Stream

An instance of the Stream to the specified asset.

OpenStreamAsync(string?)

Asynchronously opens a stream to the specified relative path.

public Task<Stream> OpenStreamAsync(string? relativePath = null)

Parameters

relativePath string

Optional relative path to open the stream to.

Returns

Task<Stream>

An asynchronous task that results to an instance of the Stream to the specified asset.