Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.Editor.ThemeFolderAssetService Class Reference

Editor-only copying of theme source folders and their appearance assets. More...

Static Public Member Functions

static void Cleanup (List< string > created)
 Deletes only paths created by a failed operation, deepest first.
static WindowFrameTheme CopyTheme (WindowFrameThemeData themeData, string sourceThemeId, string destinationFolderPath)
 Copies a theme identified by stable ID and registers its independent copy without any Studio instance.
static string CreateFolder (string parent, string name)
 Creates an unused child folder underneath an existing project Resources folder.
static string Duplicate (string sourceEntry, string destination)
 Copies one complete theme folder and rebases its own asset references.
static UnityEngine.Object OwnAsset (UnityEngine.Object asset, string folder, string subfolder, List< string > created)
 Copies a borrowed image into the theme and returns the independent object.
static string OwnReferences (string text, string origin, string folder, List< string > created)
 Rewrites source artwork references to owned images, copying external images as needed.
static string ResourcePath (string path)
 Returns the Resources key for a project asset, preserving folder identity.

Static Private Member Functions

static UnityEngine.Object CopyPreview (UnityEngine.Object asset, string sourceFolder, string destination, List< string > created)
static bool Equal (byte[] first, byte[] second)
static string Expression (string kind, string path, string quote)
static string Normalize (string path)
static string Resolve (string origin, string kind, string reference)
static string ValidateFolder (string path)
static void WriteSource (string path, string text)

Static Private Attributes

static readonly Regex Reference = new Regex(@"(?<kind>resource|url)\‍(\s*(?<quote>['""'])(?<path>[^'""']+)\k<quote>\s*\‍)", RegexOptions.Compiled)

Detailed Description

Editor-only copying of theme source folders and their appearance assets.

Never copies the shared Resources parent as a theme. Source assets are borrowed, copies have independent GUIDs, and existing destinations are never overwritten. Shared application sheets remain the collection's responsibility. Loose player files are not handled.

Member Function Documentation

◆ Cleanup()

void GWG.WindowFramework.Editor.ThemeFolderAssetService.Cleanup ( List< string > created)
inlinestatic

Deletes only paths created by a failed operation, deepest first.

Here is the caller graph for this function:

◆ CopyPreview()

UnityEngine.Object GWG.WindowFramework.Editor.ThemeFolderAssetService.CopyPreview ( UnityEngine.Object asset,
string sourceFolder,
string destination,
List< string > created )
inlinestaticprivate
Here is the caller graph for this function:

◆ CopyTheme()

WindowFrameTheme GWG.WindowFramework.Editor.ThemeFolderAssetService.CopyTheme ( WindowFrameThemeData themeData,
string sourceThemeId,
string destinationFolderPath )
inlinestatic

Copies a theme identified by stable ID and registers its independent copy without any Studio instance.

Parameters
themeDataPublic collection containing the source and receiving the copy.
sourceThemeIdExact public WindowFrameTheme.StableId; names and indices are not identity.
destinationFolderPathFull unused project-relative Assets/.../Resources/... theme folder. Parent must exist.
Returns
The newly registered theme with a new stable ID and isDefault=false; internal assets refer to their copies and external artwork/display-image references remain unchanged.
Exceptions
ArgumentNullExceptionCollection is null.
ArgumentExceptionID/path is empty or path is invalid, absolute, traversing or inside the source.
InvalidOperationExceptionID is missing/ambiguous or source has no project entry stylesheet.
IOExceptionDestination exists or copy/import/dependency processing fails.

Editor-only trusted project authoring. Does not instantiate Studio, change editing/runtime selection, change defaults, or execute loose player files. Preserves source composition metadata; shared application styles remain collection-owned. Saves dirty collection metadata and returns the added record. Errors propagate without dialogs or automatic renaming. Failed operations remove their created folder/entry; original source and existing destination assets are never overwritten. Caller controls any subsequent selection/UI refresh. Filesystem/process crashes are not atomic.

// themeData is the asset reference owned by your editor tool.
string sourceId = sourceTheme.StableId;
themeData, sourceId, "Assets/MyUI/Resources/Themes/MyCopy");
string newId = copy.StableId;
Editor-only copying of theme source folders and their appearance assets.
Definition ThemeFolderAssetService.cs:15
static WindowFrameTheme CopyTheme(WindowFrameThemeData themeData, string sourceThemeId, string destinationFolderPath)
Copies a theme identified by stable ID and registers its independent copy without any Studio instance...
Definition ThemeFolderAssetService.cs:41
Represents an individual theme definition within the Window Framework. Encapsulates theme metadata,...
Definition WindowFrameTheme.cs:17
string StableId
Gets persistent theme identity independent of display name and ordering.
Definition WindowFrameTheme.cs:22
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateFolder()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.CreateFolder ( string parent,
string name )
inlinestatic

Creates an unused child folder underneath an existing project Resources folder.

Parameters
parentProject-relative existing parent.
nameRequested single folder name.
Returns
New project-relative folder path.
Exceptions
IOExceptionInvalid location, name, or existing destination.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Duplicate()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.Duplicate ( string sourceEntry,
string destination )
inlinestatic

Copies one complete theme folder and rebases its own asset references.

Parameters
sourceEntryEntry TSS in the independently owned source folder.
destinationUnused sibling/different project Resources folder path.
Returns
Copied entry path, ready for registration after import.
Exceptions
IOExceptionCopy, import, internal-reference remapping, or path validation fails.

Failure removes only the created copy. Source bytes are checked before success. References outside the source folder are preserved, not copied or rejected for ownership. No catalog entries are modified here. Existing application stylesheet composition is not copied.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Equal()

bool GWG.WindowFramework.Editor.ThemeFolderAssetService.Equal ( byte[] first,
byte[] second )
inlinestaticprivate
Here is the caller graph for this function:

◆ Expression()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.Expression ( string kind,
string path,
string quote )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Normalize()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.Normalize ( string path)
inlinestaticprivate
Here is the caller graph for this function:

◆ OwnAsset()

UnityEngine.Object GWG.WindowFramework.Editor.ThemeFolderAssetService.OwnAsset ( UnityEngine.Object asset,
string folder,
string subfolder,
List< string > created )
inlinestatic

Copies a borrowed image into the theme and returns the independent object.

Parameters
assetBorrowed raster/vector image, or null for an explicitly empty role.
folderOwned theme folder under Resources.
subfolderIcons, Cursors, or Preview.
createdOperation-owned paths for cleanup if the caller's save fails.
Returns
Owned copy, existing owned object, or null.
Exceptions
IOExceptionUnsupported type or failed copy/import.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OwnReferences()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.OwnReferences ( string text,
string origin,
string folder,
List< string > created )
inlinestatic

Rewrites source artwork references to owned images, copying external images as needed.

Parameters
textComplete source text, with developer content preserved.
originOriginal stylesheet path for relative references.
folderDestination theme folder.
createdCreated paths for caller rollback.
Returns
Source text with only reference expressions updated.

Imports are preserved when already local. External source imports are refused, not silently shared.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Resolve()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.Resolve ( string origin,
string kind,
string reference )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResourcePath()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.ResourcePath ( string path)
inlinestatic

Returns the Resources key for a project asset, preserving folder identity.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidateFolder()

string GWG.WindowFramework.Editor.ThemeFolderAssetService.ValidateFolder ( string path)
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteSource()

void GWG.WindowFramework.Editor.ThemeFolderAssetService.WriteSource ( string path,
string text )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ Reference

readonly Regex GWG.WindowFramework.Editor.ThemeFolderAssetService.Reference = new Regex(@"(?<kind>resource|url)\‍(\s*(?<quote>['""'])(?<path>[^'""']+)\k<quote>\s*\‍)", RegexOptions.Compiled)
staticprivate