Beispiel #1
0
        /// <summary>
        /// 解析
        /// </summary>
        /// <param name="xml"></param>
        public SdSource(String xml) {
            Util.tryInitCache();

            main = new SdNodeSet(this);

            var root =  XDocument.Parse(xml).Root;
            
            ver = int.Parse(root.Attribute("ver").Value.Trim());
            sds = root.Attribute("sds")?.Value;
            isDebug = "1".Equals(root.Attribute("debug")?.Value);
            isPrivate = "1".Equals(root.Attribute("private")?.Value);

            expr = root.Element("expr").Value.Trim();
            url = root.Element("url").Value.Trim();
            url_md5 = Util.md5(url);


            title = root.Element("title").Value.Trim();
            intro = root.Element("intro").Value.Trim();
            alert = root.Element("alert")?.Value.Trim();

            logo = root.Element("logo").Value.Trim();
            encode = root.Element("encode").Value.Trim();
            _ua = root.Element("ua").Value.Trim();
            
            jscript = new SdJscript(this, root.Element("jscript"));

            XElement xMain = root.Element("main");
            dtype = int.Parse(xMain.Attribute("dtype").Value);
            main.loadByElement(xMain);

            js = new JsEngine();
            jscript.loadJs(js);
        }
Beispiel #2
0
        public void DoLoad()
        {
            xmlHeadName   = attrs.getString("head", xmlHeadName);
            xmlBodyName   = attrs.getString("body", xmlBodyName);
            xmlScriptName = attrs.getString("script", xmlScriptName);

            head = Util.createNodeSet(this);
            head.buildForNode(root.Element(xmlHeadName));

            body = Util.createNodeSet(this);
            body.buildForNode(root.Element(xmlBodyName));

            if (schema == 0)
            {
                head.attrs = this.attrs;
            }
            else
            {
                head.attrs.addAll(this.attrs);
            }

            title   = head.attrs.getString("title");
            expr    = head.attrs.getString("expr");
            url     = head.attrs.getString("url");
            url_md5 = Util.md5(url);

            _encode = head.attrs.getString("encode");
            _ua     = head.attrs.getString("ua");

            //----------
            //放后面
            //
            js      = new JsEngine(this);
            jscript = new SdJscript(this, root.Element(xmlScriptName));
            jscript.loadJs(js);

            root = null;
        }