C# Class Mono.Addins.AddinRegistry

Inheritance: IDisposable
Show file Open project: mono/mono-addins Class Usage Examples

Private Properties

Property Type Description
AddinDependsOn bool
AddinRegistry System
CopyExtensionsFrom void
CreateHostAddinsFile bool
GetAddinForHostAssembly Addin
GetGlobalRegistry AddinRegistry
GetRegisteredStartupFolders string[]
NotifyDatabaseUpdated void
ParseAddin void
ScanFolders void

Public Methods

Method Description
AddinRegistry ( string registryPath ) : System

Initializes a new instance.

Creates a new add-in registry located in the provided path. The add-in registry will look for add-ins in an 'addins' subdirectory of the provided registryPath. 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)

AddinRegistry ( string registryPath, string startupDirectory ) : System

Initializes a new instance.

Creates a new add-in registry located in the provided path. The add-in registry will look for add-ins in an 'addins' subdirectory of the provided registryPath. 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)

AddinRegistry ( string registryPath, string startupDirectory, string addinsDir ) : System

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

Creates a new add-in registry located in the provided path. Configuration information about the add-in registry will be stored in 'registryPath'. The add-in registry 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)

AddinRegistry ( string registryPath, string startupDirectory, string addinsDir, string databaseDir ) : System

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

Creates a new add-in registry located in the provided path. Configuration information about the add-in registry will be stored in 'registryPath'. The add-in registry 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)

DisableAddin ( string id ) : void

Disables an add-in.

When an add-in is disabled, all extension points it defines will be ignored by the add-in engine. Other add-ins which depend on the disabled add-in will also automatically be disabled.

DisableAddin ( string id, bool exactVersionMatch ) : void

Disables an add-in.

When an add-in is disabled, all extension points it defines will be ignored by the add-in engine. Other add-ins which depend on the disabled add-in will also automatically be disabled.

Dispose ( ) : void

Disposes the add-in engine.

DumpFile ( string file ) : void

Internal use only

EnableAddin ( string id ) : void

Enables an add-in.

If the enabled add-in depends on other add-ins which are disabled, those will automatically be enabled too.

GetAddin ( string id ) : Addin

Returns an add-in from the registry.

The add-in identifier may optionally include a version number, for example: "TextEditor.Xml,1.2"

GetAddin ( string id, bool exactVersionMatch ) : Addin

Returns an add-in from the registry.

The add-in identifier may optionally include a version number, for example: "TextEditor.Xml,1.2". In this case, if the exact version is not found and exactVersionMatch is 'false', it will return one than is compatible with the required version.

GetAddinDescription ( IProgressStatus progressStatus, string file ) : AddinDescription

Loads an add-in description

This method loads an add-in description from a file. The file can be an XML manifest or an assembly that implements an add-in.

GetAddinRoots ( ) : Mono.Addins.Addin[]

Gets all add-in roots registered in the registry.

GetAddins ( ) : Mono.Addins.Addin[]

Gets all add-ins registered in the registry.

GetGlobalRegistry ( ) : AddinRegistry

Gets the global registry.

The global add-in registry is created in "~/.config/mono.addins", and it is the default registry used when none is specified.

GetModules ( AddinSearchFlags flags ) : Mono.Addins.Addin[]

Gets all add-ins or add-in roots registered in the registry.

IsAddinEnabled ( string id ) : bool

Checks whether an add-in is enabled.

IsRegisteredForUninstall ( string addinId ) : bool

Determines whether an add-in is registered for uninstallation

ReadAddinManifestFile ( TextReader reader, string baseFile ) : AddinDescription

Reads an XML add-in manifest

ReadAddinManifestFile ( string file ) : AddinDescription

Reads an XML add-in manifest

Rebuild ( IProgressStatus monitor ) : void

Regenerates the cached data of the add-in registry.

RegisterExtension ( object extension ) : void

Registers an extension. Only AddinFileSystemExtension extensions are supported right now.

RegisterForUninstall ( string id, IEnumerable files ) : void

Registers a set of add-ins for uninstallation.

This method can be used to instruct the add-in manager to uninstall an add-in the next time the registry is updated. This is useful when an add-in manager can't delete an add-in because if it is loaded.

ResetConfiguration ( ) : void

Resets the configuration files of the registry

UnregisterExtension ( object extension ) : void

Unregisters an extension.

Update ( ) : void

Updates the add-in registry.

This method must be called after modifying, installing or uninstalling add-ins. When calling Update, every add-in added to the registry is parsed and validated, and if there is any error it will be rejected. It will also cache add-in information needed at run-time. If during the update operation the registry finds new add-ins or detects that some add-ins have been deleted, the loaded extension points will be updated to include or exclude extension nodes from those add-ins.

Update ( IProgressStatus monitor ) : void

Updates the add-in registry.

This method must be called after modifying, installing or uninstalling add-ins. When calling Update, every add-in added to the registry is parsed and validated, and if there is any error it will be rejected. It will also cache add-in information needed at run-time. If during the update operation the registry finds new add-ins or detects that some add-ins have been deleted, the loaded extension points will be updated to include or exclude extension nodes from those add-ins.

Private Methods

Method Description
AddinDependsOn ( string id1, string id2 ) : bool
AddinRegistry ( AddinEngine engine, string registryPath, string startupDirectory, string addinsDir, string databaseDir ) : System
CopyExtensionsFrom ( AddinRegistry other ) : void
CreateHostAddinsFile ( string hostFile ) : bool
GetAddinForHostAssembly ( string filePath ) : Addin
GetGlobalRegistry ( AddinEngine engine, string startupDirectory ) : AddinRegistry
GetRegisteredStartupFolders ( string registryPath ) : string[]
NotifyDatabaseUpdated ( ) : void
ParseAddin ( IProgressStatus progressStatus, string file, string outFile ) : void
ScanFolders ( IProgressStatus monitor, string folderToScan, StringCollection filesToIgnore ) : void

Method Details

AddinRegistry() public method

Initializes a new instance.
Creates a new add-in registry located in the provided path. The add-in registry will look for add-ins in an 'addins' subdirectory of the provided registryPath. 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 AddinRegistry ( string registryPath ) : System
registryPath string /// Location of the add-in registry. ///
return System

AddinRegistry() public method

Initializes a new instance.
Creates a new add-in registry located in the provided path. The add-in registry will look for add-ins in an 'addins' subdirectory of the provided registryPath. 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 AddinRegistry ( string registryPath, string startupDirectory ) : System
registryPath string /// Location of the add-in registry. ///
startupDirectory string /// Location of the application. ///
return System

AddinRegistry() public method

Initializes a new instance of the Mono.Addins.AddinRegistry class.
Creates a new add-in registry located in the provided path. Configuration information about the add-in registry will be stored in 'registryPath'. The add-in registry 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 AddinRegistry ( string registryPath, string startupDirectory, string addinsDir ) : System
registryPath string /// Location of the add-in registry. ///
startupDirectory string /// Location of the application. ///
addinsDir string /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. ///
return System

AddinRegistry() public method

Initializes a new instance of the Mono.Addins.AddinRegistry class.
Creates a new add-in registry located in the provided path. Configuration information about the add-in registry will be stored in 'registryPath'. The add-in registry 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 AddinRegistry ( string registryPath, string startupDirectory, string addinsDir, string databaseDir ) : System
registryPath string /// Location of the add-in registry. ///
startupDirectory string /// Location of the application. ///
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 System

DisableAddin() public method

Disables an add-in.
When an add-in is disabled, all extension points it defines will be ignored by the add-in engine. Other add-ins which depend on the disabled add-in will also automatically be disabled.
public DisableAddin ( string id ) : void
id string /// Identifier of the add-in. ///
return void

DisableAddin() public method

Disables an add-in.
When an add-in is disabled, all extension points it defines will be ignored by the add-in engine. Other add-ins which depend on the disabled add-in will also automatically be disabled.
public DisableAddin ( string id, bool exactVersionMatch ) : void
id string /// Identifier of the add-in. ///
exactVersionMatch bool /// If true, it disables the add-in that exactly matches the provided version. If false, it disables /// all versions of add-ins with the same Id ///
return void

Dispose() public method

Disposes the add-in engine.
public Dispose ( ) : void
return void

DumpFile() public method

Internal use only
public DumpFile ( string file ) : void
file string
return void

EnableAddin() public method

Enables an add-in.
If the enabled add-in depends on other add-ins which are disabled, those will automatically be enabled too.
public EnableAddin ( string id ) : void
id string /// Identifier of the add-in ///
return void

GetAddin() public method

Returns an add-in from the registry.
The add-in identifier may optionally include a version number, for example: "TextEditor.Xml,1.2"
public GetAddin ( string id ) : Addin
id string /// Identifier of the add-in. ///
return Addin

GetAddin() public method

Returns an add-in from the registry.
The add-in identifier may optionally include a version number, for example: "TextEditor.Xml,1.2". In this case, if the exact version is not found and exactVersionMatch is 'false', it will return one than is compatible with the required version.
public GetAddin ( string id, bool exactVersionMatch ) : Addin
id string /// Identifier of the add-in. ///
exactVersionMatch bool /// 'true' if the exact add-in version must be found. ///
return Addin

GetAddinDescription() public method

Loads an add-in description
This method loads an add-in description from a file. The file can be an XML manifest or an assembly that implements an add-in.
public GetAddinDescription ( IProgressStatus progressStatus, string file ) : AddinDescription
progressStatus IProgressStatus /// Progress tracker. ///
file string /// Name of the file to load ///
return Mono.Addins.Description.AddinDescription

GetAddinRoots() public method

Gets all add-in roots registered in the registry.
public GetAddinRoots ( ) : Mono.Addins.Addin[]
return Mono.Addins.Addin[]

GetAddins() public method

Gets all add-ins registered in the registry.
public GetAddins ( ) : Mono.Addins.Addin[]
return Mono.Addins.Addin[]

GetGlobalRegistry() public static method

Gets the global registry.
The global add-in registry is created in "~/.config/mono.addins", and it is the default registry used when none is specified.
public static GetGlobalRegistry ( ) : AddinRegistry
return AddinRegistry

GetModules() public method

Gets all add-ins or add-in roots registered in the registry.
public GetModules ( AddinSearchFlags flags ) : Mono.Addins.Addin[]
flags AddinSearchFlags /// Flags. ///
return Mono.Addins.Addin[]

IsAddinEnabled() public method

Checks whether an add-in is enabled.
public IsAddinEnabled ( string id ) : bool
id string /// Identifier of the add-in. ///
return bool

IsRegisteredForUninstall() public method

Determines whether an add-in is registered for uninstallation
public IsRegisteredForUninstall ( string addinId ) : bool
addinId string /// Identifier of the add-in ///
return bool

ReadAddinManifestFile() public method

Reads an XML add-in manifest
public ReadAddinManifestFile ( TextReader reader, string baseFile ) : AddinDescription
reader System.IO.TextReader /// Reader that contains the XML ///
baseFile string /// Base path to use to discover add-in files ///
return Mono.Addins.Description.AddinDescription

ReadAddinManifestFile() public method

Reads an XML add-in manifest
public ReadAddinManifestFile ( string file ) : AddinDescription
file string /// Path to the XML file ///
return Mono.Addins.Description.AddinDescription

Rebuild() public method

Regenerates the cached data of the add-in registry.
public Rebuild ( IProgressStatus monitor ) : void
monitor IProgressStatus /// Progress monitor to keep track of the rebuild operation. ///
return void

RegisterExtension() public method

Registers an extension. Only AddinFileSystemExtension extensions are supported right now.
public RegisterExtension ( object extension ) : void
extension object /// The extension to register ///
return void

RegisterForUninstall() public method

Registers a set of add-ins for uninstallation.
This method can be used to instruct the add-in manager to uninstall an add-in the next time the registry is updated. This is useful when an add-in manager can't delete an add-in because if it is loaded.
public RegisterForUninstall ( string id, IEnumerable files ) : void
id string /// Identifier of the add-in ///
files IEnumerable /// Files to be uninstalled ///
return void

ResetConfiguration() public method

Resets the configuration files of the registry
public ResetConfiguration ( ) : void
return void

UnregisterExtension() public method

Unregisters an extension.
public UnregisterExtension ( object extension ) : void
extension object /// The extension to unregister ///
return void

Update() public method

Updates the add-in registry.
This method must be called after modifying, installing or uninstalling add-ins. When calling Update, every add-in added to the registry is parsed and validated, and if there is any error it will be rejected. It will also cache add-in information needed at run-time. If during the update operation the registry finds new add-ins or detects that some add-ins have been deleted, the loaded extension points will be updated to include or exclude extension nodes from those add-ins.
public Update ( ) : void
return void

Update() public method

Updates the add-in registry.
This method must be called after modifying, installing or uninstalling add-ins. When calling Update, every add-in added to the registry is parsed and validated, and if there is any error it will be rejected. It will also cache add-in information needed at run-time. If during the update operation the registry finds new add-ins or detects that some add-ins have been deleted, the loaded extension points will be updated to include or exclude extension nodes from those add-ins.
public Update ( IProgressStatus monitor ) : void
monitor IProgressStatus /// Progress monitor to keep track of the update operation. ///
return void