2013-12-20 17:20:17 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2014-07-06 14:57:11 +00:00
|
|
|
|
using System.IO;
|
2014-01-15 14:45:02 +00:00
|
|
|
|
using System.Linq;
|
2014-07-06 14:57:11 +00:00
|
|
|
|
using System.Threading;
|
2014-01-10 16:19:14 +00:00
|
|
|
|
using Python.Runtime;
|
2014-01-29 10:33:24 +00:00
|
|
|
|
using Wox.Plugin;
|
2014-07-06 14:57:11 +00:00
|
|
|
|
using Wox.Helper;
|
|
|
|
|
|
using Wox.RPC;
|
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-06 14:57:11 +00:00
|
|
|
|
public class PythonPluginWrapper : BasePluginWrapper
|
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-06 14:57:11 +00:00
|
|
|
|
public override List<string> GetAllowedLanguages()
|
2013-12-20 17:20:17 +00:00
|
|
|
|
{
|
2014-07-06 14:57:11 +00:00
|
|
|
|
return new List<string>()
|
2013-12-26 16:39:07 +00:00
|
|
|
|
{
|
2014-07-06 14:57:11 +00:00
|
|
|
|
AllowedLanguage.Python
|
|
|
|
|
|
};
|
2013-12-20 17:20:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-06 14:57:11 +00:00
|
|
|
|
protected override string GetFileName()
|
2014-01-10 16:19:14 +00:00
|
|
|
|
{
|
2014-07-06 14:57:11 +00:00
|
|
|
|
return Path.Combine(woxDirectory, "PYTHONTHOME\\Scripts\\python.exe");
|
2014-02-09 12:55:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-06 14:57:11 +00:00
|
|
|
|
protected override string GetQueryArguments(Query query)
|
2014-02-09 12:55:18 +00:00
|
|
|
|
{
|
2014-07-06 14:57:11 +00:00
|
|
|
|
return string.Format("{0} \"{1}\"",
|
|
|
|
|
|
context.CurrentPluginMetadata.ExecuteFilePath,
|
|
|
|
|
|
JsonRPC.GetRPC("query", query.GetAllRemainingParameter()));
|
2014-01-10 16:19:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-06 14:57:11 +00:00
|
|
|
|
protected override string GetActionJsonRPCArguments(ActionJsonRPCResult result)
|
2014-02-09 12:55:18 +00:00
|
|
|
|
{
|
2014-07-06 14:57:11 +00:00
|
|
|
|
return string.Format("{0} \"{1}\"", context.CurrentPluginMetadata.ExecuteFilePath,
|
|
|
|
|
|
result.ActionJSONRPC);
|
2013-12-20 17:20:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|