|
常用名:admins
是否加入组织,加入的话需要填写组织名:
擅长方面:易语言 C# 安卓
发布的软件(任选一款):http://good.gd/2873344.htm(自动标注工具)
基本都会一点
联系方式(QQ):1455536030
申请感言:想和大神们学习进步using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;
namespace 正则表达式
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public int sl = 0;
public int bzs = 0;
private void button1_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
string sql = textBox2.Text;
string title="";
MatchCollection mc = Regex.Matches(sql, textBox1 .Text);
int i = 1;
foreach (Match m in mc)
{
ListViewItem lvi = new ListViewItem(i.ToString(), 0);
lvi.SubItems.Add(m.Groups[0].Value);
lvi.SubItems.Add(m.Groups[2].Value);
lvi.SubItems.Add(m.Groups[3].Value);
lvi.SubItems.Add(m.Groups[4].Value);
//lvi.SubItems.Add(m.Groups[4].Value);
listView1.Items.Add(lvi);
i++;
title = m.Groups[1].Value;
}
timer1.Enabled = false;
button3.Text = "开始刷新";
if (this.Tag == "")
{
MessageBox.Show("该贴吧有" + (i - 1) + "个帖子可以审核");
}
else
{
bz();
}
sl = (i - 1);
if (title != "")
{
this.Text = "现在处理的贴吧是:"+title;
tj();
}
else
{
this.Text = "未刷出帖子";
}
}
private void button2_Click(object sender, EventArgs e)
{
//Encoding encoding = Encoding.GetEncoding("UTF-8");
//String html = string.Empty;
//WebRequest request;
//request = WebRequest.Create("http://aspspider.info/q1101234/Default.aspx?mailaddress=657756944@qq.com&title=邮件标题&text=邮件正文");
//request.Credentials = CredentialCache.DefaultCredentials;
//request.Timeout = 5000;
//WebResponse response;
//response = request.GetResponse();
//html = new StreamReader(response.GetResponseStream(), encoding).ReadToEnd();
//MessageBox.Show(html);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private string getHtml(string url)
{
WebClient myWebClient = new WebClient();
byte[] myDataBuffer = myWebClient.DownloadData(url);
return Encoding.UTF8.GetString(myDataBuffer);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
Encoding encoding = Encoding.GetEncoding("gb2312");
textBox2.Text = new StreamReader(this.webBrowser1.DocumentStream, encoding).ReadToEnd();
button1_Click(null, null);
}
private void button3_Click(object sender, EventArgs e)
{
try
{
button3.Text = "刷新中";
MessageBox.Show("设置成功,刷出帖子后会自动停止刷新.");
timer1.Interval = int.Parse(textBox3.Text)*1000;
timer1.Enabled = true;
}
catch
{
MessageBox.Show("请输入正确的数字");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Refresh();
Encoding encoding = Encoding.GetEncoding("gb2312");
textBox2.Text = new StreamReader(this.webBrowser1.DocumentStream, encoding).ReadToEnd();
tj();
button1_Click(null, null);
}
private void tj()
{
string[] s = textBox2.Text.Split(new string[] { "今日处理量(<span>" }, StringSplitOptions.RemoveEmptyEntries);
string[] b = s[1].Split(new string[] { "<" }, StringSplitOptions.RemoveEmptyEntries);
label2.Text = "今日处理量:" + b[0];
bzs =int .Parse( b[0]);
s = textBox2.Text.Split(new string[] { "昨日处理量 (<span>" }, StringSplitOptions.RemoveEmptyEntries);
b = s[1].Split(new string[] { "<" }, StringSplitOptions.RemoveEmptyEntries);
label3.Text = "昨日处理量 :" + b[0];
s = textBox2.Text.Split(new string[] { "上周处理量 (<span>" }, StringSplitOptions.RemoveEmptyEntries);
b = s[1].Split(new string[] { "<" }, StringSplitOptions.RemoveEmptyEntries);
label4.Text = "上周处理量 :" + b[0];
s = textBox2.Text.Split(new string[] { "总共处理量 (<span>" }, StringSplitOptions.RemoveEmptyEntries);
b = s[1].Split(new string[] { "<" }, StringSplitOptions.RemoveEmptyEntries);
label5.Text = "总共处理量 :" + b[0];
}
private void button4_Click(object sender, EventArgs e)
{
if ((bzs + sl) < 5050 && button4.Text == "自动标注")
{
timer2.Enabled = true;
this.Tag = "bz";
button4.Text = "停止标注";
return;
}
if( button4.Text == "停止标注")
{
timer2.Enabled = false;
button4.Text = "自动标注";
this.Tag = "";
}
}
private void bz()
{
int a = 0;
HtmlDocument doca = this.webBrowser1.Document; //把当前的webBrowser1显示的文档实例化成一个HtmlDocument对象
for (; a < sl; a++)
{
for (int i = 0; i < doca.All.Count; i++) //循环查找这个对象的每一个元素
{
}
}
}
private void timer2_Tick(object sender, EventArgs e)
{
bz();
}
}
} |
|