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