Can we obtain the pid of the attached Archeage.exe process in which the plugin is running ?
Its simple if we only assume 1 archeage client, but if you have multiple bots, it get a bit annoying. Currently i am using a somewhat unreliable method, that is, i check for lowest cpu time Archeage process, and assume this is the one the plugin is in (my standard usecase is autostarted plugin so it work out most of the time). But id like something a bit more reliable.
The reason i need the pid, is to detect client crash. Since archbuddy has a tendency to not clean the plugin out after a crash (it seem to kill the mainthread but thats it). No destructor called, no dispose, no appdomain unload nothing. So theres no way for a plugin that rely on threads, to properly clean itself up if Archeage crash (after which AB keep the plugin running with no Archeage process and prevent updating / shutting it down).
I currently have a thread that watch for the pid to be gone and when so, clean itself up. It work out ok, but id like it to be more reliable when starting from an already running client.
I'm open to suggestion on how to approach this
Its simple if we only assume 1 archeage client, but if you have multiple bots, it get a bit annoying. Currently i am using a somewhat unreliable method, that is, i check for lowest cpu time Archeage process, and assume this is the one the plugin is in (my standard usecase is autostarted plugin so it work out most of the time). But id like something a bit more reliable.
The reason i need the pid, is to detect client crash. Since archbuddy has a tendency to not clean the plugin out after a crash (it seem to kill the mainthread but thats it). No destructor called, no dispose, no appdomain unload nothing. So theres no way for a plugin that rely on threads, to properly clean itself up if Archeage crash (after which AB keep the plugin running with no Archeage process and prevent updating / shutting it down).
I currently have a thread that watch for the pid to be gone and when so, clean itself up. It work out ok, but id like it to be more reliable when starting from an already running client.
I'm open to suggestion on how to approach this