/// <summary>
 ///   remove from collection
 /// </summary>
 /// <param name="plugin"> </param>
 public void Remove(PluginInstance plugin)
 {
     List.Remove(plugin);
 }
        /// <summary>
        ///   Verify plugin interface and add to our main assembly
        /// </summary>
        /// <param name="fileName"> </param>
        private void VerifyPlugin(string fileName)
        {
            try
            {
                //load plugin to assembly
                var pAssembly = Assembly.LoadFile(fileName);

                //get assembly type
                var pType = pAssembly.GetType(pAssembly.GetName().Name + ".Plugin");

                //check if plugin implements IPlugin interface
                var implementsIPlugin = typeof (Interface.IPlugin).IsAssignableFrom(pType);
                if (implementsIPlugin)
                {
                    //create a new plugin and initialize
                    var plugin = new PluginInstance {AssemblyPath = fileName, Instance = (Interface.IPlugin) Activator.CreateInstance(pType)};

                    //assign plugin host so it can access our main assembly
                    plugin.Instance.Host = this;
                    plugin.Instance.Initialize();

                    //add plugin to the collection
                    _plugins.Add(plugin);

                    //cleanup
                    plugin = null;
                }
                //cleanup
                pAssembly = null;
            }
            catch (Exception ex)
            {
                Logger.Trace(ex.Message);
            }
        }
 /// <summary>
 ///   add to collection
 /// </summary>
 /// <param name="plugin"> </param>
 public void Add(PluginInstance plugin)
 {
     List.Add(plugin);
 }