It is currently February 20th, 2020, 6:49 pm

Using libraries with Rainmeter plugins

Share and get help with Plugins and Addons
ted_996
Posts: 7
Joined: March 17th, 2016, 12:20 pm

Using libraries with Rainmeter plugins

Post by ted_996 »

Hi,

I'm currently making a Rainmeter plugin in C# and, since my plugin is a bit complex (generates and changes wallpapers according to the time of day) I have used some libraries (for image processing, time and JSON). However, Rainmeter only lets you have one DLL per project, and that's proving to be a bit of a problem.

Things I've tried already:

IlMerge (IlMerge process never finished)

Costura.Fody (does not support loading to DLLs)

Embedding assemblies inside the DLL (Rainmeter crashes without any error information, no log, I can't even include it as a reference in other projects)

Any more ideas?
User avatar
balala
Rainmeter Sage
Posts: 9729
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Using libraries with Rainmeter plugins

Post by balala »

ted_996 wrote:my plugin is a bit complex (generates and changes wallpapers according to the time of day)
Are you sure it worth to work with anything like this? Because I think this can be made even without any plugin.
ted_996
Posts: 7
Joined: March 17th, 2016, 12:20 pm

Re: Using libraries with Rainmeter plugins

Post by ted_996 »

What makes it more complex is a smooth transition from the daytime wallpaper to the nighttime wallpaper (with a database of blended images, for example, 13% daytime and 87% nightime) and the fact that it has to calculate when exactly is the sunrise and sunset. I figured that in order to make it generic (any wallpapers, no hassle), and create that and not have a horrible impact on performance, I need a dedicated piece of software.
User avatar
balala
Rainmeter Sage
Posts: 9729
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Using libraries with Rainmeter plugins

Post by balala »

ted_996 wrote:and the fact that it has to calculate when exactly is the sunrise and sunset.
Don't get me wrong, I don't want to discourage you, but this also can be done with a small lua script. Anyway, we'll see what will come out of it, maybe it'll be a useful plugin. You made me curious.
ted_996
Posts: 7
Joined: March 17th, 2016, 12:20 pm

Re: Using libraries with Rainmeter plugins

Post by ted_996 »

The problem is, it will never come out (not like this anyway) if I can't manage to make it a Rainmeter plugin. It would be great as a standalone application as it stands, but I believe that Rainmeter could bring both ease of use and ease of installation (not to mention that, if this is standalone, it will have to get installed, run at startup, and lots of things that people might not like)

So, does anyone have any sort of experience with using libraries in this case?
User avatar
Socks the Fox
Posts: 99
Joined: August 25th, 2015, 6:40 pm

Re: Using libraries with Rainmeter plugins

Post by Socks the Fox »

I was going to ask if you could just make your DLL depend on the other DLL, but that brings up the issue of distribution. Can the skin manager install non-plugin DLLs? I don't think it can, which would mean having to stick the other library somewhere known which greatly unsimplifies the installation process.

You might also try starting Rainmeter through your IDE's debugger. At least then you might be able to get an idea as to where it's crashing even without a debug build (i.e. "it's crashing when calling my plugin's initialization function" or "there's a NULL access somewhere"). I know when trying to find memory leaks in Chameleon it helped greatly to toss a debug build of my plugin into the Rainmeter plugin folder and start Rainmeter via VS, because I got all the debuggy fun.
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
ted_996
Posts: 7
Joined: March 17th, 2016, 12:20 pm

Re: Using libraries with Rainmeter plugins

Post by ted_996 »

I did in the end manage because I'm determined like that: I saved the DLLs in @Resources and loaded them dynamically at runtime, from a path set as a plugin option, and then called the methods through reflection. Hardly a pretty solution, but it worked, and my plugin is finally unleashed upon the world!
scotri83
Posts: 9
Joined: February 22nd, 2015, 4:27 am

Re: Using libraries with Rainmeter plugins

Post by scotri83 »

Hi Ted,

Mind sharing your method of dynamically loading these libraries? I've run into the same issue as you! See here: https://forum.rainmeter.net/viewtopic.php?f=18&t=23325

I would greatly appreciate it!

Thanks.