Example #1
0
 public void set(String key, ONode value)
 {
     members[key] = value;
 }
Example #2
0
    //返回自己
    public ONode add(ONode value)
    {
        tryInitArray();

            _array.add(value);

            return this;
    }
Example #3
0
    //返回新节点
    public ONode add()
    {
        tryInitArray();
            ONode temp = new ONode();
            _array.add(temp);

            return temp;
    }
Example #4
0
    //返回自己
    public ONode set(String key, ONode value)
    {
        tryInitObject();

            _object.set(key, value);
            return this;
    }
Example #5
0
    //返回自己
    public ONode get(String key)
    {
        tryInitObject();

            if (_object.contains(key))
                return _object.get(key);
            else {
                ONode temp = new ONode();
                _object.set(key, temp);
                return temp;
            }
    }
Example #6
0
 public void add(int index, ONode value)
 {
     elements.Insert(index, value);
 }
Example #7
0
 public void add(ONode value)
 {
     elements.Add(value);
 }
Example #8
0
        public DdSource(String xml)
            : base()
        {
            if (xml.StartsWith("sited::")) {
                int start = xml.IndexOf("::") + 2;
                int end = xml.LastIndexOf("::");
                var txt = xml.Substring(start, end - start);
                var key = xml.Substring(end + 2);
                xml = DdApi.unsuan(txt, key);
            }

            sited = xml;

            DoInit(xml);
            if (schema > 0) {
                xmlHeadName = "meta";
                xmlBodyName = "main";
                xmlScriptName = "script";
            }
            else {
                xmlHeadName = "meta";
                xmlBodyName = "main";
                xmlScriptName = "jscript";
            }
            DoLoad();

            meta = (DdNodeSet)head;
            main = (DdNodeSet)body;

            sds = head.attrs.getString("sds");
            isPrivate = head.attrs.getInt("private") > 0;
            engine = head.attrs.getInt("engine");
            ver = head.attrs.getInt("ver");
            vip = head.attrs.getInt("vip");

            author = head.attrs.getString("author");
            contact = head.attrs.getString("contact");

            intro = head.attrs.getString("intro");
            logo = head.attrs.getString("logo");

            if (engine > DdApi.version)
                alert = "此插件需要更高版本引擎支持,否则会出错。建议升级!";
            else
                alert = head.attrs.getString("alert");

            //
            //---------------------
            //
            trace_url = main.attrs.getString("trace");

            home = (DdNodeSet)main.get("home");
            {
                hots = (DdNode)home.get("hots");
                updates = (DdNode)home.get("updates");
                tags = (DdNode)home.get("tags");
            }

            search = (DdNode)main.get("search");

            _tag = main.get("tag");
            _book = main.get("book");
            _section = main.get("section");
            _object = main.get("object");

            if (_object.isEmpty()) {
                if (_section.isEmpty())
                    _object = _book;
                else
                    _object = _section;
            }

            if (schema > 0) {
                login = (DdNode)head.get("login");//登录
                reward = (DdNode)head.get("reward");//打赏
            }
            else {
                login = (DdNode)main.get("login");//登录
                reward = (DdNode)main.get("reward");//打赏
            }

            //-----------
            ONode json = new ONode();
            json.set("ver", DdApi.version);
            json.set("udid", Session.udid());

            json.set("uid", Session.userID);
            json.set("usex", Session.sex);
            json.set("uvip", Session.isVip);
            json.set("ulevel", Session.level);

            String jsCode = "SiteD=" + json.toJson() + ";";

            loadJs(jsCode);
        }