c# 过滤 www.proxycn.com 代理的工具 只要有他 代理将 代理将 批量 生产

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;

namespace WindowsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Title = "打开代理文件";

            openFileDialog1.CheckFileExists = true;

            openFileDialog1.CheckPathExists = true;

            openFileDialog1.AddExtension = true;

            openFileDialog1.Multiselect = false;

            openFileDialog1.Filter = "*.txt|*.txt|*.*|*.*";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {


                FileInfo f = new FileInfo(openFileDialog1.FileName);

                StreamReader ce = f.OpenText();

                this.richTextBox1.Text = ce.ReadToEnd();

                ce.Close();

                for (int i = 0; i < richTextBox1.Lines.Length; i++)
                {
                    this.listBox1.Items.Add(richTextBox1.Lines[i]);


                }


            }


        }

        private string getff(string k)
        {

            try
            {

                int i = k.IndexOf(' ');


                k = k.Remove(0, i + 1);

                i = k.IndexOf(" H");

                k = k.Remove(i, k.Length - i);

             
                return k;

            }
            catch
            {
                return "aaa";
            }

 

 

 


            //try
            //{
            //    int i1 = 0;
            //    int i2 = 0;
            //    int i3 = 0;


            //    for (int i = 0; i < k.Length; i++)
            //    {
            //        if (k[i] ==' ')
            //        {
            //            i1 = i;
            //        }


            //    }

            //    MessageBox.Show(k.Length.ToString());

            //    string  of = k.Remove(0, i1 + 1);

            //    int b = 0;

            //    for (int i = 0; i < of.Length; i++)
            //    {
            //        if (k[i] == ' ')
            //        {
            //            if (b == 0)
            //            {
            //                b++;
            //            }
            //            else if (b == 1)
            //            {
            //                i3 = i;
            //            }


            //        }


            //    }

              

            //    return of.Remove(i3, k.Length - i3);

            //}
            //catch
            //{
            //    return "aaa/r/n";
            //}


        }


        private void button3_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.listBox1.Items.Count; i++)
            {
                this.listBox1.Items[i] = getff(this.listBox1.Items[i].ToString());
               
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Title = "保存代理文件";

            saveFileDialog1.OverwritePrompt = true;

            saveFileDialog1.CreatePrompt = true;

            saveFileDialog1.AddExtension = true;

            saveFileDialog1.Filter = "*.txt|*.txt|*.*|*.*";

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                this.richTextBox1.Text = "";


                for (int i = 0; i < this.listBox1.Items.Count; i++)
                {


                    this.richTextBox1.AppendText(this.listBox1.Items[i].ToString() + "/n");


                }

                StreamWriter nn = new StreamWriter(saveFileDialog1.FileName);

                nn.Write(this.richTextBox1.Text);

                nn.Close();

 


            }
        }
    }
    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值