PowerToys/Wox/PluginLoader/PythonPluginWrapper.cs

44 lines
1.3 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
2014-07-06 22:57:11 +08:00
using System.IO;
2014-01-15 22:45:02 +08:00
using System.Linq;
2014-07-06 22:57:11 +08:00
using System.Threading;
2014-01-11 00:19:14 +08:00
using Python.Runtime;
2014-01-29 18:33:24 +08:00
using Wox.Plugin;
2014-07-06 22:57:11 +08:00
using Wox.Helper;
using Wox.RPC;
2014-01-29 18:33:24 +08:00
namespace Wox.PluginLoader
{
2014-07-06 22:57:11 +08:00
public class PythonPluginWrapper : BasePluginWrapper
{
2014-07-06 22:57:11 +08:00
private static string woxDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
2014-07-06 22:57:11 +08:00
public override List<string> GetAllowedLanguages()
{
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
};
}
2014-07-06 22:57:11 +08:00
protected override string GetFileName()
2014-01-11 00:19:14 +08:00
{
2014-07-06 22:57:11 +08:00
return Path.Combine(woxDirectory, "PYTHONTHOME\\Scripts\\python.exe");
}
2014-07-06 22:57:11 +08:00
protected override string GetQueryArguments(Query query)
{
2014-07-06 22:57:11 +08:00
return string.Format("{0} \"{1}\"",
context.CurrentPluginMetadata.ExecuteFilePath,
JsonRPC.GetRPC("query", query.GetAllRemainingParameter()));
2014-01-11 00:19:14 +08:00
}
2014-07-06 22:57:11 +08:00
protected override string GetActionJsonRPCArguments(ActionJsonRPCResult result)
{
2014-07-06 22:57:11 +08:00
return string.Format("{0} \"{1}\"", context.CurrentPluginMetadata.ExecuteFilePath,
result.ActionJSONRPC);
}
}
}