Esempio n. 1
0
        private void Send_GetGrade_Req()
        {
            string PostValue;
            Regex  input      = new Regex("input type=\"hidden\" name=\".*?\" value=\".*?\"");
            Regex  inputname  = new Regex("name=\".*?\"");
            Regex  inputvalue = new Regex("value=\".*?\"");
            Regex  Time       = new Regex("\\d{4}");

            Match yearmatch = Time.Match(YearOfGrade);

            MatchCollection inputmatch = input.Matches(WebCode);

            PostValue  = inputname.Match(inputmatch[0].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=xnd&" + inputname.Match(inputmatch[1].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=&" + inputname.Match(inputmatch[2].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=" + inputvalue.Match(inputmatch[2].Value).ToString().Replace("name=\"", "").Replace("\"", "").Replace("+", "%2b") + "&hidLanguage=&ddlXN=";
            PostValue += yearmatch.Value + "-" + Convert.ToString(Convert.ToInt32(yearmatch.Value) + 1) + "&ddlXQ=" + TermOfGrade + "&ddl_kcxz=&btn_xq=%D1%A7%C6%DA%B3%C9%BC%A8";
            PostValue  = PostValue.Replace("value=", "");
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(PostValue);

            Send_Post Post = new Send_Post(Url, Url, bytes);

            if (Post.GetStatus() == false)
            {
                IsSucceed = false;
                return;
            }

            WebCode = Post.GetOutPut();

            RegexGrade();
        }
Esempio n. 2
0
        private void GetKeyTable()
        {
            string PostValue  = "";
            Regex  input      = new Regex("input type=\"hidden\" name=\".*?\" value=\".*?\"");
            Regex  inputname  = new Regex("name=\".*?\"");
            Regex  inputvalue = new Regex("value=\".*?\"");
            Regex  SelectYear = new Regex("<option selected=\"selected\" value=\"\\d+-\\d+\">");
            Regex  SelectTerm = new Regex("<option selected=\"selected\" value=\"\\d\">");
            Regex  Years      = new Regex("\\d{4}");

            Match  YearMatch = SelectYear.Match(WebCode);
            Match  TermMatch = SelectTerm.Match(WebCode);
            string Year      = YearMatch.Value;
            string Term      = TermMatch.Value;



            if (Year.IndexOf(TermYear) != -1 && Term.IndexOf(TermIndex) != -1)
            {
                RegexClassTable();
                return;
            }

            MatchCollection inputmatch = input.Matches(WebCode);
            Match           yearmatch  = Years.Match(TermYear);

            PostValue  = inputname.Match(inputmatch[0].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=xnd&" + inputname.Match(inputmatch[1].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=&" + inputname.Match(inputmatch[2].Value).ToString().Replace("name=\"", "").Replace("\"", "") + "=" + inputvalue.Match(inputmatch[2].Value).ToString().Replace("name=\"", "").Replace("\"", "").Replace("+", "%2b") + "&xnd=";
            PostValue += yearmatch.Value + "-" + Convert.ToString(Convert.ToInt32(yearmatch.Value) + 1) + "&xqd=" + TermIndex;
            PostValue  = PostValue.Replace("value=", "");
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(PostValue);

            Send_Post Post = new Send_Post(CT_Url, CT_Url, bytes);

            if (Post.GetStatus() == false)
            {
                IsSucceed = false;
                return;
            }
            WebCode = Post.GetOutPut();

            if (WebCode.IndexOf("您本学期课所选学分小于") != -1)
            {
                IsSame = false;
                return;
            }

            RegexClassTable();
        }