Skip to content

PlatformAPI reference

Interface IContentSource

Namespace: MicroEngine.Platform
Assembly: MicroEngine.Platform.dll
Guide: The platform host

Where a game’s content files come from: a folder next to the executable, a phone’s unpacked package, later an archive or a browser’s fetch. Paths are relative to the source with ‘/’ separators and match the stored name’s letter case exactly on every system.

C#
public interface IContentSource

Properties

Location

Where the files are (a folder’s absolute path, or a description), for diagnostics.

C#
string Location { get; }

Property Value

string

Methods

Exists(string)

Whether a file exists at path. False for a missing file and for a path outside the source.

C#
bool Exists(string path)

Parameters

path string

Returns

bool

Files(string)

The files directly inside folder (“” for the top), as paths relative to the source, in ordinal order.

C#
IReadOnlyList<string> Files(string folder)

Parameters

folder string

Returns

IReadOnlyList<string>

Exceptions

DirectoryNotFoundException

The folder does not exist.

Open(string)

Opens the file at path for reading; the caller disposes the stream.

C#
Stream Open(string path)

Parameters

path string

Returns

Stream

Exceptions

ArgumentException

The path leaves the source.

FileNotFoundException

No such file, or its name is spelled with another letter case.