Skip to content

A managed-unmanaged utility wrapper for Rainmeter plugin development.

License

Notifications You must be signed in to change notification settings

JustArion/RainmeterWrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

⚙️Requirements:
📝Usage:

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

📝Exposed Wrapper Functions:
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() {}
}
Additional Information

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).

About

A managed-unmanaged utility wrapper for Rainmeter plugin development.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages