public PluginDetail SelectPlugin(string value) { selectedPlugin = PluginSearchType == SearchType.Id ? GetPluginForId(value) : GetPluginForActionKeyword(value); if (selectedPlugin is null) { throw new KeyNotFoundException($"There is no plugin with { this.PluginSearchType }: { value }"); } return(selectedPlugin.Detail); }
private IEnumerable <PluginDuo> GetPlugins(IEnumerable <PluginDetail> pluginDetails) { foreach (var detail in pluginDetails) { var assembly = Assembly.Load(AssemblyName.GetAssemblyName(detail.PluginFilePath)); var types = assembly.GetTypes(); var type = types.First(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IBlink))); var plugin = (IBlink)Activator.CreateInstance(type); PluginDuo pair = new PluginDuo { Plugin = plugin, Detail = detail }; yield return(pair); } }