mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using WinAlfred.Plugin;
|
|
|
|
namespace WinAlfred.PluginLoader
|
|
{
|
|
public class PythonPluginLoader : BasePluginLoader
|
|
{
|
|
public override List<PluginPair> LoadPlugin()
|
|
{
|
|
List<PluginPair> plugins = new List<PluginPair>();
|
|
List<PluginMetadata> metadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.Python.ToUpper()).ToList();
|
|
foreach (PluginMetadata metadata in metadatas)
|
|
{
|
|
PythonPluginWrapper python = new PythonPluginWrapper(metadata);
|
|
PluginPair pair = new PluginPair()
|
|
{
|
|
Plugin = python,
|
|
Metadata = metadata
|
|
};
|
|
plugins.Add(pair);
|
|
}
|
|
|
|
foreach (IPlugin plugin in plugins.Select(pluginPair => pluginPair.Plugin))
|
|
{
|
|
new Thread(plugin.Init).Start();
|
|
}
|
|
return plugins;
|
|
}
|
|
}
|
|
}
|