Наследование: org.noear.sited.SdNode
Пример #1
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);
        }
Пример #2
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);
        }