AssetSourceExtensions class

Namespace Runic.Assets in Runic.Assets 0.23.0

public static class AssetSourceExtensions

Views of an IAssetSource.

Methods

Subdirectory

public static IAssetSource Subdirectory(this IAssetSource source, string path, string entryPoint = "index.html")

Presents one folder of source as a frontend of its own: its assets keep their content and metadata under paths relative to the folder, and entryPoint in the folder is the entry point.

Parameters

source

The source, such as an AssetArchiveSource that holds several frontends.

path

The folder, relative to the source, such as settings or windows/settings/.

entryPoint

The entry document, relative to the folder; index.html by default.

Returns

A source that serves the folder's assets at its root.

Exceptions

ArgumentNullException

An argument is null.

ArgumentException

path or entryPoint is not a safe relative asset path (AssetPath.Normalize).

DirectoryNotFoundException

No asset of source is in the folder.

FileNotFoundException

The folder has no entryPoint.

Remarks

The view takes the folder's assets from the manifest source has when it is created, and opens them through source. Create a new view after a live source, such as a DevelopmentDirectoryAssetSource, changes: an asset whose content changed since then fails to open with InvalidDataException. IAssetSource.ValidateAsync verifies the folder's assets only. Every host adapter serves the view as it serves any source, for example RunicDesktopHostOptions.Assets = archive.Subdirectory("settings").