public void CanGetBlockCount() { IBitcoinClient client = new BitcoinClient(ConfigUtility.GetConnectionInfo()); IRpcResponse <long> resp = client.GetBlockCount(); Assert.AreEqual("0", resp.Id); Assert.IsTrue(resp.Result > 0); //Console.Write(resp.ToString()); }
public void SetResponse(IRpcResponse response) { if (response.Exception == null) { try { tsc.SetResult(response.GetResult <T>()); } catch (Exception ex) { tsc.SetException(ex); } } else { tsc.SetException(response.Exception); } }
static async Task HandleCommand(dynamic input, IRpcResponse <string> response) { record["status"] = "Handling command"; Console.WriteLine(input.command); ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "node"; psi.Arguments = input.commandParams; psi.UseShellExecute = true; Process proc = new Process { StartInfo = psi }; proc.Start(); response.Send("Process completed"); record["status"] = "Completed"; }
static async Task HandleCommand(string input, IRpcResponse <string> response) { if (string.IsNullOrEmpty(input)) { response.Error("invalid input"); } if (false) { response.Reject(); } switch (input) { case "runProcess": await RunProcess(); break; } response.Send(input); }
public RpcRequestResponse(T1 request, IRpcResponse <T2> response) { this.Request = request; this.Response = response; }
public void OnResponse(IRpcResponse result) { pendingRequests.TryGetValue(result.Id, out var found); pendingRequests.Remove(result.Id); found.SetResponse(result); }