コード例 #1
0
ファイル: JsonMethod.cs プロジェクト: Dimidx/xbmc-json
        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);
        }
コード例 #2
0
ファイル: JsonRpc.cs プロジェクト: Dimidx/xbmc-json
        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);
        }