${REST_Query_ResourceInfo_Title}

${REST_Query_ResourceInfo_Description}

示例#1
0
        /// <summary>${REST_ThemeResult_method_FromJson_D}</summary>
        /// <returns>${REST_ThemeResult_method_FromJson_return}</returns>
        /// <param name="jsonResult">${REST_ThemeResult_method_FromJson_param_jsonObject}</param>
        internal static ThemeResult FromJson(string jsonResult)
        {
            JsonObject resultObject = JsonObject.Parse(jsonResult);
            ResourceInfo resourceInfo = new ResourceInfo
            {
                NewResourceID = resultObject["newResourceID"].GetStringEx(),
                NewResourceLocation = resultObject["newResourceLocation"].GetStringEx(),
                Succeed = resultObject["succeed"].GetBooleanEx()
            };

            ThemeResult themeResult = new ThemeResult
            {
                ResourceInfo = resourceInfo
            };
            return themeResult;
        }
示例#2
0
        /// <summary>${REST_ResultSet_method_fromJson_D}</summary>
        /// <returns>${REST_ResultSet_method_fromJson_return}</returns>
        /// <param name="json">${REST_ResultSet_method_fromJson_param_jsonObject}</param>
        internal static QueryResult FromJson(JsonObject json)
        {
            if (json == null)
            {
                return null;
            }

            QueryResult result = new QueryResult();

            if (json.ContainsKey("totalCount") && json.ContainsKey("currentCount") && json.ContainsKey("customResponse") && json.ContainsKey("recordsets"))
            {
                result.TotalCount = (int)json["totalCount"].GetNumberEx();

                if ((int)json["totalCount"].GetNumberEx() == 0)
                {
                    return null;
                }

                result.CurrentCount = (int)json["currentCount"].GetNumberEx();
                result.CustomResponse = json["customResponse"].GetStringEx();

                JsonArray recordsets = json["recordsets"].GetArray();
                if (recordsets != null && recordsets.Count > 0)
                {
                    result.Recordsets = new List<Recordset>();

                    for (int i = 0; i < recordsets.Count; i++)
                    {
                        result.Recordsets.Add(Recordset.FromJson(recordsets[i].GetObjectEx()));
                    }
                }
                return result;
            }
            else if (json.ContainsKey("succeed") && json.ContainsKey("newResourceLocation"))
            {
                ResourceInfo info = new ResourceInfo();
                info.Succeed = json["succeed"].GetBooleanEx();
                info.NewResourceLocation = json["newResourceLocation"].GetStringEx();
                info.NewResourceID = json["newResourceID"].GetStringEx();
                result.ResourceInfo = info;
                return result;
            }
            return null;
        }