protected virtual bool CheckLoadMode(PluginDescriptor pluginDescriptor, PluginsState state) { if (pluginDescriptor == null) { throw new ArgumentNullException("pluginDescriptor"); } switch (state) { case PluginsState.All: //no filering return(true); case PluginsState.InstalledOnly: return(pluginDescriptor.Installed); case PluginsState.NotInstalledOnly: return(!pluginDescriptor.Installed); default: throw new Exception("Not supported LoadPluginsMode"); } }
public PluginDescriptor GetPluginDescriptorBySystemName(string systemName, PluginsState pluginState = PluginsState.InstalledOnly) { return(_plugins.FirstOrDefault(p => CheckLoadMode(p, pluginState) && p.SystemName == systemName)); }
public IEnumerable <PluginDescriptor> GetPluginDescriptors(PluginsState pluginState = PluginsState.InstalledOnly, string group = null) { return(_plugins.Where(p => CheckLoadMode(p, pluginState) && CheckGroup(p, group))); }