diff --git a/Pilz.Reflection.PluginSystem/Plugin.vb b/Pilz.Reflection.PluginSystem/Plugin.vb index c978598..0498da7 100644 --- a/Pilz.Reflection.PluginSystem/Plugin.vb +++ b/Pilz.Reflection.PluginSystem/Plugin.vb @@ -9,12 +9,21 @@ Public Class Plugin ''' ''' Public ReadOnly Property MainFunctions As IReadOnlyList(Of PluginFunction) - ''' ''' A collection of Methods with a FunctionCode (excluding all PluginFunctions from MainFunctions). ''' ''' Public ReadOnly Property PluginFunctions As IReadOnlyList(Of PluginFunction) + ''' + ''' Gets the assembly that contains the PluginFunctions of this Plugin + ''' + ''' + Public ReadOnly Property Assembly As Assembly + ''' + ''' Gets the main module that contains the PluginFunctions of this Plugin + ''' + ''' + Public ReadOnly Property MainModule As Type ''' ''' Load a new Plugin and its PluginFunctions. @@ -23,10 +32,10 @@ Public Class Plugin ''' If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded. ''' The name of the type where to search for Methods when loading a new Plugin. 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