Class Resource
- Namespace
- SharpPluginLoader.Core.Resources
- Assembly
- SharpPluginLoader.Core.dll
Represents an instance of the cResource class.
public class Resource : MtObject
- Inheritance
-
Resource
- Derived
- Inherited Members
Constructors
Resource()
public Resource()
Resource(nint, bool)
public Resource(nint instance, bool weakRef = false)
Parameters
Properties
FileExtension
Gets the file extension of this resource.
public string FileExtension { get; }
Property Value
FilePath
Gets the file path of this resource without the extension.
public string FilePath { get; }
Property Value
RefCount
Gets the reference count of this resource. If the reference count reaches 0, the resource is unloaded.
public uint RefCount { get; }
Property Value
Methods
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.
~Resource()
protected ~Resource()
GetWeakRef<T>()
public T GetWeakRef<T>() where T : Resource, new()
Returns
- T
Type Parameters
T
LoadFrom(MtStream)
Deserializes this resource from the specified stream.
public bool LoadFrom(MtStream stream)
Parameters
stream
MtStreamThe stream to deserialize this resource from.
Returns
- bool
True if the resource was deserialized successfully, false otherwise.
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.
SaveTo(MtStream)
Serializes this resource to the specified stream.
public bool SaveTo(MtStream stream)
Parameters
stream
MtStreamThe stream to serialize this resource to.
Returns
- bool
True if the resource was serialized successfully, false otherwise.