程序说明:
针对杭州市机动车驾驶员模拟培训预约难的问题,本人开发了此监视工具。
此监视工具仅负责监视某段时间内在线预约网站是否可以预约模拟培训。
只是提示用户某日可以预约,
不会帮助用户进行预约,
更不会收集用户的身份信息。
使用说明:
使用前请先确认电脑可以访问互联网
使用前请先联系作者激活程序!作者QQ 4-1-2-5-8-8-8-0-1
1.选择监视截止日期(程序将监视当前时间与此日期之间的时间段)
2.选择“阶段一”,“阶段二”(即你要预约那个阶段的模拟培训)
3.点击开始监视,系统将执行监视。
4.点击退出,系统将停止监视,并退出
5.点击最小化到托盘,系统将继续监视并最小化到托盘。
如果在此时间段内,有可以预约的机会,
程序将弹出窗口提示用户,并为用户打开网页。
----------------------
因为需要监视报名网站~部分安全软件可能会报毒~请放心使用~
--------------------------------------------------------
代码没做任何整理
一气呵成
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.Net; using System.IO; using System.Text.RegularExpressions; namespace XQCHack { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button3_Click(object sender, EventArgs e) { System.Environment.Exit(0); } private void button2_Click(object sender, EventArgs e) { this.Visible = false; this.ShowInTaskbar = false; notifyIcon1.Visible = true; } private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) { this.Visible = true; this.ShowInTaskbar = true; notifyIcon1.Visible = false; } private void textBox2_TextChanged(object sender, EventArgs e) { try { int sj = Convert.ToInt32(textBox2.Text.Trim()); if (sj < 1) { throw new Exception(); } } catch { MessageBox.Show("请填写有效的监视时间间隔,应大于1分钟。"); return; } } private void Form1_Load(object sender, EventArgs e) { dateTimePicker1.MinDate = DateTime.Now; //dateTimePicker1.Value = DateTime.Now.AddMonths(1); dateTimePicker1.Value = Convert.ToDateTime("2011-09-19"); } private void button1_Click(object sender, EventArgs e) { Thread t = new Thread(new ThreadStart(myThread)); t.Start(); } private void myThread() { int queryTimeSpan = Convert.ToInt32(textBox2.Text.Trim()); DateTime lastTime = DateTime.Now; int queryNum = 0; var nameArr = new string[8]; var urlArr = new string[8]; var personNumArr = new int[8]; nameArr[0] = "公交驾校"; nameArr[1] = "宝捷公司"; nameArr[2] = "新塘驾校"; nameArr[3] = "铁路驾校"; nameArr[4] = "水星阁"; nameArr[5] = "杭汽校"; nameArr[6] = "浙江经职"; nameArr[7] = "交通职高"; for (var i = 1; i <= 6; i++) { urlArr[i - 1] = string.Format("http://www.qc5qc.com/xqc/mlpxmore.php?searchbh=00{0}", i); } urlArr[6] = "http://www.qc5qc.com/xqc/mlpxmore.php?searchbh=008"; urlArr[7] = "http://www.qc5qc.com/xqc/mlpxmore.php?searchbh=011"; personNumArr[0] = 84; personNumArr[1] = 90; personNumArr[2] = 75; personNumArr[3] = 48; personNumArr[4] = 84; personNumArr[5] = 78; personNumArr[6] = 66; personNumArr[7] = 69; while (true) { try { myQuery(dateTimePicker1.Value, nameArr, urlArr, personNumArr); } catch { } queryTimeSpan = Convert.ToInt32(textBox2.Text.Trim()); lastTime = DateTime.Now; queryNum += 1; label4.Invoke( new Action(() => { label4.Text = queryNum.ToString(); }) ); System.Threading.Thread.Sleep(queryNum * queryTimeSpan * 60 * 1000); } } static Regex reg = new Regex(@"(?<=<li.*?>).*?(?=人)"); private void myQuery(DateTime enddate, string[] nameArr, string[] urlArr, int[] personNumArr) { for (var j = 0; j < 8; j++) { HttpWebRequest request = WebRequest.Create(urlArr[j]) as HttpWebRequest; HttpWebResponse response = request.GetResponse() as HttpWebResponse; Stream stream = response.GetResponseStream(); StreamReader reader = new StreamReader(stream, Encoding.Default); string html = reader.ReadToEnd(); stream.Close(); var matches = reg.Matches(html); for (var i = 0; i < matches.Count; i++) { var matchStr = matches[i].Value; var matchArr = matchStr.Split(" 阶段一已预约:".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var num = Convert.ToInt32(matchArr[1]); if (Convert.ToDateTime(matchArr[0]) >= enddate) { break; } if (num < personNumArr[j] && num != 0) { System.Diagnostics.Process.Start(urlArr[j]); var alertStr = string.Format("恭喜你!{0}{1}的预约还没有满~要抓紧时间啊!{2}现在给你打开这个网址", nameArr[j], matchArr[0], System.Environment.NewLine ); MessageBox.Show(alertStr); System.Environment.Exit(0); } } } } } }