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
rootPathstringRoot path to create context to.
AssetContext(Uri)
Represents context to load assets.
public AssetContext(Uri RootPath)
Parameters
RootPathUri
Properties
ApplicationContext
Gets an instance of the asset context that locates application domain directory.
public static AssetContext ApplicationContext { get; }
Property Value
RootPath
Gets the root path for this context.
public Uri RootPath { get; init; }
Property Value
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
relativePathstringA 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
relativePathstringA 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
relativePathstringA 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
relativePathstringRelative path part for this context.
Returns
OpenStream(string?)
Opens a stream to the specified relative path.
public Stream OpenStream(string? relativePath = null)
Parameters
relativePathstringOptional relative path to open the stream to.
Returns
OpenStreamAsync(string?)
Asynchronously opens a stream to the specified relative path.
public Task<Stream> OpenStreamAsync(string? relativePath = null)
Parameters
relativePathstringOptional relative path to open the stream to.