Beispiel #1
0
 /// <summary>
 /// 获取所有的小类信息
 /// </summary>
 public void GetComponentInfo()
 {
     //获取版本信息
     HttpBase.GET(PortClass.Instance.Component, (request, response) =>
     {
         if (response == null || !response.IsSuccess)
         {
             DebugManager.Instance.LogError("请求失败!");
             return;
         }
         JsonData Item = JsonMapper.ToObject(response.DataAsText.Trim());
         if (Item["codeMsg"].ToString() != "SUCCESS")
         {
             return;
         }
         JsonData filejson = Item["data"];
         for (int i = 0; i < filejson.Count; i++)
         {
             JsonData temp            = filejson[i];
             CategoryComponentItem ci = new CategoryComponentItem();
             ParseCateCom(temp, ci);
             JsonClass.Instance.ComponentList.Add(ci);
         }
     });
 }
Beispiel #2
0
    /// <summary>
    /// 解析CategoryComponentItem类
    /// </summary>
    /// <param name="item">json文件 </param>
    /// <param name="CI"></param>
    private void ParseCateCom(JsonData item, CategoryComponentItem CI)
    {
        var pids = item["pids"];

        if (pids.Count > 0)
        {
            for (int j = 0; j < pids.Count; j++)
            {
                var pid = int.Parse(pids[j].ToString());
                CI.pids.Add(pid);
            }
        }
        CI.id   = int.Parse(item["id"].ToString());
        CI.name = item["name"].ToString();
        var paths = item["paths"];

        if (paths.Count > 0)
        {
            for (int j = 0; j < paths.Count; j++)
            {
                CI.paths.Add(paths[j].ToString().Substring(1));
            }
        }

        if (item["des"] != null)
        {
            CI.des = item["des"].ToString();
        }
        var previews = item["previews"];

        if (previews.Count > 0)
        {
            for (int j = 0; j < previews.Count; j++)
            {
                CI.previews.Add(ParseComponentFileItem(previews[j]));
            }
        }
        if (item["version"] != null)
        {
            CI.version = item["version"].ToString();
        }
    }