OpenTAP 9.25
API Reference
Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
OpenTap.PluginManager Class Reference

Static class that searches for and loads OpenTAP plugins. More...

Public Member Functions

delegate bool AssemblyLoadFilterDelegate (string assemblyName, Version version)
 Function signature for assembly load filters. More...
 

Static Public Member Functions

static void AddAssemblyLoadFilter (AssemblyLoadFilterDelegate filter)
 Adds a function that is used to filter whether an assembly should be loaded. This can be used to control which assemblies gets loaded. This is for very advanced usage only. The filters are used in the order in which they are added. More...
 
static ReadOnlyCollection< Type > GetPlugins (Type pluginBaseType)
 Returns a list of types that implement a specified plugin base type. This will load the assembly containing the type, if not already loaded. This will search for plugins if not done already (e.g. using PluginManager.SearchAsync()) More...
 
static PluginSearcher GetSearcher ()
 Returns the PluginSearcher used to search for plugins. This will search for plugins if not done already (i.e. call and wait for PluginManager.SearchAsync())
 
static ReadOnlyCollection< TypeDataGetAllPlugins ()
 Gets all plugins. I.e. all types that descend from ITapPlugin. Abstract types and interfaces are not included. This does not require/cause the assembly containing the type to be loaded. This will search for plugins if not done already (i.e. call and wait for PluginManager.SearchAsync()) Only C#/.NET types are returned. To also get dynamic types (from custom ITypeDataSearchers) use TypeData.GetDerivedTypes(ITypeData) instead.
 
static ReadOnlyCollection< Type > GetPlugins< BaseType > ()
 Returns a list of types that implement a specified plugin base type. This will load the assembly containing the type, if not already loaded. This will search for plugins if not done already (i.e. call and wait for PluginManager.SearchAsync()) Only C#/.NET types are returned. To also get dynamic types (from custom ITypeDataSearchers) use TypeData.GetDerivedTypes(ITypeData) instead. More...
 
static AssemblyData GetOpenTapAssembly ()
 Gets the AssemblyData for the OpenTap.dll assembly. This will search for plugins if not done already (i.e. call and wait for PluginManager.SearchAsync())
 
static Task SearchAsync ()
 Start a search task that finds plugins to the platform. This call is not blocking, some other calls to PluginManager will automatically wait for this task to finish (or even start it if it hasn't been already). These calls include GetAllPlugins, GetPlugins<BaseType>, GetPlugins(Type), LocateType(string) and LocateTypeData(string) More...
 
static Type LocateType (string typeName)
 Searches through found plugins. Returning the System.Type matching the given name if such a type is found in any assembly in DirectoriesToSearch or mscorelib - otherwise null (e.g. for types located in the GAC) This will load the assembly containing the type, if not already loaded. This will search for plugins if not done already (i.e. call and wait for PluginManager.SearchAsync())
 
static TypeData LocateTypeData (string typeName)
 Searches through found plugins. Returns the OpenTap.TypeData matching the given name if such a type is found in any assembly in DirectoriesToSearch - otherwise null (e.g. for types located in the GAC). This does not require/cause the assembly containing the type to be loaded. This will search for plugins if not done already (i.e. call and wait for PluginManager.SearchAsync())
 

Static Public Attributes

static EventHandler< PluginsChangedEventArgsPluginsChanged
 This event is invoked when the types found by the plugin manager has changed.
 

Properties

static List< string > DirectoriesToSearch [get]
 Specifies the directories to be searched for plugins. Any additional directories should be added before calling PluginManager.SearchAsync(), GetAllPlugins, GetPlugins<BaseType>, GetPlugins(Type), LocateType(string) or LocateTypeData(string)
 

Detailed Description

Static class that searches for and loads OpenTAP plugins.

Member Function Documentation

◆ AddAssemblyLoadFilter()

static void OpenTap.PluginManager.AddAssemblyLoadFilter ( AssemblyLoadFilterDelegate  filter)
inlinestatic

Adds a function that is used to filter whether an assembly should be loaded. This can be used to control which assemblies gets loaded. This is for very advanced usage only. The filters are used in the order in which they are added.

Parameters
filterThe additional filter to use.

◆ AssemblyLoadFilterDelegate()

delegate bool OpenTap.PluginManager.AssemblyLoadFilterDelegate ( string  assemblyName,
Version  version 
)

Function signature for assembly load filters.

Parameters
assemblyNameThe name of the assembly (not the full name).
versionThe assembly version.
Returns
true if the assembly should be loaded. False if not.

◆ GetPlugins()

static ReadOnlyCollection< Type > OpenTap.PluginManager.GetPlugins ( Type  pluginBaseType)
inlinestatic

Returns a list of types that implement a specified plugin base type. This will load the assembly containing the type, if not already loaded. This will search for plugins if not done already (e.g. using PluginManager.SearchAsync())

Parameters
pluginBaseTypeonly looks for types descending from pluginBaseType.

◆ GetPlugins&lt; BaseType &gt;()

static ReadOnlyCollection< Type > OpenTap.PluginManager.GetPlugins< BaseType > ( )
inlinestatic

Returns a list of types that implement a specified plugin base type. This will load the assembly containing the type, if not already loaded. This will search for plugins if not done already (i.e. call and wait for PluginManager.SearchAsync()) Only C#/.NET types are returned. To also get dynamic types (from custom ITypeDataSearchers) use TypeData.GetDerivedTypes(ITypeData) instead.

This is just to provide a more convenient syntax compared to GetPlugins(Type). The funcionallity is identical.


Template Parameters
BaseTypefind types that descends from this type.
Returns
A read-only collection of types.

◆ SearchAsync()

static Task OpenTap.PluginManager.SearchAsync ( )
inlinestatic

Start a search task that finds plugins to the platform. This call is not blocking, some other calls to PluginManager will automatically wait for this task to finish (or even start it if it hasn't been already). These calls include GetAllPlugins, GetPlugins<BaseType>, GetPlugins(Type), LocateType(string) and LocateTypeData(string)

summary>Searches for plugins.

OpenTAP 9.25 API built Tue Aug 6 2024 07:49:24