Class AssetItem
Class representing an asset item. It manages all the files of an asset (its metafile and its source file or directory) and offers a unified set of methods.
Inherited Members
Namespace: Evergine.Assets.Exporters
Assembly: Evergine.Assets.dll
Syntax
public class AssetItem
Constructors
AssetItem(ContentFile, IAssetWithDirectory, IAssetMetaFile)
Initializes a new instance of the AssetItem class.
Declaration
public AssetItem(ContentFile file, IAssetWithDirectory parent, IAssetMetaFile asset)
Parameters
Type | Name | Description |
---|---|---|
ContentFile | file | The content file of the .winfo. |
IAssetWithDirectory | parent | The parent directory asset. |
IAssetMetaFile | asset | The asset. |
Properties
Asset
Gets or sets the asset info of the item.
Declaration
public IAssetMetaFile Asset { get; set; }
Property Value
Type | Description |
---|---|
IAssetMetaFile |
Id
Gets the asset Id.
Declaration
public Guid Id { get; }
Property Value
Type | Description |
---|---|
Guid |
MetaFile
Gets the file location of the .winfo file.
Declaration
public ContentFile MetaFile { get; }
Property Value
Type | Description |
---|---|
ContentFile |
Name
Gets the name of the asset without the (.winfo) extension. For example: texture.jpg.wtex => texture.jpg.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
ParentDirectory
Gets the parent directory.
Declaration
public IAssetWithDirectory ParentDirectory { get; }
Property Value
Type | Description |
---|---|
IAssetWithDirectory |
Type
Gets the type of the asset.
Declaration
public Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
Delete()
Deletes the asset.
Declaration
public Task Delete()
Returns
Type | Description |
---|---|
Task | Awaitable task for the operation. |
Export(ExportContext)
Exports the asset into a directory.
Declaration
public Task<ExportResult> Export(ExportContext exportContext)
Parameters
Type | Name | Description |
---|---|---|
ExportContext | exportContext | The export context. |
Returns
Type | Description |
---|---|
Task<ExportResult> | Awaitable task returning the export result. |
Save()
Saves the asset.
Declaration
public Task Save()
Returns
Type | Description |
---|---|
Task | Awaitable task for the operation. |
SetName(string)
Sets the asset name.
Declaration
public bool SetName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The new name. |
Returns
Type | Description |
---|---|
bool | True if the name could be changed. |