private object LoadPluginImplementation(IPluginImplementationDescription implementation) { try { _isLoading = true; var assembly = _selectedPluginArchive.LoadPlugin(); //< is cached so multiple calls are fine var type = assembly.GetType(implementation.FullTypeName); var pluginObject = Activator.CreateInstance(type); return(pluginObject); } finally { _isLoading = false; } }
/// <inheritdoc /> public override T Load <T>(IPluginDescription plugin, IPluginImplementationDescription implementation) { if (plugin == null) { throw new ArgumentNullException(nameof(plugin)); } if (implementation == null) { throw new ArgumentNullException(nameof(implementation)); } var assembly = Assembly.LoadFrom(plugin.FilePath); var type = assembly.GetType(implementation.FullTypeName); if (type == null) { throw new ArgumentException(string.Format("Plugin '{0}' does not define a type named '{1}'", plugin.FilePath, implementation)); } return((T)Activator.CreateInstance(type)); }
public abstract T Load <T>(IPluginDescription plugin, IPluginImplementationDescription implementation) where T : class, IPlugin;