C# Class Mono.Addins.AddinEngine

An add-in engine.
This class allows hosting several independent add-in engines in a single application domain. In general, applications use the AddinManager class to query and manage extensions. This class is static, so the API is easily accessible. However, some kind applications may need to use several isolated add-in engines, and in this case the AddinManager class can't be used, because it is bound to a single add-in engine. Those applications can instead create several instances of the AddinEngine class. Each add-in engine can be independently initialized with different add-in registries and extension models.
Inheritance: Mono.Addins.ExtensionContext
显示文件 Open project: mono/mono-addins Class Usage Examples

Private Properties

Property Type Description
ActivateAddin void
ActivateRoots void
CheckHostAssembly void
CheckInitialized void
CurrentDomainAssemblyResolve System.Reflection.Assembly
FindType Mono.Addins.Description.ExtensionNodeType
GetAddin RuntimeAddin
GetAddinForAssembly RuntimeAddin
GetAutoTypeExtensionPoint string
GetNodeTypeAddin string
Initialize void
InsertAddin bool
InsertExtensionPoint void
LoadAddin bool
OnAssemblyLoaded void
RegisterAssemblies void
RegisterAutoTypeExtensionPoint void
RegisterNodeSets void
ReportAddinLoad void
ReportAddinUnload void
ReportError void
ResetCachedData void
ResolveLoadDependencies bool
UnloadAddin void
UnregisterAddinNodeSets void
UnregisterAutoTypeExtensionPoint void
ValidateAddinRoots void

Public Methods

Method Description
AddinEngine ( ) : System

Initializes a new instance of the Mono.Addins.AddinEngine class.

CheckInstalled ( string message ) : void

Checks if the provided add-ins are installed, and requests the installation of those which aren't.

This method checks if the specified add-ins are installed. If some of the add-ins are not installed, it will use the installer assigned to the DefaultAddinInstaller property to install them. If the installation fails, or if DefaultAddinInstaller is not set, an exception will be thrown.

CreateExtensionContext ( ) : Mono.Addins.ExtensionContext

Creates a new extension context.

Extension contexts can be used to query the extension model using particular condition values.

Initialize ( string configDir ) : void

Initializes the add-in engine

The add-in engine needs to be initialized before doing any add-in operation. When initialized with this method, it will look for add-in in the add-in registry located in the specified path.

Initialize ( string configDir, string addinsDir ) : void

Initializes the add-in engine.

The add-in engine needs to be initialized before doing any add-in operation. Configuration information about the add-in registry will be stored in the provided location. The add-in engine will look for add-ins in the provided 'addinsDir' directory. When specifying a path, it is possible to use a special folder name as root. For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced by the location of the Environment.SpecialFolder.Personal folder. Any value of the Environment.SpecialFolder enumeration can be used (always between square brackets)

Initialize ( string configDir, string addinsDir, string databaseDir ) : void

Initializes the add-in engine.

The add-in engine needs to be initialized before doing any add-in operation. Configuration information about the add-in registry will be stored in the provided location. The add-in engine will look for add-ins in the provided 'addinsDir' directory. Cached information about add-ins will be stored in the 'databaseDir' directory. When specifying a path, it is possible to use a special folder name as root. For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced by the location of the Environment.SpecialFolder.Personal folder. Any value of the Environment.SpecialFolder enumeration can be used (always between square brackets)

InitializeDefaultLocalizer ( IAddinLocalizer localizer ) : void

Sets the default localizer to be used for this add-in engine

IsAddinLoaded ( string id ) : bool

Checks if an add-in has been loaded.

LoadAddin ( IProgressStatus statusMonitor, string id ) : void

Forces the loading of an add-in.

This method loads all assemblies that belong to an add-in in memory. All add-ins on which the specified add-in depends will also be loaded. Notice that in general add-ins don't need to be explicitly loaded using this method, since the add-in engine will load them on demand.

Shutdown ( ) : void

Finalizes the add-in engine.

Private Methods

Method Description
ActivateAddin ( string id ) : void
ActivateRoots ( ) : void
CheckHostAssembly ( Assembly asm ) : void
CheckInitialized ( ) : void
CurrentDomainAssemblyResolve ( object sender, ResolveEventArgs args ) : Assembly
FindType ( Mono.Addins.Description.ExtensionNodeSet nset, string name, string callingAddinId ) : Mono.Addins.Description.ExtensionNodeType
GetAddin ( string id ) : RuntimeAddin
GetAddinForAssembly ( Assembly asm ) : RuntimeAddin
GetAutoTypeExtensionPoint ( Type type ) : string
GetNodeTypeAddin ( Mono.Addins.Description.ExtensionNodeSet nset, string type, string callingAddinId ) : string
Initialize ( Assembly startupAsm, string configDir, string addinsDir, string databaseDir ) : void
InsertAddin ( IProgressStatus statusMonitor, Addin iad ) : bool
InsertExtensionPoint ( RuntimeAddin addin, ExtensionPoint ep ) : void
LoadAddin ( IProgressStatus statusMonitor, string id, bool throwExceptions ) : bool
OnAssemblyLoaded ( object s, AssemblyLoadEventArgs a ) : void
RegisterAssemblies ( RuntimeAddin addin ) : void
RegisterAutoTypeExtensionPoint ( Type type, string path ) : void
RegisterNodeSets ( string addinId, ExtensionNodeSetCollection nsets ) : void
ReportAddinLoad ( string id ) : void
ReportAddinUnload ( string id ) : void
ReportError ( string message, string addinId, Exception exception, bool fatal ) : void
ResetCachedData ( ) : void
ResolveLoadDependencies ( ArrayList addins, Stack depCheck, string id, bool optional ) : bool
UnloadAddin ( string id ) : void
UnregisterAddinNodeSets ( string addinId ) : void
UnregisterAutoTypeExtensionPoint ( Type type, string path ) : void
ValidateAddinRoots ( ) : void

Method Details

AddinEngine() public method

Initializes a new instance of the Mono.Addins.AddinEngine class.
public AddinEngine ( ) : System
return System

CheckInstalled() public method

Checks if the provided add-ins are installed, and requests the installation of those which aren't.
This method checks if the specified add-ins are installed. If some of the add-ins are not installed, it will use the installer assigned to the DefaultAddinInstaller property to install them. If the installation fails, or if DefaultAddinInstaller is not set, an exception will be thrown.
public CheckInstalled ( string message ) : void
message string /// Message to show to the user when new add-ins have to be installed. ///
return void

CreateExtensionContext() public method

Creates a new extension context.
Extension contexts can be used to query the extension model using particular condition values.
public CreateExtensionContext ( ) : Mono.Addins.ExtensionContext
return Mono.Addins.ExtensionContext

Initialize() public method

Initializes the add-in engine
The add-in engine needs to be initialized before doing any add-in operation. When initialized with this method, it will look for add-in in the add-in registry located in the specified path.
public Initialize ( string configDir ) : void
configDir string /// Location of the add-in registry. ///
return void

Initialize() public method

Initializes the add-in engine.
The add-in engine needs to be initialized before doing any add-in operation. Configuration information about the add-in registry will be stored in the provided location. The add-in engine will look for add-ins in the provided 'addinsDir' directory. When specifying a path, it is possible to use a special folder name as root. For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced by the location of the Environment.SpecialFolder.Personal folder. Any value of the Environment.SpecialFolder enumeration can be used (always between square brackets)
public Initialize ( string configDir, string addinsDir ) : void
configDir string /// Location of the add-in registry. ///
addinsDir string /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. ///
return void

Initialize() public method

Initializes the add-in engine.
The add-in engine needs to be initialized before doing any add-in operation. Configuration information about the add-in registry will be stored in the provided location. The add-in engine will look for add-ins in the provided 'addinsDir' directory. Cached information about add-ins will be stored in the 'databaseDir' directory. When specifying a path, it is possible to use a special folder name as root. For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced by the location of the Environment.SpecialFolder.Personal folder. Any value of the Environment.SpecialFolder enumeration can be used (always between square brackets)
public Initialize ( string configDir, string addinsDir, string databaseDir ) : void
configDir string /// Location of the add-in registry. ///
addinsDir string /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. ///
databaseDir string /// Location of the add-in database. If the path is relative, it is considered to be relative /// to the configDir directory. ///
return void

InitializeDefaultLocalizer() public method

Sets the default localizer to be used for this add-in engine
public InitializeDefaultLocalizer ( IAddinLocalizer localizer ) : void
localizer IAddinLocalizer /// The add-in localizer ///
return void

IsAddinLoaded() public method

Checks if an add-in has been loaded.
public IsAddinLoaded ( string id ) : bool
id string /// Full identifier of the add-in. ///
return bool

LoadAddin() public method

Forces the loading of an add-in.
This method loads all assemblies that belong to an add-in in memory. All add-ins on which the specified add-in depends will also be loaded. Notice that in general add-ins don't need to be explicitly loaded using this method, since the add-in engine will load them on demand.
public LoadAddin ( IProgressStatus statusMonitor, string id ) : void
statusMonitor IProgressStatus /// Status monitor to keep track of the loading process. ///
id string /// Full identifier of the add-in to load. ///
return void

Shutdown() public method

Finalizes the add-in engine.
public Shutdown ( ) : void
return void