打码平台php源码,打码平台 远程打码 实例源码
【實例簡介】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;
namespace UUWiseCSWrapper
{
public partial class Form1 : Form
{
static int SoftID = 0;
static string SoftKey = "";
//static UUWiseHelperLib.CaptchaRecognizerClass c = new UUWiseHelperLib.CaptchaRecognizerClass();
public Form1()
{
InitializeComponent();
}
///
/// 登陸測試
///
///
///
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();
}
///
/// 識別測試
///
///
///
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("請先設(shè)置軟件id");
return false;
}
if (string.IsNullOrEmpty(SoftKey))
{
MessageBox.Show("請先設(shè)置軟件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("返回結(jié)果:" 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("返回結(jié)果:" 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("當(dāng)前路徑:{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}, 返回結(jié)果:{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();
}));
}
}
}
總結(jié)
以上是生活随笔為你收集整理的打码平台php源码,打码平台 远程打码 实例源码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OpenCore-Legacy-Patc
- 下一篇: android Retrofit下载图片