Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.Theming.PlayerThemeFolder Class Referencesealed

Owns a completely validated manifest and decoded raster assets from one player folder. More...

Inheritance diagram for GWG.WindowFramework.Theming.PlayerThemeFolder:
Collaboration diagram for GWG.WindowFramework.Theming.PlayerThemeFolder:

Public Member Functions

void Dispose ()
 Releases owned textures exactly once; caller must release UI references first.

Static Public Member Functions

static string EnsureDirectory (string directory)
 Creates only the configured root after validating its existing parent and every ancestor.
static string SafeAssetPath (string folder, string relative)
 Resolves a contained relative asset path, rejecting reparse points at every parent.
static bool TryLoad (string themesRoot, string folderName, out PlayerThemeFolder theme, out string error)
 Validates and decodes one immediate theme subfolder transactionally.
static bool TryLoad (string themesRoot, string folderName, PlayerThemeExtensionRegistry extensions, out PlayerThemeFolder theme, out string error)
 Loads declared compiled-extension images using the same transaction and image budgets.
static void ValidateDirectory (string directory)
 Checks an existing directory and all ancestors before export writes.

Properties

long DecodedBytes [get, private set]
 Gets aggregate decoded RGBA payload bytes for owned images (excluding driver overhead).
string DirectoryPath [get, private set]
 Gets canonical folder location.
bool IsDisposed [get, private set]
 Gets whether owned resources have been released.
PlayerThemeManifest Manifest [get, private set]
 Gets validated data, with images supplied to its resolved value model.
Texture2D Preview [get, private set]
 Optional decoded list preview. Borrow only until this folder is disposed; never destroy it from UI.

Static Private Member Functions

static void CheckContainment (string folder, string path)
static byte[] ReadBounded (string path, int? maximum=null)
static void ReadDimensions (byte[] bytes, string extension, out int width, out int height)
static void RejectLinks (string path)

Private Attributes

readonly List< Texture2D > _textures = new List<Texture2D>()

Detailed Description

Owns a completely validated manifest and decoded raster assets from one player folder.

Rejects traversal and reparse points, checks encoded/header limits before native decode and cleans partial results. Dispose only after every UI binding releases references. Concurrent filesystem replacement between checks and open remains a platform limitation; native image decoders must be kept current with supported Unity versions.

Member Function Documentation

◆ CheckContainment()

void GWG.WindowFramework.Theming.PlayerThemeFolder.CheckContainment ( string folder,
string path )
inlinestaticprivate
Here is the caller graph for this function:

◆ Dispose()

void GWG.WindowFramework.Theming.PlayerThemeFolder.Dispose ( )
inline

Releases owned textures exactly once; caller must release UI references first.

◆ EnsureDirectory()

string GWG.WindowFramework.Theming.PlayerThemeFolder.EnsureDirectory ( string directory)
inlinestatic

Creates only the configured root after validating its existing parent and every ancestor.

Parameters
directoryAbsolute configured local root; its parent must already exist.
Returns
Canonical validated root, suitable for subsequent importer/exporter checks.

Does not create arbitrary missing ancestor trees or permit linked/reparse ancestors. Validates again after creation. Existing directories are retained; no source/theme files are changed. Concurrent filesystem replacement between validation and creation remains a platform limitation, so callers must revalidate at file access.

Exceptions
IOExceptionUnsafe root, missing/non-directory parent, file collision or linked ancestor.
UnauthorizedAccessExceptionStorage permissions deny inspection or creation.
string root = PlayerThemeFolder.EnsureDirectory(Path.Combine(Application.persistentDataPath, themeData.PlayerThemesFolderName));
Owns a completely validated manifest and decoded raster assets from one player folder.
Definition PlayerThemeFolder.cs:15
static string EnsureDirectory(string directory)
Creates only the configured root after validating its existing parent and every ancestor.
Definition PlayerThemeFolder.cs:197
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBounded()

byte[] GWG.WindowFramework.Theming.PlayerThemeFolder.ReadBounded ( string path,
int? maximum = null )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadDimensions()

void GWG.WindowFramework.Theming.PlayerThemeFolder.ReadDimensions ( byte[] bytes,
string extension,
out int width,
out int height )
inlinestaticprivate
Here is the caller graph for this function:

◆ RejectLinks()

void GWG.WindowFramework.Theming.PlayerThemeFolder.RejectLinks ( string path)
inlinestaticprivate
Here is the caller graph for this function:

◆ SafeAssetPath()

string GWG.WindowFramework.Theming.PlayerThemeFolder.SafeAssetPath ( string folder,
string relative )
inlinestatic

Resolves a contained relative asset path, rejecting reparse points at every parent.

Parameters
folderCanonical validated theme directory.
relativeSlash-separated relative path.
Returns
Canonical contained path.
Exceptions
IOExceptionUnsafe path/link.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TryLoad() [1/2]

bool GWG.WindowFramework.Theming.PlayerThemeFolder.TryLoad ( string themesRoot,
string folderName,
out PlayerThemeFolder theme,
out string error )
inlinestatic

Validates and decodes one immediate theme subfolder transactionally.

Parameters
themesRootConfigured root directory.
folderNameSingle safe child directory name.
themeComplete owned result, or null.
errorBounded diagnostic.
Returns
True for a structurally safe loaded theme, including reported missing/corrupt image omissions. Inspect Manifest.Issues; true does not imply every declared image decoded.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TryLoad() [2/2]

bool GWG.WindowFramework.Theming.PlayerThemeFolder.TryLoad ( string themesRoot,
string folderName,
PlayerThemeExtensionRegistry extensions,
out PlayerThemeFolder theme,
out string error )
inlinestatic

Loads declared compiled-extension images using the same transaction and image budgets.

Parameters
themesRootConfigured root.
folderNameImmediate child folder.
extensionsRegistered compiled handlers; unknown sections acquire no assets.
themeOwned result.
errorBounded failure.
Returns
True for a safely loaded theme, including reported recoverable image omissions.
Here is the call graph for this function:

◆ ValidateDirectory()

void GWG.WindowFramework.Theming.PlayerThemeFolder.ValidateDirectory ( string directory)
inlinestatic

Checks an existing directory and all ancestors before export writes.

Parameters
directoryExisting directory to validate.
Exceptions
IOExceptionDirectory is missing or any ancestor is a reparse point.
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ _textures

readonly List<Texture2D> GWG.WindowFramework.Theming.PlayerThemeFolder._textures = new List<Texture2D>()
private

Property Documentation

◆ DecodedBytes

long GWG.WindowFramework.Theming.PlayerThemeFolder.DecodedBytes
getprivate set

Gets aggregate decoded RGBA payload bytes for owned images (excluding driver overhead).

◆ DirectoryPath

string GWG.WindowFramework.Theming.PlayerThemeFolder.DirectoryPath
getprivate set

Gets canonical folder location.

◆ IsDisposed

bool GWG.WindowFramework.Theming.PlayerThemeFolder.IsDisposed
getprivate set

Gets whether owned resources have been released.

◆ Manifest

PlayerThemeManifest GWG.WindowFramework.Theming.PlayerThemeFolder.Manifest
getprivate set

Gets validated data, with images supplied to its resolved value model.

◆ Preview

Texture2D GWG.WindowFramework.Theming.PlayerThemeFolder.Preview
getprivate set

Optional decoded list preview. Borrow only until this folder is disposed; never destroy it from UI.