Class SerenityRecipeExportContext
Shared state for an export run: the scan root (which becomes the recipe's outputRoot), the recipe
being built, the report, and a running count of exported assets. Provides asset-scanning and
id/output-resolution helpers so section exporters stay small.
Inherited Members
Namespace: Serenity.ProjectRecipe.Infrastructure.Editor.Exporters
Assembly: Serenity.UnityProjectRecipe.Infrastructure.Editor.dll
Syntax
public sealed class SerenityRecipeExportContext
Constructors
SerenityRecipeExportContext(string, SerenityRecipe, SerenityRecipeReport)
Creates the export context.
Declaration
public SerenityRecipeExportContext(string scanRoot, SerenityRecipe recipe, SerenityRecipeReport report)
Parameters
| Type | Name | Description |
|---|---|---|
| string | scanRoot | |
| SerenityRecipe | recipe | |
| SerenityRecipeReport | report |
Properties
Exported
Declaration
public int Exported { get; }
Property Value
| Type | Description |
|---|---|
| int | Number of assets exported so far. |
Recipe
Declaration
public SerenityRecipe Recipe { get; }
Property Value
| Type | Description |
|---|---|
| SerenityRecipe | The recipe being assembled. |
Report
Declaration
public SerenityRecipeReport Report { get; }
Property Value
| Type | Description |
|---|---|
| SerenityRecipeReport | The accumulating report. |
ScanRoot
Declaration
public string ScanRoot { get; }
Property Value
| Type | Description |
|---|---|
| string | The normalised project folder being scanned; also the recipe's |
Methods
FindAssets<T>()
Loads every asset of type T under the scan root.
Declaration
public List<(T asset, string path)> FindAssets<T>() where T : ScriptableObject
Returns
| Type | Description |
|---|---|
| List<(T asset, string path)> | The loaded assets paired with their project paths. |
Type Parameters
| Name | Description |
|---|---|
| T | The ScriptableObject type to find. |
MarkExported(string, string, string)
Records that an asset was exported (count + info message).
Declaration
public void MarkExported(string section, string id, string output)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The section. |
| string | id | The recipe id. |
| string | output | The relative output path. |
ResolveId(string, string, string)
Returns a usable recipe id for an asset: its Id when set, otherwise the file name (with a
warning, since recipe ids should be authored deliberately).
Declaration
public string ResolveId(string section, string id, string assetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | section | The section, for reporting. |
| string | id | The asset's stored id. |
| string | assetPath | The asset's project path. |
Returns
| Type | Description |
|---|---|
| string | A non-empty id. |
ResolveOutput(string)
Computes the recipe output (relative to the scan root) for an asset path.
Declaration
public string ResolveOutput(string assetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetPath | The asset's project path. |
Returns
| Type | Description |
|---|---|
| string | The relative output path. |