Skip to content

Class AuthoredAssets

Namespace: Apogee.Content.Assets
Assembly: Apogee.Content.dll

Assets that are written by people or tools as XML, rather than imported from another format: they carry their own UID, in the uid attribute of the document's root element (<Scene version="1" uid="uid://…">, <Prefab …>), and have no .import.xml. Scenes and prefabs now; materials add their extension to when they land.

public static class AuthoredAssets

Inheritance

object ← AuthoredAssets

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Extensions

The extensions of authored assets, with the dot, in lower case.

public static IReadOnlyList<string> Extensions { get; }

Property Value

IReadOnlyList<string>

Methods

IsAuthored(string)

Whether path names an authored asset (by its extension, not case-sensitive).

public static bool IsAuthored(string path)

Parameters

path string

Returns

bool

ReadUid(ReadOnlySpan<byte>)

The UID in the root of the document, or when there is none, it is not valid, or the bytes are not an XML document (a damaged file). It reads as far as the root's start tag and no further, so it is cheap on a big scene, and it never throws for bad content. A cooked document () is read the same way.

public static AssetUid ReadUid(ReadOnlySpan<byte> document)

Parameters

document ReadOnlySpan<byte>

Returns

AssetUid

ReadUid(Stream)

The UID in the root of the document in document (see ).

public static AssetUid ReadUid(Stream document)

Parameters

document Stream

Returns

AssetUid

SetUid(string, AssetUid)

The document's text with uid as the UID of its root: replaced in place or added after the last attribute of the root tag, with everything else exactly as it was (comments, indentation, quotes, line endings). Overwriting a scene keeps the UID of the file it replaces by calling this on the new text.

public static string SetUid(string text, AssetUid uid)

Parameters

text string

uid AssetUid

Returns

string

Exceptions

ContentException

The text is not an XML document the edit can be made in.