Example #1
0
 void GetGHomeProductList()
 {
     GHome.GetInstance().GetProductConfig((code, msg, data) =>
     {
         if (code == 0)
         {
             sdMallManager.Instance.m_gHomeProducts.Clear();
             string json       = (string)data["data"];
             JsonNode jsonNODE = new JsonNode();
             int iPOS          = 0;
             jsonNODE.Parse(json, ref iPOS);
             List <JsonNode> lstAREA = new List <JsonNode>();
             jsonNODE.FindListHasAttibuteName("product_code", lstAREA);
             foreach (JsonNode js in lstAREA)
             {
                 sdMallManager.GHomeProduct gHomeProduct = new sdMallManager.GHomeProduct();
                 gHomeProduct.ProductCode = js.Attribute("product_code");
                 gHomeProduct.ItemName    = js.Attribute("item_name");
                 gHomeProduct.price       = int.Parse(js.Attribute("money"));
                 gHomeProduct.type        = int.Parse(js.Attribute("type"));
                 sdMallManager.Instance.m_gHomeProducts.Add(gHomeProduct.ProductCode, gHomeProduct);
             }
             GHOME_CODE = 1;
         }
         else
         {
             SDGlobal.Log("GHome.GetInstance().GetProductConfig() failure");
             GHOME_CODE = -2;
         }
     });
 }
Example #2
0
    public void Parse(string text)
    {
        int      current = 0;
        JsonNode js      = new JsonNode();

        js.Parse(text, ref current);
        JsonNode areas = js.Find("Areas");

        notice        = areas.Attribute("AreaNotice");
        defaultServer = areas.Attribute("DefaultServerID");
        areas.FindListAttribute("address", cdnlist);
        areas.FindListHasAttibuteName("ServerID", serverlist);
        //areas.FindListHasAttibuteName("ServerStatus", serverlist);

        JsonNode PushString = areas.Find("PushString");

        if (PushString != null)
        {
            PushString.FindListAttribute("content", Pushlist);
        }
    }