Click here to Skip to main content
12,695,739 members (34,116 online)
Click here to Skip to main content

Stats

85.6K views
1.5K downloads
161 bookmarked
Posted

A Flexible Plugin System

, 3 Sep 2008 LGPL3
A generic plugin system used to load and manage plugins
trunk
dlls
xunit.dll
Examples
Plugins
ExampleApplication.Shared
Properties
ExampleApplication
Properties
ExamplePlugin.Shared
Properties
ExamplePlugin
Properties
Fadd.Globalization.Yaml
fadd.snk
Properties
Tests
fadd
Commands
Net
Tests
fadd.snk
Globalization
Tests
Logging
Plugins
Properties
Tests
Validation
using System;
using System.Security.Policy;

namespace Fadd.Plugins
{
    /// <summary>
    /// Arguments for <see cref="EvidenceRequestedHandler"/>
    /// </summary>
    public class EvidenceRequestedEventArgs : EventArgs
    {
        private readonly PluginTypeInfo _typeInformation;
        private Evidence _evidence;

        /// <summary>
        /// Initializes a new instance of the <see cref="EvidenceRequestedEventArgs"/> class.
        /// </summary>
        /// <param name="typeInfo">Plugin assembly information.</param>
        public EvidenceRequestedEventArgs(PluginTypeInfo typeInfo)
        {
            Check.Require(typeInfo, "typeInfo");
            _typeInformation = typeInfo;
        }

        /// <summary>
        /// Evidence that the plugin should be loaded with.
        /// </summary>
        public Evidence Evidence
        {
            get { return _evidence; }
            set { _evidence = value; }
        }

        /// <summary>
        /// Plugin assembly information
        /// </summary>
        public PluginTypeInfo TypeInformation
        {
            get { return _typeInformation; }
        }
    }

    ///<summary>
    /// Called when an assembly is about to be loaded and we need the evidence for it.
    /// Specify the evidence by using <see cref="EvidenceRequestedEventArgs.Evidence"/>
    ///</summary>
    ///<param name="source">PluginManager</param>
    ///<param name="args">Assembly information</param>
    public delegate void EvidenceRequestedHandler(object source, EvidenceRequestedEventArgs args);

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

jgauffin
Founder Gauffin Interactive AB
Sweden Sweden
Founder of OneTrueError, a .NET service which captures, analyzes and provide possible solutions for exceptions.

blog | twitter

You may also be interested in...

Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170118.1 | Last Updated 3 Sep 2008
Article Copyright 2008 by jgauffin
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid