void OnProcessChanged(string msg) { JsonNode node = new JsonNode(); int i = 0; node.Parse(msg, ref i); int download = int.Parse(node.Find("progress").value); int total = int.Parse(node.Find("total").value); int iPercent = 100 * download / total; if (m_slUpdateBar) { m_slUpdateBar.value = (float)download / (float)total; if (m_slUpdateBar.value > 0 && m_slUpdateBar.value < 0.022f) { m_slUpdateBar.value = 0.022f; } } if (m_lbUpdateInfo) { m_lbUpdateInfo.text = "APP更新...[" + iPercent + "%]"; } }
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); } }