public void CommentClass() { if (PageStr.IndexOf("已经评价过") != -1) { MessageBox.Show("已经完成评价任务,无需评教!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } for (int i = 0; i < LinkStr.Count; i++) { if (IsComment[i] == true) { continue; } string url = "http://ojjx.wzu.edu.cn/" + LinkStr[i]; if (Comment(url)) { IsComment[i] = true; } else { IsComment[i] = false; } } }
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); } } }