找传奇、传世资源到传世资源站!

打码平台 远程打码 实例源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

C# 远程打码 实例项目源码
打码平台 远程打码 实例源码 C#图形和图像处理-第1张
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;namespace UUWiseCSWrapper{ public partial class Form1 : Form { static int SoftID = 0; static string SoftKey = ""; //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) { if (!CheckSid()) return; string u = tbxUsername.Text.Trim(); string p = tbxPasswd.Text.Trim(); int res = Wrapper.uu_login(u, p); rtbLoginResult.Text = res.ToString(); } /// <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; if (radioButton2.Checked) { StringBuilder result = new StringBuilder(); int codeId = Wrapper.uu_recognizeByCodeTypeAndPath(dlg.FileName, 1, result); lblCaptcha.Text = "codeId:" codeId.ToString() ", result:" result.ToString(); } else if (radioButton3.Checked) { Image img = Image.FromFile(dlg.FileName); 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, 1, res); lblCaptcha.Text = "result:" res.ToString() ", codeId:" codeId.ToString(); ms.Close(); ms.Dispose(); img.Dispose(); } } } } 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); } private void btnGetScore_Click(object sender, EventArgs e) { int score = Wrapper.uu_getScore(tbxUsername.Text, tbxPasswd.Text); rtbLoginResult.Text = 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 ThreadsTest(object param) { object[] parameter = (object[])param; DirectoryInfo dir = new DirectoryInfo(parameter[0].ToString()); while (true) { foreach (FileInfo file in dir.GetFiles()) { if (file.Extension.ToLower() == ".jpg") { Thread t = new Thread(new ThreadStart(delegate { StringBuilder result = new StringBuilder(); int codeId = Wrapper.uu_recognizeByCodeTypeAndPath(file.FullName, 1, result); richTextBox1.BeginInvoke(new EventHandler(delegate { SetLabelText(label11); string text = string.Format("识别ID:{0}, 返回结果:{1}", codeId.ToString(), result); richTextBox1.Text = text; richTextBox1.Select(richTextBox1.Text.Length - text.Length, text.Length); richTextBox1.SelectionColor = Color.Black; richTextBox1.Text = "\r\n"; richTextBox1.Select(richTextBox1.TextLength, 0); richTextBox1.ScrollToCaret(); })); })); t.IsBackground = true; t.Start(); } Thread.Sleep(50); } Thread.Sleep(1000 * 60 * 2); } } private void button2_Click(object sender, EventArgs e) { Thread t = new Thread(new ParameterizedThreadStart(ThreadsTest)); t.IsBackground = true; t.Start(new object[] { tbxImgPath.Text }); } void DelegateSetRtbText(string text) { this.richTextBox1.BeginInvoke(new EventHandler(delegate { richTextBox1.Text = text "\r\n"; richTextBox1.Select(0, richTextBox1.TextLength); richTextBox1.ScrollToCaret(); })); } void SetLabelText(Label lbl) { lbl.Invoke(new EventHandler(delegate { lbl.Text = (int.Parse(lbl.Text) 1).ToString(); })); } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复