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[]
 
IsPatched
Set to true if the asset has been patched by JsonPatchLoader - if so, we don't want to unload it
bool IsPatched { get; set; }
  Property Value
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
capiICoreClientAPI
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
settingsJsonSerializerSettingsSettings for the Json Serializer.
Returns
- T
 
Type Parameters
TAttempts to convert the asset into the given type.
ToText()
Turns the binary data into a UTF-8 string. Use for text files.
string ToText()