It is currently March 29th, 2024, 6:41 am

C# plugins - recreated on every update?

Share and get help with Plugins and Addons
User avatar
ghosttie
Posts: 7
Joined: February 27th, 2011, 4:43 am
Location: Atlanta, GA, USA

C# plugins - recreated on every update?

Post by ghosttie »

I'm writing a C# plugin to tail log files. In order to avoid reading the entire log file every time the skin updates, I'm just returning a cached value of the tail from the last time the file was read, and updating the cache when FileSystemWatcher tells me the file has been modified.

The problem I have is that it seems to be reading the log file every time the skin updates, because the plugin seems to be created on every update - I lose my FileSystemWatcher and all my cached data.

Does Rainmeter really create the plugin on every update or am I crazy?
I have a catapult. Give me all your money, or I will fling an enormous rock at your head.
User avatar
ghosttie
Posts: 7
Joined: February 27th, 2011, 4:43 am
Location: Atlanta, GA, USA

Re: C# plugins - recreated on every update?

Post by ghosttie »

OK, I suppose it does.

I've worked around it by using Instance.SetTempValue and Instance.GetTempValue to cache data between updates.
I have a catapult. Give me all your money, or I will fling an enormous rock at your head.
derari
Posts: 17
Joined: February 24th, 2011, 5:39 pm

Re: C# plugins - recreated on every update?

Post by derari »

Depending on how you want your cache to work, you can also use static members.

The temp values get lost if the skin is refreshed, static variables are kept until rainmeter shuts down. So it depends on what you need.