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

Defines explicit source ownership for editable USS and TSS theme files. More...

Static Public Member Functions

static string Create (string content)
 Wraps newly generated content in explicit ownership markers.
static string RebaseLocalReferences (string source, string originPath, string companionSource=null, string companionTarget=null)
 Rebases quoted local URL references for a source copied to another folder.
static bool TryAdopt (string source, int firstLine, int lastLine, out string adoptedSource, out string error)
 Marks an explicitly selected range of whole lines as framework-owned.
static bool TryReplace (string source, string generatedContent, out string updatedSource, out string error)
 Replaces only a validated generated region; never writes files itself.
static bool TryUpdateSettings (string source, string editedSettings, out string updatedSource, out string error)
 Updates explicitly supplied root settings in place without requiring manual ownership adoption.

Static Public Attributes

const string DeveloperBegin = "/* WFW:BEGIN DEVELOPER */"
 Exact optional opening marker for purchaser-owned source.
const string DeveloperEnd = "/* WFW:END DEVELOPER */"
 Exact optional closing marker for purchaser-owned source.
const string GeneratedBegin = "/* WFW:BEGIN GENERATED */"
 Exact opening marker for framework-owned source.
const string GeneratedEnd = "/* WFW:END GENERATED */"
 Exact closing marker for framework-owned source.

Static Private Member Functions

static bool ContainsMarker (string text)
static bool TryLocate (string source, string marker, out int index)

Detailed Description

Defines explicit source ownership for editable USS and TSS theme files.

Current Save uses TryUpdateSettings to update supplied root declarations in place without manual line-range adoption. TryReplace and TryAdopt remain explicit marker-region helpers with different prerequisites; their presence does not imply a required ownership window. Methods return text only and do not save/import files or enable player stylesheet execution. Use transactional writing after validation and preserve ambiguous developer source.

Member Function Documentation

◆ ContainsMarker()

bool GWG.WindowFramework.Editor.ThemeSourceRegions.ContainsMarker ( string text)
inlinestaticprivate
Here is the caller graph for this function:

◆ Create()

string GWG.WindowFramework.Editor.ThemeSourceRegions.Create ( string content)
inlinestatic

Wraps newly generated content in explicit ownership markers.

Parameters
contentFramework-owned stylesheet text, without ownership markers.
Returns
A marked source file with an empty developer region.
Exceptions
ArgumentNullExceptionContent is null.
ArgumentExceptionContent contains reserved ownership markers.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RebaseLocalReferences()

string GWG.WindowFramework.Editor.ThemeSourceRegions.RebaseLocalReferences ( string source,
string originPath,
string companionSource = null,
string companionTarget = null )
inlinestatic

Rebases quoted local URL references for a source copied to another folder.

Parameters
sourceOriginal source content.
originPathOriginal source asset path.
companionSourceOptional source settings filename replaced by the new companion.
companionTargetNew settings filename in the destination folder.
Returns
Text with local references made origin-independent; resources/external schemes retained.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TryAdopt()

bool GWG.WindowFramework.Editor.ThemeSourceRegions.TryAdopt ( string source,
int firstLine,
int lastLine,
out string adoptedSource,
out string error )
inlinestatic

Marks an explicitly selected range of whole lines as framework-owned.

Parameters
sourceUnmarked original source.
firstLineFirst framework-owned line, one-based and inclusive.
lastLineLast framework-owned line, one-based and inclusive.
adoptedSourceMarked text on success; original text otherwise.
errorValidation message, or null on success.
Returns
True when the exact developer-selected range can be marked safely.

Does not infer ownership from names or parse CSS. Callers must show the selected range for developer confirmation, preserve an original backup, and commit safely. All original characters are retained; only marker lines and a necessary terminal newline are inserted. Existing markers require repair, not another adoption.

Here is the call graph for this function:

◆ TryLocate()

bool GWG.WindowFramework.Editor.ThemeSourceRegions.TryLocate ( string source,
string marker,
out int index )
inlinestaticprivate
Here is the caller graph for this function:

◆ TryReplace()

bool GWG.WindowFramework.Editor.ThemeSourceRegions.TryReplace ( string source,
string generatedContent,
out string updatedSource,
out string error )
inlinestatic

Replaces only a validated generated region; never writes files itself.

Parameters
sourceOriginal complete source text.
generatedContentNew framework content without markers.
updatedSourceUpdated text on success; original text on failure.
errorActionable validation message, or null on success.
Returns
True only when ownership boundaries are complete and unambiguous.

Rejects unmarked, duplicate, incomplete, nested, or reversed boundaries. Preserves all exterior text, developer content and original line-ending style. Caller must validate before performing a transactional file write. Marker lines must stand alone.

if (ThemeSourceRegions.TryReplace(source, generated, out var updated, out var error))
{
// Save updated transactionally; exterior developer text is unchanged.
}
else { UnityEngine.Debug.LogWarning(error); }
Defines explicit source ownership for editable USS and TSS theme files.
Definition ThemeSourceRegions.cs:14
static bool TryReplace(string source, string generatedContent, out string updatedSource, out string error)
Replaces only a validated generated region; never writes files itself.
Definition ThemeSourceRegions.cs:54
Here is the call graph for this function:

◆ TryUpdateSettings()

bool GWG.WindowFramework.Editor.ThemeSourceRegions.TryUpdateSettings ( string source,
string editedSettings,
out string updatedSource,
out string error )
inlinestatic

Updates explicitly supplied root settings in place without requiring manual ownership adoption.

Parameters
sourceComplete original source including developer selectors/imports.
editedSettingsRoot declarations emitted by the known framework inspector.
updatedSourceUpdated text, or original on refusal.
errorSpecific structural failure.
Returns
True when root settings can be updated without moving developer content.

Only known supplied property names in :root blocks are edited. Other declarations, comments, imports and selectors remain byte-for-byte text and in original order. Scoped overrides are never converted to root settings. Missing edited keys are inserted in the last existing root block; no new import is introduced. Caller uses transactional writes.

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

Field Documentation

◆ DeveloperBegin

const string GWG.WindowFramework.Editor.ThemeSourceRegions.DeveloperBegin = "/* WFW:BEGIN DEVELOPER */"
static

Exact optional opening marker for purchaser-owned source.

◆ DeveloperEnd

const string GWG.WindowFramework.Editor.ThemeSourceRegions.DeveloperEnd = "/* WFW:END DEVELOPER */"
static

Exact optional closing marker for purchaser-owned source.

◆ GeneratedBegin

const string GWG.WindowFramework.Editor.ThemeSourceRegions.GeneratedBegin = "/* WFW:BEGIN GENERATED */"
static

Exact opening marker for framework-owned source.

◆ GeneratedEnd

const string GWG.WindowFramework.Editor.ThemeSourceRegions.GeneratedEnd = "/* WFW:END GENERATED */"
static

Exact closing marker for framework-owned source.