Files
PowerToys/Wox/RPC/JsonRPC.cs

21 lines
607 B
C#
Raw Normal View History

2014-07-05 23:10:34 +08:00
using System.Collections.Generic;
using System.Linq;
namespace Wox.RPC
{
public class JsonRPC
{
2014-07-07 23:05:06 +08:00
public static string Send(string method, List<string> paras)
2014-07-05 23:10:34 +08:00
{
var list = paras.Select(s => string.Format(@"\""{0}\""", s));
return string.Format(@"{{\""jsonrpc\"": \""2.0\"",\""method\"": \""{0}\"", \""params\"": [{1}], \""id\"": 1}}",
method, string.Join(",", list.ToArray()));
}
2014-07-07 23:05:06 +08:00
public static string Send(string method, string para)
2014-07-05 23:10:34 +08:00
{
2014-07-07 23:05:06 +08:00
return Send(method, new List<string>() { para });
2014-07-05 23:10:34 +08:00
}
}
}