public object Clone() { JsonRpcNotification clone = new JsonRpcNotification(); clone.CopyProperties(this); return(clone); }
public static JsonRpcNotification Create <T>(Incubator serviceProvider, string methodName, params object[] parameters) { JsonRpcNotification result = Create <T>(methodName, parameters); result.Incubator = serviceProvider; return(result); }
protected static internal IJsonRpcRequest ParseRequest(JToken parsed, string json) { bool isNotification = parsed["id"] == null && parsed["Id"] == null; JsonRpcNotification rpcMessage = isNotification ? json.FromJson <JsonRpcNotification>() : json.FromJson <JsonRpcRequest>(); SetParams(parsed, rpcMessage); return(rpcMessage); }
public static JsonRpcRequest Create(Incubator incubator, object id, MethodInfo method, params object[] parameters) { JsonRpcNotification notification = JsonRpcNotification.Create(incubator, method, parameters); JsonRpcRequest request = notification.CopyAs <JsonRpcRequest>(); request.Incubator = incubator; request.Id = id; return(request); }
public static JsonRpcNotification Create(Incubator serviceProvider, MethodInfo method, params object[] parameters) { JsonRpcNotification result = new JsonRpcNotification(); result.Incubator = serviceProvider; result.Method = method.Name; result.RpcParams.By.Position = parameters; result.Params = JToken.Parse(parameters.ToJson()); return(result); }
protected static void SetParams(JToken parsed, JsonRpcNotification notification) { JToken parms = parsed["params"]; if (parms != null) { if (parms.Is <JObject>()) { notification.RpcParams.By = new JsonRpcParameters.Structure { Name = parms }; } else if (parms.Is <JArray>()) { notification.RpcParams.By = new JsonRpcParameters.Structure { Position = parms.ToString().FromJson <object[]>() }; } } }