Resource

Namespace: SharpPluginLoader.Core.Resources

Represents an instance of the cResource class.

public class Resource : SharpPluginLoader.Core.MtObject

Inheritance ObjectNativeWrapperMtObjectResource

Properties

FilePath

Gets the file path of this resource without the extension.

public string FilePath { get; }

Property Value

String

FileExtension

Gets the file extension of this resource.

public string FileExtension { get; }

Property Value

String

RefCount

Gets the reference count of this resource. If the reference count reaches 0, the resource is unloaded.

public uint RefCount { get; }

Property Value

UInt32

Instance

The native pointer.

public nint Instance { get; set; }

Property Value

IntPtr

Constructors

Resource(IntPtr)

public Resource(nint instance)

Parameters

instance IntPtr

Resource()

public Resource()

Methods

Finalize()

protected void Finalize()

AddRef()

Increments the reference count of this resource.

public void AddRef()

Remarks:

This class automatically increments and decrements the reference counter when it is created/destroyed. You should not have to call this method explicitly.

Release()

Decrements the reference count of this resource. If the reference count reaches 0, the resource is unloaded.

public void Release()

Remarks:

This class automatically increments and decrements the reference counter when it is created/destroyed. You should not have to call this method explicitly.

LoadFrom(MtStream)

Deserializes this resource from the specified stream.

public bool LoadFrom(MtStream stream)

Parameters

stream MtStream
The stream to deserialize this resource from.

Returns

Boolean
True if the resource was deserialized successfully, false otherwise.

SaveTo(MtStream)

Serializes this resource to the specified stream.

public bool SaveTo(MtStream stream)

Parameters

stream MtStream
The stream to serialize this resource to.

Returns

Boolean
True if the resource was serialized successfully, false otherwise.