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.
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 information 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 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
DeleteAsync()
Deletes the asset.
Declaration
public Task DeleteAsync()
Returns
Type | Description |
---|---|
Task | Asynchronous task for the operation. |
ExportAsync(ExportContext)
Exports the asset to a directory.
Declaration
public Task<ExportResult> ExportAsync(ExportContext exportContext)
Parameters
Type | Name | Description |
---|---|---|
ExportContext | exportContext | The export context. |
Returns
Type | Description |
---|---|
Task<ExportResult> | Awaitable task returning the export result. |
SaveAsync()
Saves the asset.
Declaration
public Task SaveAsync()
Returns
Type | Description |
---|---|
Task | Asynchronous 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. |