public void UnloadPlugin( Guid key )
{
IPlugin plugin;
//Skip if the plugin doesn't exist
if ( !Plugins.TryGetValue( key, out plugin ) )
return;
//Skip if the plugin is already unloaded
if ( !PluginStates.ContainsKey( key ) )
return;
ApplicationLog.BaseLog.Info( "Unloading plugin '{0}'", key );
try
{
MethodInfo initMethod = plugin.GetType( ).GetMethod( "Shutdown" );
initMethod.Invoke( plugin, new object[ ] { } );
}
catch ( Exception ex )
{
ApplicationLog.BaseLog.Error( ex );
}
_pluginAssemblies.Remove( key );
PluginStates.Remove( key );
Plugins.Remove( key );
}