Ejemplo n.º 1
0
        internal void GetAnswerFromNet()
        {
            string url = "", html;
            //if (this.JyeID == "") return;
            //string url = "http://www.jyeoo.com/bio2/ques/detail/" + this.JyeID;
            //string html = DgvTools.GetWebClient(url);
            //if (html.Contains("查看本题解析需要") && html.Contains("登录菁优网"))
            //    return;
            //if (IsSelectionItem())
            //    GetSelectionAnswerFromHtml(html);
            //else
            //{
            //    string answer = DgvTools.GetEqualValue(html, "<!--B6-->", "<!--E6-->");
            //    if (answer.Contains("<br />故答案是:<br />"))
            //        answer = answer.Substring("<br />故答案是:<br />".Length);
            //}
            //return;
            string t = Title();

            if (!IsSelectionItem())
            {
                return;
            }
            if (!t.Contains("http://www.jyeoo.com/bio2/report/detail/"))
            {
                return;
            }
            url  = url.Substring(0, "http://www.jyeoo.com/bio2/report/detail/a6898529-4677-4422-a62d-1fb2308d29e1".Length);
            html = DgvTools.GetWebClient(url);
            GetSelectionAnswerFromHtml(html);
        }
Ejemplo n.º 2
0
        private int FenxiCookieWl(string cookie)
        {
            if (cookie == null)
            {
                return(this.wl);
            }
            int wl = Convert.ToInt32(DgvTools.GetEqualValue(cookie, "WL=", ";"));

            return(wl);
        }
Ejemplo n.º 3
0
        private List <string> GetItems(string text)
        {
            List <string> r         = new List <string>();
            string        itembegin = "<fieldset";
            string        itemend   = "</fieldset>";
            int           pos       = 0;

            while (pos >= 0)
            {
                string item = DgvTools.GetEqualValue(text, itembegin, itemend, ref pos) + itemend;
                if (pos == -1)
                {
                    break;
                }
                r.Add(item);
            }
            return(r);
        }
Ejemplo n.º 4
0
        private static string ConstructInsertSQL(string inserttemple, string item, XmlElement xedbroot)
        {
            string sql = inserttemple;

            foreach (XmlElement xe in xedbroot.ChildNodes)
            {
                string colname  = xe.GetAttribute("colname");
                string strbegin = xe.GetAttribute("strbegin");
                string strend   = xe.GetAttribute("strend");
                string multi    = xe.GetAttribute("multimatch");
                if (multi == "T")
                {
                    sql = sql.Replace("[-" + colname + "-]", DgvTools.GetEqualValueMulti(item, strbegin, strend));
                }
                else
                {
                    sql = sql.Replace("[-" + colname + "-]", DgvTools.GetEqualValue(item, strbegin, strend));
                }
            }
            return(sql);
        }
Ejemplo n.º 5
0
 public PaperItem(string s)
 {
     this.s     = s;
     this.JyeID = "";
     if (s.Contains("<input name=\"QA_") && s.Contains("type=\"radio\" class=\"radio\" />"))
     {
         s = Regex.Replace(s, "<input name=\"QA_[^<>]*type=\"radio\" class=\"radio\" />", "");
     }
     //while (s.Contains("<input name=\"QA_") && s.Contains("type=\"radio\" class=\"radio\" />"))
     //    s = Regex.Replace(s, "<input name[^<>]*/>","",RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase);
     if (s.Contains("<fieldset id=\"") && s.Contains("\" class=\"quesborder\" s=\"bio2\">"))
     {
         this.JyeID = s.Substring("<fieldset id=\"".Length, 36);
     }
     BE1 = DgvTools.GetEqualValue(s, B1, E1);
     BE2 = DgvTools.GetEqualValue(s, B2, E2);
     if (BE2 == "")
     {
         int pos = 0;
         while (pos >= 0)
         {
             string item = DgvTools.GetEqualValue(s, BA, EA, ref pos) + EA;
             if (pos == -1)
             {
                 break;
             }
             LEA.Add(item);
             string item2 = DgvTools.GetEqualValue(s, "<div class=\"sanwser\">", "</div>", ref pos) + "</div>";
             if (pos == -1)
             {
                 break;
             }
             LEA2.Add(item2);
         }
     }
     else
     {
         //List<string>
         ABCD = new List <string>();
         string IB  = "<label class=\"";
         string IE  = "</label>";
         int    pos = 0;
         while (pos >= 0)
         {
             string item = DgvTools.GetEqualValue(s, IB, IE, ref pos);
             if (pos == -1)
             {
                 break;
             }
             ABCD.Add(item);
         }
         if (ABCD.Count > 0) //openwidth
         {
             optionwidth = DgvTools.GetEqualValue(BE2, "<td style=\"width:", "%\"");
             if (optionwidth.StartsWith("<td style=\"width:"))
             {
                 optionwidth = optionwidth.Substring("<td style=\"width:".Length);
             }
             if (optionwidth == "")
             {
                 optionwidth = "98";
             }
         }
         //
         string value = "";
         foreach (string str in ABCD)
         {
             string abcd = "";
             if (str.StartsWith("<label class=\" s\">"))
             {
                 abcd    = str.Substring("<label class=\" s\">".Length, 1);
                 value   = str.Substring("<label class=\" s\">".Length + 2);
                 ANSWER += abcd;
             }
             else
             {
                 abcd  = str.Substring("<label class=\"\">".Length, 1);
                 value = str.Substring("<label class=\"\">".Length + 2);
             }
             if (abcd == "A")
             {
                 A = value;
             }
             else if (abcd == "B")
             {
                 B = value;
             }
             else if (abcd == "C")
             {
                 C = value;
             }
             else if (abcd == "D")
             {
                 D = value;
             }
         }
     }
 }
Ejemplo n.º 6
0
        private string FenxiCookie(string cookie)
        {
            string ret = "jyean=" + DgvTools.GetEqualValue(cookie, "jyean=", ";") + ";";

            return(ret);
        }