基本信息
源码名称:UU云远程打码工具源码
源码大小:0.03M
文件格式:.rar
开发语言:C#
更新时间:2014-01-20
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 1 元×
微信扫码支付:1 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
远程调用UU云进行远程打码的工具源码,C#编写
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Drawing.Imaging; using System.Threading; using System.Diagnostics; using System.Security.Cryptography; namespace UUWiseCSWrapper { public partial class Form1 : Form { static int SoftID = 0; static string SoftKey = ""; bool isLogin = false; int codeType = 1004; int m_codeID; //static UUWiseHelperLib.CaptchaRecognizerClass c = new UUWiseHelperLib.CaptchaRecognizerClass(); public Form1() { InitializeComponent(); } /// <summary> /// 登陆测试 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { /* 优优云DLL 文件MD5值校验 * 用处:近期有不法份子采用替换优优云官方dll文件的方式,极大的破坏了开发者的利益 * 用户使用替换过的DLL打码,导致开发者分成变成别人的,利益受损, * 所以建议所有开发者在软件里面增加校验官方MD5值的函数 * 如何获取文件的MD5值,通过下面的GetFileMD5(文件)函数即返回文件MD5 */ string DLLPath = System.Environment.CurrentDirectory "\\UUWiseHelper.dll"; string Md5 = GetFileMD5(DLLPath); string AuthMD5 = "79dd7e248b7ec70e2ececa19b51c39c6";//作者在编写软件时内置的比对用DLLMD5值,不一致时将禁止登录,具体需要各位自己先获取使用的DLL的MD5验证字符串 if (Md5 != AuthMD5) { MessageBox.Show("此软件使用的是UU云1.1.0.9动态链接库版DLL,与您目前软件内DLL版本不符,请前往http://www.uuwise.com下载更换此版本DLL"); return; } if (!CheckSid()) return; string u = tbxUsername.Text.Trim(); string p = tbxPasswd.Text.Trim(); int res = Wrapper.uu_login(u, p); if (res > 0) isLogin = true; DelegateSetRtbText("登录返回结果:" res.ToString() "," (isLogin ? "登陆成功" : "登录失败")); } /// <summary> /// 识别测试 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSltCodeImg_Click(object sender, EventArgs e) { if (!CheckSid()) return; using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Title = "选择验证码图片"; dlg.Filter = "图片文件 (*.jpg)|*.jpg|所有文件 (*.*)|*.*"; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { tbxCodeImgPath.Text = dlg.FileName; pictureBox2.Image = Image.FromFile(dlg.FileName); } } } bool CheckSid() { if (SoftID <= 0) { MessageBox.Show("请先设置软件id"); return false; } if (string.IsNullOrEmpty(SoftKey)) { MessageBox.Show("请先设置软件key"); return false; } return true; } private void btnSetSoftInfo_Click(object sender, EventArgs e) { try { SoftID = int.Parse(txtSoftID.Text); SoftKey = txtSoftKey.Text; } catch { MessageBox.Show("无效的软件id"); return; } Wrapper.uu_setSoftInfo(SoftID, SoftKey); DelegateSetRtbText("软件信息设置成功"); } private void btnGetScore_Click(object sender, EventArgs e) { int score = Wrapper.uu_getScore(tbxUsername.Text, tbxPasswd.Text); DelegateSetRtbText("当前可用题分:" score.ToString()); } private void btnUserReg_Click(object sender, EventArgs e) { string userName = tbxUsername.Text; string pass = tbxPasswd.Text; if (string.IsNullOrEmpty(userName)) { MessageBox.Show("用户名不能为空"); return; } if (string.IsNullOrEmpty(pass)) { MessageBox.Show("对不起,请输入密码"); return; } if (string.IsNullOrEmpty(txtSoftID.Text)) { MessageBox.Show("请输入软件id"); return; } if (string.IsNullOrEmpty(txtSoftKey.Text)) { MessageBox.Show("请输入软件key"); return; } int sid = int.Parse(txtSoftID.Text); string key = txtSoftKey.Text; int result = Wrapper.uu_reguser(userName, pass, sid, key); MessageBox.Show("返回结果:" result.ToString()); } private void btnPay_Click(object sender, EventArgs e) { string cardNum = txtCardNum.Text; string userName = txtPayUserName.Text; if (string.IsNullOrEmpty(cardNum)) { MessageBox.Show("充值卡不能为空"); return; } if (string.IsNullOrEmpty(userName)) { MessageBox.Show("对不起,请输入要充值的用户"); return; } if (string.IsNullOrEmpty(txtSoftID.Text)) { MessageBox.Show("请输入软件id"); return; } if (string.IsNullOrEmpty(txtSoftKey.Text)) { MessageBox.Show("请输入软件key"); return; } int sid = int.Parse(txtSoftID.Text); string key = txtSoftKey.Text; int result = Wrapper.uu_pay(userName, cardNum, sid, key); MessageBox.Show("返回结果:" result.ToString()); } private void button1_Click(object sender, EventArgs e) { using (FolderBrowserDialog dlg = new FolderBrowserDialog()) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DirectoryInfo dir = new DirectoryInfo(dlg.SelectedPath); richTextBox1.BeginInvoke(new EventHandler(delegate { richTextBox1.Text = string.Format("当前路径:{0}\r\n", dir.FullName); })); //tbxImgPath.Text = dlg.SelectedPath; } } } void DelegateSetRtbText(string text) { DelegateSetRtbText(text, true); } void DelegateSetRtbText(string text, bool isNewLine) { this.richTextBox1.BeginInvoke(new EventHandler(delegate { if (isNewLine) richTextBox1.Text = string.Format("\r\n{0}: {1}", DateTime.Now.ToString("HH:mm:ss"), text); else richTextBox1.Text = string.Format("{0}", text); richTextBox1.Select(richTextBox1.TextLength, richTextBox1.TextLength); richTextBox1.ScrollToCaret(); })); } void SetLabelText(Label lbl) { lbl.Invoke(new EventHandler(delegate { lbl.Text = (int.Parse(lbl.Text) 1).ToString(); })); } private void button5_Click(object sender, EventArgs e) { if (!isLogin) { MessageBox.Show("请先登录优优云."); return; } int.TryParse(textBox3.Text, out codeType); Image img = null; if (rb1.Checked) { img = pictureBox1.Image; } else if (rb2.Checked) { if (string.IsNullOrEmpty(tbxCodeImgPath.Text)) { MessageBox.Show("请先选择图片"); return; } img = Image.FromFile(tbxCodeImgPath.Text); } if (!checkBox1.Checked) { Stopwatch sw = new Stopwatch(); sw.Start(); if (rb4.Checked && rb2.Checked) { StringBuilder result = new StringBuilder(); int codeId = Wrapper.uu_recognizeByCodeTypeAndPath(tbxCodeImgPath.Text, codeType, result); m_codeID = codeId; DelegateSetRtbText(string.Format("Code ID:{0}, 识别结果:{1}", codeId, result.ToString())); } else if (rb3.Checked) { StringBuilder result = new StringBuilder(); int codeId = Wrapper.uu_recognizeByCodeTypeAndUrl(this.textBox2.Text, string.Empty, codeType, string.Empty, result); m_codeID = codeId; DelegateSetRtbText(string.Format("Code ID:{0}, 识别结果:{1}", codeId, result.ToString())); } else { MemoryStream ms = new MemoryStream(); img.Save(ms, ImageFormat.Jpeg); byte[] buffer = new byte[ms.Length]; ms.Position = 0; ms.Read(buffer, 0, buffer.Length); ms.Flush(); StringBuilder res = new StringBuilder(); int codeId = Wrapper.uu_recognizeByCodeTypeAndBytes(buffer, buffer.Length, codeType, res); m_codeID = codeId; DelegateSetRtbText(string.Format("Code ID:{0}, 识别结果:{1}", codeId, res.ToString())); ms.Close(); ms.Dispose(); //img.Dispose(); } sw.Stop(); DelegateSetRtbText(string.Format(", 本次识别耗时: {0}毫秒, {1}秒", sw.ElapsedMilliseconds, (sw.ElapsedMilliseconds / (float)1000).ToString("F2")), false); } else { int threads = 20; int.TryParse(textBox1.Text, out threads); Thread t = new Thread(new ParameterizedThreadStart(ThreadsTest)); t.IsBackground = true; t.Start(new object[] { threads, img, rb3.Checked, textBox2.Text }); } } void ThreadsTest(object param) { object[] parameter = (object[])param; int threads = Convert.ToInt32(parameter[0].ToString()); Image img = parameter[1] as Image; bool isUrlCaptcha = Convert.ToBoolean(parameter[2]); string captchaUrl = parameter[3].ToString(); MemoryStream ms = new MemoryStream(); if (!isUrlCaptcha) img.Save(ms, ImageFormat.Jpeg); for (int i = 0; i < threads; i ) { Thread t = new Thread(new ThreadStart(delegate { Stopwatch sw = new Stopwatch(); sw.Start(); int codeId = 0; StringBuilder result = new StringBuilder(); if (!isUrlCaptcha) { byte[] buffer = new byte[ms.Length]; ms.Position = 0; ms.Read(buffer, 0, buffer.Length); ms.Flush(); codeId = Wrapper.uu_recognizeByCodeTypeAndBytes(buffer, buffer.Length, codeType, result); //ms.Close(); //ms.Dispose(); } else { codeId = Wrapper.uu_recognizeByCodeTypeAndUrl(captchaUrl, string.Empty, codeType, string.Empty, result); } sw.Stop(); richTextBox1.BeginInvoke(new EventHandler(delegate { //SetLabelText(label11); string text = string.Format("\r\n{2}: Code ID:{0}, 识别结果:{1}", codeId.ToString(), result, DateTime.Now.ToString("HH:mm:ss")); richTextBox1.Text = text; richTextBox1.Text = string.Format(", 本次识别耗时: {0}毫秒, {1}秒", sw.ElapsedMilliseconds, (sw.ElapsedMilliseconds / (float)1000).ToString("F2")); richTextBox1.Select(richTextBox1.Text.Length - text.Length, text.Length); richTextBox1.SelectionColor = Color.Black; richTextBox1.Select(richTextBox1.TextLength, 0); richTextBox1.ScrollToCaret(); })); })); t.IsBackground = true; t.Start(); //Thread.Sleep(1000); } } private void button3_Click(object sender, EventArgs e) { richTextBox1.Clear(); } private void button4_Click(object sender, EventArgs e) { System.Environment.Exit(System.Environment.ExitCode); this.Dispose(); this.Close(); } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("http://www.uuwise.com/price.html"); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { System.Diagnostics.Process.Start("http://www.uuwise.com"); } catch (Exception) { Clipboard.SetText("http://www.uuwise.com"); MessageBox.Show("网址已经成功复制,请粘贴到浏览器内浏览。"); } } private void button1_Click_1(object sender, EventArgs e) { Wrapper.uu_SysCallOneParam(1, 1); } private void reportErrBtn_Click(object sender, EventArgs e) { int iResult = Wrapper.uu_reportError(m_codeID); if (0 == iResult) DelegateSetRtbText("报错成功!"); else DelegateSetRtbText(string.Format("报错失败!错误代码为:{0}", iResult)); } #region 根据路径获取文件MD5 /// <summary> /// 获取文件MD5校验值 /// </summary> /// <param name="filePath">校验文件路径</param> /// <returns>MD5校验字符串</returns> private string GetFileMD5(string filePath) { FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] md5byte = md5.ComputeHash(fs); int i, j; StringBuilder sb = new StringBuilder(16); foreach (byte b in md5byte) { i = Convert.ToInt32(b); j = i >> 4; sb.Append(Convert.ToString(j, 16)); j = ((i << 4) & 0x00ff) >> 4; sb.Append(Convert.ToString(j, 16)); } return sb.ToString(); } #endregion } }