get assembly and main module after loading the plugin
This commit is contained in:
@@ -9,12 +9,21 @@ Public Class Plugin
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property MainFunctions As IReadOnlyList(Of PluginFunction)
|
||||
|
||||
''' <summary>
|
||||
''' A collection of Methods with a FunctionCode (excluding all PluginFunctions from MainFunctions).
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property PluginFunctions As IReadOnlyList(Of PluginFunction)
|
||||
''' <summary>
|
||||
''' Gets the assembly that contains the PluginFunctions of this Plugin
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Assembly As Assembly
|
||||
''' <summary>
|
||||
''' Gets the main module that contains the PluginFunctions of this Plugin
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property MainModule As Type
|
||||
|
||||
''' <summary>
|
||||
''' Load a new Plugin and its PluginFunctions.
|
||||
@@ -23,10 +32,10 @@ Public Class Plugin
|
||||
''' <param name="autoCallMainFunction">If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.</param>
|
||||
''' <param name="entryTypeName">The name of the type where to search for Methods when loading a new Plugin.</param>
|
||||
Public Sub New(filePath As String, autoCallMainFunction As Boolean, entryTypeName As String)
|
||||
Dim asm As Assembly = Assembly.LoadFile(filePath)
|
||||
Dim modul As Type = asm.GetType(entryTypeName)
|
||||
Assembly = Assembly.LoadFile(filePath)
|
||||
MainModule = Assembly.GetType(entryTypeName)
|
||||
|
||||
If modul Is Nothing Then
|
||||
If MainModule Is Nothing Then
|
||||
Throw New PluginLoadException("Plugin Modul not found!")
|
||||
End If
|
||||
|
||||
@@ -39,7 +48,7 @@ Public Class Plugin
|
||||
Dim implementMethods As New List(Of PluginFunction)
|
||||
|
||||
'Search for PluginFunctions
|
||||
For Each mi As MethodInfo In modul.GetMethods
|
||||
For Each mi As MethodInfo In MainModule.GetMethods
|
||||
Dim found As Boolean = False
|
||||
|
||||
'Check if the method has one of the defined attributes
|
||||
|
||||
Reference in New Issue
Block a user