Flow.Launcher/Wox/PluginLoader/BasePluginLoader.cs

24 lines
718 B
C#
Raw Normal View History

2013-12-20 11:38:10 +00:00
using System;
using System.Collections.Generic;
2014-01-03 10:16:05 +00:00
using System.Linq;
2014-07-06 14:57:11 +00:00
using System.Text;
2014-01-29 10:33:24 +00:00
using Wox.Plugin;
2014-07-06 14:57:11 +00:00
namespace Wox.PluginLoader
{
2014-07-09 10:15:23 +00:00
public class BasePluginLoader<T> : IPluginLoader where T : BasePlugin, new()
2014-07-06 14:57:11 +00:00
{
2014-07-07 15:05:06 +00:00
public virtual List<PluginPair> LoadPlugin(List<PluginMetadata> pluginMetadatas)
2014-07-06 14:57:11 +00:00
{
2014-07-11 10:36:39 +00:00
string supportedLanguage = new T().SupportedLanguage;
List<PluginMetadata> metadatas = pluginMetadatas.Where(o => supportedLanguage.ToUpper() == o.Language.ToUpper()).ToList();
2014-07-06 14:57:11 +00:00
2014-07-09 15:44:57 +00:00
return metadatas.Select(metadata => new PluginPair()
{
2014-07-11 10:36:39 +00:00
Plugin = new T(),
2014-07-09 15:44:57 +00:00
Metadata = metadata
}).ToList();
2014-07-06 14:57:11 +00:00
}
}
2013-12-20 11:38:10 +00:00
}