To use the wrapper, simply inherit either Base Wrapper or AbstractWrapper and override the base implementation of the method.
Example:
internal sealed class MyImplementation : AbstractWrapper
{
public override void Reload(ref double maxValue)
{
// Here you can write your code that gets executed on Reload.
}
public override void CommandReceived(string args)
{
API.Log(API.LogType.Notice, args);
}
protected override void OnUpdate() => Return("Hello");
}
Note:
The abstract Wrapper can only return string types or number value types (which will be converted to a double using the Convert.ToDouble()
method (plan your numbers accordingly as either a string or a number, floating point values may be lost if returned as a non-string))
Finally: Build your solution and export the .dll to be converted into a recognized Rainmeter .dll. A build event can be set up in your project to do this.
"$(SolutionDir)\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)"
Refer to here for a .csproj example of this
public abstract partial class BaseWrapper
{
public API API { get; private set; }
public virtual void Reload(ref double maxValue) {}
public virtual double Update() => 0;
public virtual string GetString() => null;
/// <summary>
/// 'ExecuteBang'
/// https://docs.rainmeter.net/developers/plugin/csharp/
/// </summary>
public virtual void CommandReceived(string args) {}
}
public abstract class AbstractWrapper : BaseWrapper
{
protected void Return<T>(T value) where T : notnull
protected virtual void OnUpdate() {}
}
We are currently limited in when we return. A bang may be executed and if needed, we can alter our return value, but that value would only be returned on the next update tick, not immediately unless the update rate it set incredibly high (Update Rate directly translates into ms).