Beispiel #1
0
        public static JsonMethod JsonMethodFromJsonObject(JObject item)
        {
            JsonMethod e = new JsonMethod(
                item["command"].Value <JValue>().Value.ToString(),
                item["description"].Value <JValue>().Value.ToString(),
                item["permission"].Value <JValue>().Value.ToString()
                );

            return(e);
        }
Beispiel #2
0
        public List <JsonMethod> Introspect()
        {
            var args = new JObject();

            args.Add(new JProperty("getdescriptions", true));
            args.Add(new JProperty("getpermissions", true));
            args.Add(new JProperty("filterbytransport", true));

            JObject           query = (JObject)Client.Invoke("JSONRPC.Introspect", args);
            List <JsonMethod> list  = new List <JsonMethod>();

            if (query["commands"] != null)
            {
                foreach (JObject item in (JArray)query["commands"])
                {
                    list.Add(JsonMethod.JsonMethodFromJsonObject(item));
                }
            }

            return(list);
        }