Beispiel #1
0
        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");
            }
        }
Beispiel #2
0
 public PluginDescriptor GetPluginDescriptorBySystemName(string systemName,
                                                         PluginsState pluginState = PluginsState.InstalledOnly)
 {
     return(_plugins.FirstOrDefault(p => CheckLoadMode(p, pluginState) && p.SystemName == systemName));
 }
Beispiel #3
0
 public IEnumerable <PluginDescriptor> GetPluginDescriptors(PluginsState pluginState = PluginsState.InstalledOnly,
                                                            string group             = null)
 {
     return(_plugins.Where(p => CheckLoadMode(p, pluginState) && CheckGroup(p, group)));
 }