示例#1
0
文件: ONode.cs 项目: noear/Snacks
        //返回自己
        public ONode set(String key, ONode value)
        {
            tryInitObject();

            _object.set(key, value);
            return(this);
        }
示例#2
0
文件: ONode.cs 项目: noear/Snacks
        //返回自己
        public ONode add(ONode value)
        {
            tryInitArray();

            _array.add(value);

            return(this);
        }
示例#3
0
文件: ONode.cs 项目: noear/Snacks
        //返回新节点
        public ONode add()
        {
            tryInitArray();
            ONode temp = new ONode();

            _array.add(temp);

            return(temp);
        }
示例#4
0
文件: ONode.cs 项目: noear/Snacks
        //返回自己
        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);
            }
        }
示例#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("");
            }
        }
示例#6
0
文件: OObject.cs 项目: noear/Snacks
 public void set(String key, ONode value)
 {
     members[key] = value;
 }
示例#7
0
文件: OObject.cs 项目: noear/Snacks
 public void set(String key, ONode value)
 {
     members[key] = value;
 }
示例#8
0
文件: ONode.cs 项目: noear/Snacks
    //返回新节点
    public ONode add()
    {
        tryInitArray();
            ONode temp = new ONode();
            _array.add(temp);

            return temp;
    }
示例#9
0
文件: ONode.cs 项目: noear/Snacks
    //返回自己
    public ONode add(ONode value)
    {
        tryInitArray();

            _array.add(value);

            return this;
    }
示例#10
0
文件: ONode.cs 项目: noear/Snacks
    //返回自己
    public ONode set(String key, ONode value)
    {
        tryInitObject();

            _object.set(key, value);
            return this;
    }
示例#11
0
文件: ONode.cs 项目: noear/Snacks
    //返回自己
    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;
            }
    }
示例#12
0
文件: OArray.cs 项目: noear/Snacks
 public void add(int index, ONode value)
 {
     elements.Insert(index, value);
 }
示例#13
0
文件: OArray.cs 项目: noear/Snacks
 public void add(ONode value)
 {
     elements.Add(value);
 }
示例#14
0
 public void add(int index, ONode value)
 {
     elements.Insert(index, value);
 }
示例#15
0
 public void add(ONode value)
 {
     elements.Add(value);
 }
示例#16
0
文件: DdSource.cs 项目: noear/SiteD
        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);
        }