Example #1
0
        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);
        }
Example #2
0
        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);
                    }
                }
            }
        }
Example #3
0
        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);
                    }
                }
            }
        }