private void Get_ECardSystem(object obj) { User user = (User)obj; string username = string.Empty; string password = string.Empty; string data = user.data; string res = string.Empty; if (string.IsNullOrEmpty(data)) { data = string.Empty; } Regex reg = new Regex(@"username=(.+?)&password=(.+)"); MatchCollection mcResul = reg.Matches(data); if (mcResul.Count > 0) { username = mcResul[0].Groups[1].Value; password = mcResul[0].Groups[2].Value; } AddContent("收到 [" + user.client.Client.RemoteEndPoint + "][" + username + "] 请求一卡通消费记录"); res = new ECardSystem().Get(username, password); SendToClient(user, res); AddContent("已向 [" + user.client.Client.RemoteEndPoint + "][" + username + "] 发送一卡通消费记录结果"); RemoveUser(user); }
private void Get_ECardSystem(object obj) { MissionInfo info = (MissionInfo)obj; string username = string.Empty; string password = string.Empty; string data = info.MissionData; string res = string.Empty; if (string.IsNullOrEmpty(data)) { data = string.Empty; } Regex reg = new Regex(@"username=(.+?)&password=(.+)"); MatchCollection mcResul = reg.Matches(data); if (mcResul.Count > 0) { username = mcResul[0].Groups[1].Value; password = mcResul[0].Groups[2].Value; } AddTalkMessage("收到 [" + username + "] 请求一卡通消费记录"); res = new ECardSystem().Get(username, password); SendMessage(info.MissionID + "," + res); AddTalkMessage("已向 [" + username + "] 发送一卡通消费记录结果"); }
private void button1_Click(object sender, EventArgs e) { Console.WriteLine("开始获取 - " + DateTime.Now + '.' + DateTime.Now.Millisecond); ECardSystem ecs = new ECardSystem(); textBox1.Text = ecs.Get(textBox2.Text, textBox3.Text); Console.WriteLine("获取完成 - " + DateTime.Now + '.' + DateTime.Now.Millisecond); }