/// <summary> /// Scans a given <see cref="Type" /> for plugins. /// </summary> /// <param name="extensionAssembly">The <see cref="ExtensionAssembly" /> containing the <see cref="Type" /> to scan.</param> /// <param name="type">The <see cref="Type" /> to scan.</param> /// <param name="task">The <see cref="Task" /> which will be used to output messages to the build log.</param> /// <returns> /// <see langword="true" /> if <paramref name="type" /> represents a /// <see cref="IPlugin" />; otherwise, <see langword="false" />. /// </returns> public bool ScanTypeForPlugins(ExtensionAssembly extensionAssembly, Type type, Task task) { if (type.IsAbstract) return false; try { bool isplugin = typeof(IPlugin).IsAssignableFrom(type); if (!isplugin) { return false; } PluginBuilder pb = new PluginBuilder(extensionAssembly, type); _pluginBuilders.Add(pb); return true; } catch { task.Log(Level.Error, "Failure scanning \"{0}\" for plugins.", type.AssemblyQualifiedName); throw; } }
/// <summary> /// Scans a given <see cref="Type" /> for plugins. /// </summary> /// <param name="extensionAssembly">The <see cref="ExtensionAssembly" /> containing the <see cref="Type" /> to scan.</param> /// <param name="type">The <see cref="Type" /> to scan.</param> /// <param name="task">The <see cref="Task" /> which will be used to output messages to the build log.</param> /// <returns> /// <see langword="true" /> if <paramref name="type" /> represents a /// <see cref="IPlugin" />; otherwise, <see langword="false" />. /// </returns> public bool ScanTypeForPlugins(ExtensionAssembly extensionAssembly, Type type, Task task) { if (type.IsAbstract) { return(false); } try { bool isplugin = typeof(IPlugin).IsAssignableFrom(type); if (!isplugin) { return(false); } PluginBuilder pb = new PluginBuilder(extensionAssembly, type); _pluginBuilders.Add(pb); return(true); } catch { task.Log(Level.Error, "Failure scanning \"{0}\" for plugins.", type.AssemblyQualifiedName); throw; } }