protected override void DoTraceUrl(String url, String args, SdNode config) { if (TextUtils.isEmpty(trace_url) == false) { if (TextUtils.isEmpty(url) == false) { try { var data = new Dictionary <String, String>(); data.Add("_uid", Session.userID + ""); data.Add("_uname", Session.nickname); data.Add("_days", Session.dayNum + ""); data.Add("_vip", Session.isVip + ""); data.Add("url", url); data.Add("args", args); data.Add("node", config.name); HttpUtil.post(trace_url, data, (code, text) => { }); } catch (Exception) { } } } }
private void doAddTagItem(SdNode t1) { if (TextUtils.isEmpty(t1.group) == false) { int temp = tagList.Count % 3; if (temp > 0) { temp = 3 - temp; } while (temp > 0) { tagList.Add(new TagModel("", null, 1, tagList.Count)); temp--; } tagList.Add(new TagModel("", null, 11, tagList.Count)); tagList.Add(new TagModel(t1.group, null, 10, tagList.Count)); tagList.Add(new TagModel("", null, 11, tagList.Count)); } if (TextUtils.isEmpty(t1.title) == false) { tagList.Add(new TagModel(t1.title, t1.url, 0, tagList.Count)); } }
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); } }
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 loadByConfig(SdNode c) { DdNode config = (DdNode)c; if (doFilter(c.title)) { return; } BookSearchModel b = new BookSearchModel(); DdNode cfg = config.s().search; b._dtype = cfg.dtype(); b.btype = cfg.btype(); b.name = c.title; b.url = c.url; b.logo = c.logo; b.updateTime = ""; b.newSection = ""; b.author = ""; b.status = ""; b.source = config.source.title; doAddItem(b); }
public void loadByJson(SdNode config, params String[] jsons) { if (jsons == null || jsons.Length == 0) { return; } foreach (String json in jsons) //支持多个数据块加载 { ONode data = ONode.tryLoad(json).asArray(); if (DdSource.isHots(config)) { foreach (ONode n in data) { BookModel b = new BookModel(); b.name = n.get("name").getString(); b.url = n.get("url").getString(); b.logo = n.get("logo").getString(); hotList.Add(b); } return; } if (DdSource.isUpdates(config)) { foreach (ONode n in data) { BookUpdateModel b = new BookUpdateModel(); b.name = n.get("name").getString(); b.url = n.get("url").getString(); b.logo = n.get("logo").getString(); b.newSection = n.get("newSection").getString(); b.updateTime = n.get("updateTime").getString(); updateList.Add(b); } return; } if (DdSource.isTags(config)) { foreach (ONode n in data) { DdNode t1 = new DdNode(null); t1.title = n.get("title").getString(); t1.url = n.get("url").getString(); t1.group = n.get("group").getString(); t1.logo = n.get("logo").getString(); doAddTagItem(t1); } } } }
public virtual void loadByJson(SdNode config, params String[] jsons) { if (jsons == null || jsons.Length == 0) { return; } foreach (String json in jsons) { loadByJsonData(config, json); } }
/* * 支持 * ["","",""] * 或 * {bg:"",list:["","",""]} * 或 * {bg:"",list:[{url:"",time:"mm::ss.xx"},{...}]} * 或 * {bg:"",logo:"",name:"",list:[{url:"",time:"mm::ss.xx"},{...}]} */ public virtual void loadByJson(SdNode config, params String[] jsons) { if (jsons == null || jsons.Length == 0) { return; } foreach (String json in jsons) { StateTag state = new StateTag(); loadByJsonData(config, json, state); } }
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)); } } } } }
//------------------ // public void loadByConfig(SdNode config) { if (DdSource.isHots(config)) { hotList.Clear(); foreach (SdNode t1 in config.items()) { BookModel b = new BookModel(); b.name = t1.title; b.url = t1.url; b.logo = t1.logo; hotList.Add(b); } return; } if (DdSource.isUpdates(config)) { updateList.Clear(); foreach (SdNode t1 in config.items()) { BookUpdateModel b = new BookUpdateModel(); b.name = t1.title; b.url = t1.url; b.logo = t1.logo; updateList.Add(b); } return; } if (DdSource.isTags(config)) { tagList.Clear(); foreach (SdNode t1 in config.items()) { doAddTagItem(t1); } return; } }
public virtual void loadByJson(SdNode c, params string[] jsons) { if (jsons == null || jsons.Length == 0) { return; } DdNode config = (DdNode)c; foreach (String json in jsons) //支持多个数据块加载 { ONode data = ONode.tryLoad(json); if (data.isArray) { foreach (ONode n in data) { String name = n.get("name").getString(); if (doFilter(name)) { continue; } BookSearchModel b = new BookSearchModel(); b.name = name; b.url = n.get("url").getString(); b.logo = n.get("logo").getString(); b.updateTime = n.get("updateTime").getString(); b.newSection = n.get("newSection").getString(); b.author = n.get("author").getString(); b.status = n.get("status").getString(); b.source = config.source.title; b.btag = n.get("btag").getString(); DdNode cfg = config.s().book(b.url); b._dtype = cfg.dtype(); b.btype = cfg.btype(); doAddItem(b); } } } }
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++; } }
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); } } }
public void loadByJson(SdNode c, params string[] jsons) { if (jsons == null || jsons.Length == 0) { return; } foreach (String json in jsons) //支持多个数据块加载 { ONode data = ONode.tryLoad(json); if (data.isArray) { foreach (ONode n in data) { String name = n.get("name").getString(); if (Session.isVip == 0 && SourceApi.isFilter(name)) //非vip进行过滤 { continue; } BookUpdateModel b = new BookUpdateModel(); b.name = name; b.url = n.get("url").getString(); b.logo = n.get("logo").getString(); b.author = n.get("author").getString(); b.newSection = n.get("newSection").getString(); b.updateTime = n.get("updateTime").getString(); b.status = n.get("status").getString(); list.Add(b); } } } }
public virtual void loadByConfig(SdNode config) { }
public static bool isHots(SdNode node) { return("hots".Equals(node.name)); }
public static bool isUpdates(SdNode node) { return("updates".Equals(node.name)); }
public static bool isTags(SdNode node) { return("tags".Equals(node.name)); }
public static bool isBook(SdNode node) { return("book".Equals(node.name)); }
//----------------------------------- // public void loadByConfig(SdNode config) { }