PowerToys/Wox.Core/Plugin/JsonRPCPluginLoader.cs

22 lines
762 B
C#
Raw Normal View History

2014-12-26 19:36:43 +08:00
using System.Collections.Generic;
using System.Linq;
using Wox.Plugin;
namespace Wox.Core.Plugin
{
internal class JsonRPCPluginLoader<T> : IPluginLoader where T : JsonRPCPlugin, new()
{
2015-10-31 04:42:21 +08:00
public IEnumerable<PluginPair> LoadPlugin(List<PluginMetadata> pluginMetadatas)
2014-12-26 19:36:43 +08:00
{
T jsonRPCPlugin = new T();
List<PluginMetadata> jsonRPCPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == jsonRPCPlugin.SupportedLanguage.ToUpper()).ToList();
return jsonRPCPluginMetadatas.Select(metadata => new PluginPair()
{
Plugin = new T(), //every JsonRPC plugin should has its own plugin instance
2014-12-26 19:36:43 +08:00
Metadata = metadata
}).ToList();
}
}
}