API reference
Class ListedContentSource
Namespace: MicroEngine.Content
Assembly: MicroEngine.Content.dll
Guide: Assets
Content files a host lists and opens itself, where the files are not a folder .NET can read: an Android app’s packaged assets (opened through the platform’s asset manager), files a browser page fetched. The listing is fixed when the source is made; names follow the folder rules (exact letter case everywhere, ‘/’ separators).
public sealed class ListedContentSource : IContentSourceInheritance
Implements
Extension Methods
ContentSources.ReadAllBytes(IContentSource, string)
Constructors
ListedContentSource(string, IEnumerable<string>, Func<string, Stream>)
A source over files, read with open.
public ListedContentSource(string location, IEnumerable<string> files, Func<string, Stream> open)Parameters
location string
A description of where the files are, for messages.
files IEnumerable<string>
Every file, relative to the source with ‘/’ separators.
Opens one of files (given exactly as listed); called from any thread.
Exceptions
location is null, empty or white space.
Properties
Location
Where the files are (a folder’s absolute path, or a description), for diagnostics.
public string Location { get; }Property Value
Methods
Exists(string)
Whether a file exists at path. False for a missing file and for a path outside the source.
public bool Exists(string path)Parameters
path string
Returns
Files(string)
The files directly inside folder (“” for the top), as paths relative to the source, in ordinal order.
public IReadOnlyList<string> Files(string folder)Parameters
folder string
Returns
Exceptions
The folder does not exist.
Open(string)
Opens the file at path for reading; the caller disposes the stream.
public Stream Open(string path)Parameters
path string
Returns
Exceptions
The path leaves the source.
No such file, or its name is spelled with another letter case.