Sign in to follow this  
ArgusMagnus

Plugin Installer

Recommended Posts

I have developed a plugin installer. I know that this has been done before, but I wasn't happy with the existing solutions. I know that a plugin installer/management system is on Rick's ToDo list, but I wish to provide an intermediate solution, until the real one arrives.

 

The installer can be invoked in two ways:

 

1. FileType: Open->Plugin Installer (*.pdnplgn, *.zip)

2. Effect: Effects->Advanced->Plugin Installer

 

This will let you open a zip archive (optionally renamed to have a .pdnplgn extension). It will read the containing .net assemblies and show the contained filetype and effect plugins. It will also show you what already existing plugins will be overwritten. If it was started from the effects menu, it will also allow you to preview effects (double click on the effect) before installing it. After clicking "Install" the plugins launch a seperate process which then waits until paint.net is closed by the user and after that copies the files to the paint.net directory. When the installation is complete, it will give you the option to start paint.net up again.

However, this won't just simply copy dll's, it will check if there are assemblies which are referenced by the selected ones and copy them as well. If existing, it will also read the PluginInstallerInstructions.xml file in the archive (see the example "ArgusPaintNet (Text).pdnplgn") which lets plugin authors specify non-.net references (like native assemblies or any other filetype) which should be copied and also files which should be removed (e.g. if you have renamed your effect assembly and want the installer to remove the old one).

 

I have read the rules over and over again and I don't think this violates any of them (perhaps the "side effect" clause on FileType plugins, but I could easily remove that) but I'm still not sure if this will be allowed. I have read an old thread where something similar was removed/banned, but I don't know what was actually done since the code was removed.

I contacted Rick and he said, that this functionality won't work out as a plugin, but would probably be okay as an external utility, and said, I should post this to the developer section and see how this goes from there.

So.. I fear that what I have done till now won't be allowed, but I have still a little hope left since technically, the plugin only shows you plugins (similar to other plugins like the pinned Plugin Browser), the actual installation/file manipulation is done by an external program (you don't see this exe since it is included as resource in the plugin assembly and extracted to the temp folder when needed).

Since this might never make it to the public release section, I haven't put too much effort into it yet. It worked well on my personal computers with BoltBait's Plugin Pack and my own (included as ArgusPaintNet (test).pdnplgn), but it is not well tested. You probably wouldn't have a hard time to make it crash (e.g. by feeding it a corrupt archive).

 

I posted this here, so you can tell me if

1. what part of this idea you like and which part you don't

2. Rick (and perhaps senior members/admins) can tell me if this is allowed, and if possible, which part is not allowed (and optionally, just for my own curiosity, why it is not allowed)

3. If this gets the go ahead, you can help me test this, since something like this should be heavily tested before releasing.

 

PluginInstallerPreview_zpsktwnrhrv.jpg

 

Download:

https://onedrive.live.com/?id=429F16CCEF18E484%21351194&cid=429F16CCEF18E484&group=0

 

If you want to build this from the source, you will need VS 2015 (previous version probably won't compile it, since the source makes use of new C# 6.0 features).

 

I'm looking forward to your feedback

Edited by ArgusMagnus
  • Upvote 1

Share this post


Link to post
Share on other sites

Fancy.

 

When there are conflicts, it would be nice to see the assembly version of the two files.

 

You have an unhanded exception when the cancel button is click on the Open file dialog.

Share this post


Link to post
Share on other sites

Hehe, as I said, not hard to crash^^

 

I've fixed this, because it required almost no changes.

 

Also the assembly version is now displayed.

I have a lot of ideas for improvement, e.g. highlighting conflicting assemblies (possibly with different colors: newer<->green, older<->red), detecting conflicts not only due to conflicting file names but also due to duplicate menu entries, providing an installer for the plugin, possibly with file extension association (so *.pdnplgn would automatically be opened by paint.net, this idea is actually the reason the FileType plugin version exists), but these things would require some work and thus time which I am not willing to invest before I know if I may release this on the forum.

Edited by ArgusMagnus

Share this post


Link to post
Share on other sites

Do you mind if I ask why? (I will respect your final decision, but let me try to convince you)

I could relative easily covert this to an external utility but I think this would greatly reduce the user experience and I don't know if this would be worth the trouble. Furthermore, in contrast to the plugin solution, it would require "hacks"/ugly methods (somehow get the paint.net process, read registry keys, etc.) which are more likely to fail/be broken by a future update of paint.net.

Edited by ArgusMagnus

Share this post


Link to post
Share on other sites

Because you're not implementing a file type. You're creating something completely different. It will be in a location that doesn't really make sense to the user. So, in addition to this breaking the rules that I've laid out for plugins, it ends up parked in the UI at a location that doesn't really make sense for the end user. File->Open's job is to load images, not plugins.

 

You can install plugins without resorting to hacks. Finding the PaintDotNet.exe process and waiting for it to exit should not be difficult and I can help you with that code (System.Diagnostics.Process should provide most of this functionality). The install directory is stored in the registry key HKLM\Software\Paint.NET\TARGETDIR. You can even do version checking by going to the folder from that key (it'll probably be C:\Program Files\paint.net, of course) and checking the version of PaintDotNet.exe (e.g. with System.Diagnostics.FileVersionInfo). These are things that I am not going to be changing in a future release of paint.net: they're stable and you can rely on them. I just haven't documented them in a central location.

Share this post


Link to post
Share on other sites

You are right, the location (File->Open) doesn't really make sense. I would argue that this is also the case for tools effect plugins like CodeLab, Plugin Browser, Color Harmonies or Effect Plugins which let you upload images to imgur or similar sites and that it at least is also not too far off (it still opens/loads something). But if you don't want that, I accept that.

 

You haven't mentioned how you feel about the Effect Plugin with the same functionality at all, would that be possible?

 

I'll be honest, I'm not motivated to realize this as an external utility, it you don't want it as plugin in any way, I will probably just drop this. The reason is that I can't see such an utility being used by a larger user base. I would not download/install/use an utility, which is not somehow accessible through the paint.net UI and I guess others probably wouldn't either.

Edited by ArgusMagnus

Share this post


Link to post
Share on other sites

You are right, the location (File->Open) doesn't really make sense. I would argue that this is also the case for tools effect plugins like CodeLab

CodeLab is located in the Effects > Advanced menu.

Share this post


Link to post
Share on other sites

ArgusMagnus' plugin is also located in the Effects > Advanced menu, if you put the .dll in the Effects directory.

 

I didn't even notice you could alternatively place it in the FileTypes directory, until I read these replies and re-read the original post. I agree, as a file type, it doesn't make too much sense.

Share this post


Link to post
Share on other sites

It would still be quite useful as an external utility. Troubleshooting here on the forum would be easier, "go download this: (link) and use it" 

Share this post


Link to post
Share on other sites

CodeLab is located in the Effects > Advanced menu.

Yeah, I know, but nontheless those plugins I listed (including CodeLab) are located in the UI somewhere, where they don't naturally belong and are there simply due to the lack of alternatives.

It would still be quite useful as an external utility. Troubleshooting here on the forum would be easier, "go download this: (link) and use it"

Maybe... I don't like it, because it means to have another little program only serving one small purpose which is not used very often having lying around somewhere. Perhaps I would still do it, but certainly not right away (I probably won't have time in the near future). But I would clearly prefer the Effects->Advanced->Plugin Installer option. I really think this would be more user-friendly. I could even rename it to PluginLab or something to make it fit better xD

Edit: On second thought, with an external utility, I could get the file extension association functionallity back which died with the FileType plugin. I would still want the Effect plugin for two reasons: 1. To keep the ability to preview effects before installing and 2. to have a way to access the plugin installer from within paint.net. This mainly because I don't like shortcuts to little tools I rarely use clustering my desktop/start screen and remembering names so I can search them is also not my forté. Within the application which it is used for is the place I would want it to be.

Edited by ArgusMagnus

Share this post


Link to post
Share on other sites

You never know, if your external utility is good enough, it might eventually become an internal utility.  :)  Happened with...uh...something.  Something of BoltBait's, I think.  Maybe Gaussian Blur +?

Share this post


Link to post
Share on other sites

You never know, if your external utility is good enough, it might eventually become an internal utility.   :)  Happened with...uh...something.  Something of BoltBait's, I think.  Maybe Gaussian Blur +?

 I don't think this is likely, other than a real effect which can probably very simply be integrated into the internal assemblies, Rick probably has his own ideas for a real plugin management system and won't just integrate an external tool, even if it is good.

 

 

So.. I haven't really gotten an answer, can I keep the Effect Plugin? If yes, is anyone interested in helping me test it before I release it to the public?

I might still do the external utility, but I don't have too much free time on my hands right now.

 

 

Edit: I've uploaded a new version with some small fixes, it's less likely to crash now.

Edited by ArgusMagnus

Share this post


Link to post
Share on other sites
So.. I haven't really gotten an answer, can I keep the Effect Plugin?

I thought I already replied to this ... but no, this can't be a plugin.

 

Oh yeah, here it is :)

This should not be done as a plugin. It should just be an external utility.

Share this post


Link to post
Share on other sites

Ok. I have read the quoted statement, the reason why it wasn't clear to me if this included the effect plugin is, that your whole explanation why this shouldn't be done as a plugin was based on the assumption, that it would be a filetype plugin.

It may be a good idea to update the rules to include this (till the end it remains unclear to me, why this shouldn't be done as an effect plugin, a corresponding entry in the rules could help prevent such confusion in the future).

Edited by ArgusMagnus

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this