protected void loadByJsonData(SdNode config, String json) { ONode list = null; ONode obj = ONode.tryLoad(json); if (obj.isObject) { list = obj.get("list").asArray(); if (TextUtils.isEmpty(name)) { name = obj.get("name").getString(); logo = obj.get("logo").getString(); } } else { list = obj; } foreach (ONode n in list) { TxtModel txt = new TxtModel(referer, n.get("d").getString(), n.get("t").getInt(), n.get("c").getString()); items.Add(txt); } }
public virtual void loadByJson(SdNode config, params string[] jsons) { if (jsons == null || jsons.Length == 0) { return; } foreach (String json in jsons) { if (json.StartsWith("{") || json.StartsWith("[")) { ONode jList = null; ONode obj = ONode.tryLoad(json); if (obj.isObject) { jList = obj.get("list").asArray(); if (TextUtils.isEmpty(name)) { name = obj.get("name").getString(); logo = obj.get("logo").getString(); } } else { jList = obj; } foreach (ONode n1 in jList) { items.Add(new MediaModel(n1.get("url").getString(), n1.get("type").getString(), n1.get("mime").getString(), n1.get("logo").getString())); } } else { foreach (String url in json.Split(';')) { if (url.Length > 6) { items.Add(new MediaModel(url)); } } } } }
protected void loadByJsonData(SdNode config, String json, StateTag state) { ONode list = null; ONode obj = ONode.tryLoad(json); if (obj.isObject) { list = obj.get("list").asArray(); String bg = obj.get("bg").getString(); if (TextUtils.isEmpty(bg) == false) { bgUrl = bg; } if (TextUtils.isEmpty(name)) { name = obj.get("name").getString(); logo = obj.get("logo").getString(); } } else { list = obj; } foreach (ONode n in list) { PicModel pic = null; if (n.isObject) { pic = new PicModel(section(), n.get("url").getString(), n.get("time").getInt(), state.value); } else { pic = new PicModel(section(), n.getString(), 0, state.value); } pic.cacheID = items.Count; doAddItem(pic, state); state.value++; } }
protected void loadByJsonData(SdNode config, String json) { ONode data = ONode.tryLoad(json); if (DdSource.isBook(config)) { if (TextUtils.isEmpty(shop)) { logo = data.get("logo").getString(); name = data.get("name").getString(); shop = data.get("shop").getString(); intro = data.get("intro").getString(); buyUrl = data.get("buyUrl").getString(); } } ONode sl = data.get("pictures").asArray(); foreach (ONode n in sl) { PicModel pic = new PicModel(bookUrl, n.getString()); pictures.Add(pic); } }
public virtual void loadByJson(SdNode config, params String[] jsons) { if (jsons == null || jsons.Length == 0) { return; } if (DdSource.isBook(config)) { String json = jsons[0]; //不支持多个数据块加载 ONode data = ONode.tryLoad(json); name = data.get("name").getString(); author = data.get("author").getString(); intro = data.get("intro").getString(); logo = data.get("logo").getString(); updateTime = data.get("updateTime").getString(); isSectionsAsc = data.get("isSectionsAsc").getInt() > 0;//默认为倒排 } foreach (String json in jsons) //支持多个数据块加载 { ONode data = ONode.tryLoad(json); ONode sl = data.get("sections").asArray(); foreach (ONode n in sl) { SectionModel sec = newSection(); sec.name = n.get("name").getString(); sec.url = n.get("url").getString(); sec.bookName = name; sec.bookUrl = bookUrl; sec.orgIndex = total(); sections.Add(sec); onAddItem(sec); } } }