Exemple #1
0
        public bool Comment(string url)
        {
            Send_Get Get  = new Send_Get(url);
            string   Page = "";

            if (Get.Get_Status())
            {
                Page = Get.Get_Output();
            }
            else
            {
                Page = "网络错误,请稍后再试!";
                return(false);
            }

            int             nums       = Convert.ToInt32(NumRegex.Match(Page).Value.Replace("value=", "").Replace("\"", ""));
            string          regexstr   = string.Format("name=\".+?\" value=\"{0}\"", nums);
            Regex           ValueRegex = new Regex(regexstr, RegexOptions.Multiline);
            MatchCollection Matchs     = ValueRegex.Matches(Page);//获取所有分数最高的标签
            List <string>   NameList   = new List <string>();

            foreach (Match i in Matchs)
            {
                NameList.Add(NameClassRegex.Match(i.Value).Value.Replace("\"", ""));
            }

            Regex input      = new Regex("<input type=\"hidden\" name=\"__VIEWSTATE\" value=\"(.*?)\" />");
            Regex inputname  = new Regex("name=\".*?\"");
            Regex inputvalue = new Regex("value=\".*?\"");

            string ViewState = input.Match(Page).Value;
            string postvalue = inputname.Match(ViewState).Value.Replace("name=\"", "").Replace("\"", "") + "=" + HttpUtility.UrlEncode(inputvalue.Match(ViewState).Value.Replace("value=\"", "").Replace("\"", ""));

            foreach (string i in NameList)
            {
                postvalue += "&" + HttpUtility.UrlEncode(i) + "=" + nums.ToString();
            }

            postvalue += "&txt_pjxx=&Button1=+%CC%E1+%BD%BB+";
            byte[] arrays = System.Text.Encoding.ASCII.GetBytes(postvalue);

            Send_Post Post = new Send_Post(url, url, arrays);

            if (Post.GetOutPut().IndexOf("提交成功") != -1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        private void GetPageStr()
        {
            Send_Get Get = new Send_Get(LoginInfo.SetUrl(LoginInfo.CommentCode));

            if (Get.Get_Status() == true)
            {
                PageStr = Get.Get_Output();
                if (PageStr.IndexOf("已经评价过") != -1)
                {
                    MessageBox.Show("已经完成评价任务,无需评教!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else if (PageStr.IndexOf("已关闭") != -1)
                {
                    MessageBox.Show("评教系统已关闭,请与相关部门联系!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            else
            {
                PageStr = "网络错误,请稍后重试!";
                return;
            }

            string          TableStr   = TableRegex.Match(PageStr).Value;
            MatchCollection ClassMatch = ClassRegex.Matches(TableStr);

            foreach (Match i in ClassMatch)
            {
                if (i.Value.IndexOf("onclick") == -1)
                {
                    continue;
                }

                NameStr.Add(NameRegex.Match(i.Value).Value.Replace("<td>", "").Replace("</td>", ""));      //课程名称
                LinkStr.Add(LinkRegex.Match(i.Value).Value.Replace("window.open('", "").Replace("'", "")); //链接
                if (i.Value.IndexOf("已评价") == -1)
                {
                    IsComment.Add(false);
                }
                else
                {
                    IsComment.Add(true);
                }
            }
        }
        public GetClassTable(string year, string index)
        {
            WebCode   = "";
            IsSucceed = true;
            IsSame    = true;
            LoginInfo.ClassList.Clear();
            LoginInfo.MaxIndex = -1;
            TermYear           = year;  //形式暂定为\d{4}-\d{4}
            TermIndex          = index; //暂定为单个数字
            CT_Url             = LoginInfo.SetUrl(LoginInfo.ClassTableCode);
            Array.Clear(LoginInfo.ClassTable, 0, LoginInfo.ClassTable.Length);
            Send_Get Get = new Send_Get(CT_Url);

            if (Get.Get_Status() == false)
            {
                IsSucceed = false;
                return;
            }
            WebCode = Get.Get_Output();

            GetKeyTable();
        }
Exemple #4
0
        public GetGrade(string Year, string Term)
        {
            LoginInfo.GradeList.Clear();
            WebCode     = "";
            Url         = LoginInfo.SetUrl(LoginInfo.GradeCode);
            YearOfGrade = Year;//\d{4}-\d{4}
            TermOfGrade = Term;
            IsSucceed   = true;
            IsEmpty     = true;

            Send_Get Get = new Send_Get(Url);

            if (Get.Get_Status() == false)
            {
                IsSucceed = false;
                return;
            }

            WebCode = Get.Get_Output();

            Send_GetGrade_Req();
        }