2013-12-20 19:38:10 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2013-12-21 01:20:17 +08:00
|
|
|
|
using IronPython.Hosting;
|
|
|
|
|
using Microsoft.Scripting.Hosting;
|
2013-12-20 19:38:10 +08:00
|
|
|
|
using WinAlfred.Helper;
|
|
|
|
|
using WinAlfred.Plugin;
|
|
|
|
|
|
|
|
|
|
namespace WinAlfred.PluginLoader
|
|
|
|
|
{
|
2013-12-21 01:20:17 +08:00
|
|
|
|
public class PythonPluginLoader : BasePluginLoader
|
2013-12-20 19:38:10 +08:00
|
|
|
|
{
|
|
|
|
|
|
2013-12-21 01:20:17 +08:00
|
|
|
|
public override List<PluginPair> LoadPlugin()
|
2013-12-20 19:38:10 +08:00
|
|
|
|
{
|
2013-12-21 01:20:17 +08:00
|
|
|
|
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.ExecuteFile);
|
|
|
|
|
PluginPair pair = new PluginPair()
|
|
|
|
|
{
|
|
|
|
|
Plugin = python,
|
|
|
|
|
Metadata = metadata
|
|
|
|
|
};
|
|
|
|
|
plugins.Add(pair);
|
|
|
|
|
}
|
2013-12-20 19:38:10 +08:00
|
|
|
|
return plugins;
|
|
|
|
|
}
|
2013-12-21 01:20:17 +08:00
|
|
|
|
|
|
|
|
|
|
2013-12-20 19:38:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|