using System; using System.Collections.Generic; using System.Linq; using System.Text; using Wox.Plugin; using Wox.RPC; namespace Wox.PluginLoader { public class BasePluginLoader : IPluginLoader where T : BasePlugin, new() { public virtual List LoadPlugin(List pluginMetadatas) { List plugins = new List(); T pluginWrapper = new T(); List allowedLanguages = pluginWrapper.GetAllowedLanguages(); List metadatas = pluginMetadatas.Where(o => allowedLanguages.Contains(o.Language.ToUpper())).ToList(); foreach (PluginMetadata metadata in metadatas) { PluginPair pair = new PluginPair() { Plugin = pluginWrapper, Metadata = metadata }; plugins.Add(pair); } return plugins; } } }