Jump to content

How to add more detailed information to your plugin


midora
 Share

Recommended Posts

Do you like to provide more detailed information about your plugin to the user of Paint.NET 4?
If the answer is 'yes' then you should continue to read.

All plugins which are not built-in to Paint.NET 4 are showing a small puzzle image to the right of the menu entry.
If the user hovers the mouse over the plugin menu entry then a tool tip pops up showing information about
the plugin. If the plugin does not offer additional information you will just see the location of the plugin
in the file system.

To offer additional information your plugin has to add and implement the IPluginSupportInfo interface.

Add the interface to your effect class:
 

    [PluginSupportInfo(typeof(MyEffect))]
    public sealed class MyEffect
        : PropertyBasedEffect, IPluginSupportInfo

Compiling your code will throw errors that some methods of the interface are not implemented:

        DisplayName, Version, Author, Copyright, WebsiteUri

Here is an example of an implementation which takes some information out of the assembly. To access the assembly
 

        using System.Reflection;

has to be added. And now the methods:
 

        public string DisplayName
        {
            get
            {
                return ((AssemblyProductAttribute)base.GetType().Assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0]).Product;
            }
        }

        public Version Version
        {
            get
            {
                return base.GetType().Assembly.GetName().Version;
            }
        }

        public string Author
        {
            get
            {
                return "Barbarella";
            }
        }
        public string Copyright
        {
            get
            {
                return ((AssemblyCopyrightAttribute)base.GetType().Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]).Copyright;
            }
        }

        public Uri WebsiteUri
        {
            get
            {
                return new Uri("http://forums.getpaint.net/index.php?/forum/7-plugins-publishing-only/");
            }
        }

An other way to implement the plugin info is to use a seperate class:
 

    public class MyPluginSupportInfo : IPluginSupportInfo
    {
        public string DisplayName
        {
            get
            {
                return ((AssemblyProductAttribute)base.GetType().Assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0]).Product;
            }
        }

        public Version Version
        {
            get
            {
                return base.GetType().Assembly.GetName().Version;
            }
        }

        public string Author
        {
            get
            {
                return "Barbarella";
            }
        }
        public string Copyright
        {
            get
            {
                return ((AssemblyCopyrightAttribute)base.GetType().Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]).Copyright;
            }
        }

        public Uri WebsiteUri
        {
            get
            {
                return new Uri("http://forums.getpaint.net/index.php?/forum/7-plugins-publishing-only/");
            }
        }
    }

In this case you have to add a reference to this class and not to the effect class.
 

    [PluginSupportInfo(typeof(MyPluginSupportInfo))]

So now let your plugin tell us more about it...




 

midoras signature.gif

Link to comment
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.

 Share

×
×
  • Create New...