SEModCommunity / SE-Community-Mod-API

Space Engineers Community Modding API
GNU Lesser General Public License v3.0
60 stars 47 forks source link

Request: Slight modification to plugin loading #97

Open Tyrsis opened 10 years ago

Tyrsis commented 10 years ago

Right now plugins are loaded with Assembly.LoadFromFile, which locks the .dll. This makes development on plugins annoying, as it requires unloading of the server, or renaming dlls, to recompile etc. If you can change Assembly.LoadFromFile to something like:

byte[] b = File.ReadAllBytes(file); Assembly pluginAssembly = Assembly.Load(b);

This wouldn't lock the .dll which would allow you to overwrite with a new version of .dll as compiled, though you lose path information of the assembly. So if you can pass the path information when you Invoke an init, that would be good enough for the plugin to know it's path.

This would basically allow you to do a post build on a plugin that copies a new dll to the mod path and then you can just unload/reload the plugin from the UI without having to reload a map / restart the server. It speeds up plugin dev tremendously.

I've done this successfully with a fork and it works well, but figured I'd request it officially.

AlienXAXS commented 10 years ago

Just put the solution of your plugin inside the same solution as the SEServerExtender and API's, Refrence the projects as normal and debug the code as the server is running.

However, i do agree that this would be useful for updating plugins without having to reboot the server.

DraygoKorvan commented 10 years ago

This is on ToDo, but I hesitate to make too many changes at one time to the plugin manager. My mods for example need to use the assembly location method for loading default configurations so making such a change could be detrimental to mods that use that method.

Ideally we should be fully unloading the plugin when you click unload.

fvgoulet commented 9 years ago

This should be a quick and valuable enhancement for plugins developpers.