ln.types/rpc/RPCCall.cs

56 lines
1.6 KiB
C#

using System;
namespace ln.types.rpc
{
public class RPCCall
{
public object Identifier { get; set; }
public String ModuleName { get; set; }
public string MethodName { get; set; }
public object[] Parameters { get; set; }
public RPCCall()
{
Identifier = Guid.NewGuid();
}
/*
public RPCCall(JObject json)
{
if (json.ContainsKey("id"))
{
switch (json["id"].Type)
{
case JTokenType.Integer:
Identifier = json["id"].ToObject<int>();
break;
case JTokenType.Float:
Identifier = json["id"].ToObject<float>();
break;
case JTokenType.String:
Identifier = json["id"].ToObject<string>();
break;
default:
throw new NotSupportedException(String.Format("JToken {0} is not supported as RPCCall.Identifier",json["id"]));
}
}
else
{
Identifier = Guid.NewGuid();
}
if (json.ContainsKey("module"))
ModuleName = json["module"].ToObject<string>();
if (json.ContainsKey("method"))
MethodName = json["method"].ToObject<string>();
if (json.ContainsKey("parameters"))
Parameters = json["parameters"].ToObject<object[]>();
else
Parameters = new object[0];
}
*/
}
}