2014-07-07 15:05:06 +00:00
|
|
|
|
using System.Collections.Generic;
|
2014-07-06 14:57:11 +00:00
|
|
|
|
using System.IO;
|
2014-07-09 15:44:57 +00:00
|
|
|
|
using Wox.JsonRPC;
|
2014-01-29 10:33:24 +00:00
|
|
|
|
using Wox.Plugin;
|
2013-12-20 17:20:17 +00:00
|
|
|
|
|
2014-01-29 10:33:24 +00:00
|
|
|
|
namespace Wox.PluginLoader
|
2013-12-20 17:20:17 +00:00
|
|
|
|
{
|
2014-07-09 10:15:23 +00:00
|
|
|
|
public class PythonPlugin : BasePlugin
|
2013-12-20 17:20:17 +00:00
|
|
|
|
{
|
2014-07-06 14:57:11 +00:00
|
|
|
|
private static string woxDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
|
2013-12-20 17:20:17 +00:00
|
|
|
|
|
2014-07-09 15:44:57 +00:00
|
|
|
|
public override string SupportedLanguage
|
2013-12-20 17:20:17 +00:00
|
|
|
|
{
|
2014-07-09 15:44:57 +00:00
|
|
|
|
get { return AllowedLanguage.Python; }
|
2013-12-20 17:20:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-07 15:05:06 +00:00
|
|
|
|
protected override string ExecuteQuery(Query query)
|
2014-01-10 16:19:14 +00:00
|
|
|
|
{
|
2014-07-09 10:15:23 +00:00
|
|
|
|
string fileName = Path.Combine(woxDirectory, "PythonHome\\pythonw.exe");
|
2014-07-07 15:05:06 +00:00
|
|
|
|
string parameters = string.Format("{0} \"{1}\"", context.CurrentPluginMetadata.ExecuteFilePath,
|
2014-07-10 15:57:08 +00:00
|
|
|
|
string.Format(@"{{\""method\"": \""query\"", \""parameters\"": [\""{0}\""]}}",query.GetAllRemainingParameter()));
|
2014-07-09 15:44:57 +00:00
|
|
|
|
|
2014-07-07 15:05:06 +00:00
|
|
|
|
return Execute(fileName, parameters);
|
2014-02-09 12:55:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-09 10:15:23 +00:00
|
|
|
|
protected override string ExecuteAction(JsonRPCRequestModel rpcRequest)
|
2014-02-09 12:55:18 +00:00
|
|
|
|
{
|
2014-07-09 10:15:23 +00:00
|
|
|
|
string fileName = Path.Combine(woxDirectory, "PythonHome\\pythonw.exe");
|
2014-07-09 15:44:57 +00:00
|
|
|
|
string parameters = string.Format("{0} \"{1}\"", context.CurrentPluginMetadata.ExecuteFilePath,rpcRequest);
|
2014-07-07 15:05:06 +00:00
|
|
|
|
return Execute(fileName, parameters);
|
2013-12-20 17:20:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-07 15:05:06 +00:00
|
|
|
|
}
|