Exemplo n.º 1
0
        //返回自己
        public ONode set(String key, ONode value)
        {
            tryInitObject();

            _object.set(key, value);
            return(this);
        }
Exemplo n.º 2
0
        //返回自己
        public ONode add(ONode value)
        {
            tryInitArray();

            _array.add(value);

            return(this);
        }
Exemplo n.º 3
0
        //返回新节点
        public ONode add()
        {
            tryInitArray();
            ONode temp = new ONode();

            _array.add(temp);

            return(temp);
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        public String getString()
        {
            switch (type)
            {
            case OValueType.Int: return(_int.ToString());

            case OValueType.Long: return(_long.ToString());

            case OValueType.Double: return(_double.ToString());

            case OValueType.String: return(_string);

            case OValueType.Boolean: return(_bool.ToString());

            case OValueType.DateTime: return(ONode.TIME_FORMAT_ACTION(_date));

            default: return("");
            }
        }
Exemplo n.º 6
0
 public void set(String key, ONode value)
 {
     members[key] = value;
 }
Exemplo n.º 7
0
 public void set(String key, ONode value)
 {
     members[key] = value;
 }
Exemplo n.º 8
0
    //返回新节点
    public ONode add()
    {
        tryInitArray();
            ONode temp = new ONode();
            _array.add(temp);

            return temp;
    }
Exemplo n.º 9
0
    //返回自己
    public ONode add(ONode value)
    {
        tryInitArray();

            _array.add(value);

            return this;
    }
Exemplo n.º 10
0
    //返回自己
    public ONode set(String key, ONode value)
    {
        tryInitObject();

            _object.set(key, value);
            return this;
    }
Exemplo n.º 11
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;
            }
    }
Exemplo n.º 12
0
 public void add(int index, ONode value)
 {
     elements.Insert(index, value);
 }
Exemplo n.º 13
0
 public void add(ONode value)
 {
     elements.Add(value);
 }
Exemplo n.º 14
0
 public void add(int index, ONode value)
 {
     elements.Insert(index, value);
 }
Exemplo n.º 15
0
 public void add(ONode value)
 {
     elements.Add(value);
 }
Exemplo n.º 16
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);
        }