Esempio n. 1
0
        public virtual string ParseXmlResult(string res, string resFind)
        {
            int idxOf = res.IndexOf("?>");

            if (idxOf > 5)
            {
                if (idxOf < 50)
                {
                    string prefix = ""; // res.Substring(0, idxOf + 2);
                    res = res.Substring(idxOf + 2);
                    res = prefix + "<node>" + res + "</node>";
                }
            }
            var nodes = StaticXMLUtils.getNode(res);
            var body  = StaticXMLUtils.FindNode("body", nodes, null, 10);

            if (body != null)
            {
                nodes = body;
            }
            var text_result = StaticXMLUtils.FindNode(resFind, nodes, null, 10);

            if (text_result == null)
            {
                text_result = body;
            }
            if (text_result != null)
            {
                var    res2 = StaticXMLUtils.VisibleRendering(text_result.ChildNodes, PASS1);
                string s    = res2.Split(new string[] { "<div id=\"ga_mainDebug" }, StringSplitOptions.RemoveEmptyEntries)[0];
                // StaticXMLUtils.InnerXmlText(text_result);
                //if (s.Contains("<"))
                {
                    try
                    {
                        var s2 =
                            StaticXMLUtils.VisibleRendering(
                                StaticXMLUtils.getNode("<node>" + HttpUtil.GetWellFormedHTML("<node>" + s + "</node>", null) + "</node>").ChildNodes, PASS2);
                        if (!IsNullOrEmpty(s2))
                        {
                            s = s2;
                        }
                    }
                    catch
                    {
                    }
                }
                return(s);
            }
            TheBot.writeToLog(GetServiceName() + ": unused " + res);
            return(null);
        }
Esempio n. 2
0
 public void WriteLine(string s, params object[] args)
 {
     s = TextPatternUtils.SafeFormat(s, args);
     if (s.StartsWith("Trace"))
     {
         return;
     }
     if (s.StartsWith("Debug"))
     {
         return;
     }
     TheBot.writeToLog("HTTPD: " + s);
 }
Esempio n. 3
0
 private object ExecCycQuery(string cmd, Request user)
 {
     try
     {
         if (String.IsNullOrEmpty(cmd))
         {
             return("NIL");
         }
         Unifiable ss = EvalSubL("(cyc-query '" + cmd + " #$EverythingPSC)", null);
         if (Unifiable.IsFalse(ss))
         {
             return(Unifiable.Empty);
         }
         return(ss);
     }
     catch (Exception e)
     {
         TheBot.writeToLog(e);
         string s = "ExecCycQuery: " + e;
         AltBot.writeDebugLine(s);
         writeToLog(s);
         return(null);
     }
 }