mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-15 03:59:15 +08:00
24 lines
718 B
C#
24 lines
718 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Wox.Plugin;
|
|
|
|
namespace Wox.PluginLoader
|
|
{
|
|
public class BasePluginLoader<T> : IPluginLoader where T : BasePlugin, new()
|
|
{
|
|
public virtual List<PluginPair> LoadPlugin(List<PluginMetadata> pluginMetadatas)
|
|
{
|
|
string supportedLanguage = new T().SupportedLanguage;
|
|
List<PluginMetadata> metadatas = pluginMetadatas.Where(o => supportedLanguage.ToUpper() == o.Language.ToUpper()).ToList();
|
|
|
|
return metadatas.Select(metadata => new PluginPair()
|
|
{
|
|
Plugin = new T(),
|
|
Metadata = metadata
|
|
}).ToList();
|
|
}
|
|
}
|
|
}
|