Interface IAsset
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Represents a loaded asset from the assets folder
public interface IAsset
- Extension Methods
Properties
Data
The file contents in binary format
byte[] Data { get; set; }
Property Value
- byte[]
Location
The AssetLocation of the asset.
AssetLocation Location { get; }
Property Value
Name
The assets Filename
string Name { get; }
Property Value
Origin
The origin informaton of the asset.
IAssetOrigin Origin { get; set; }
Property Value
Methods
IsLoaded()
Whether or not the asset is currently loaded.
bool IsLoaded()
Returns
ToBitmap(ICoreClientAPI)
Turns the binary data into a Bitmap. Use for .png images. Does not work on other image formats.
BitmapRef ToBitmap(ICoreClientAPI capi)
Parameters
capi
ICoreClientAPI
Returns
ToObject<T>(JsonSerializerSettings)
If the asset is a json file you can use this convenience method to turn it into an object
T ToObject<T>(JsonSerializerSettings settings = null)
Parameters
settings
JsonSerializerSettingsSettings for the Json Serializer.
Returns
- T
Type Parameters
T
Attempts to convert the asset into the given type.
ToText()
Turns the binary data into a UTF-8 string. Use for text files.
string ToText()