3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
C# GOOGLE SEO (Timer+webBrowser的應用)   GITHUB:https://github.com/jash-git/CS_Google_SEO 收集連結,自動點擊URL瀏覽(Timer+webBrowser的應用)   using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; namespace CS_Google_SEO {  public partial class Form1 : Form  {   public ArrayList m_ALUrl=new ArrayList();   public int m_intCount;   public String m_StrBuf = “”;   public Form1()   {    InitializeComponent();   }   private void timer1_Tick(object sender, EventArgs e)   {    timer1.Enabled = false;    m_intCount++;    Random R = new Random();    int i = R.Next(0, (m_ALUrl.Count – 1));        if (m_intCount>=300)    {     Navigate(m_ALUrl[i].ToString());     m_intCount = 0;     m_StrBuf = String.Format(“{0}/{1}”, i, m_ALUrl.Count);    }    this.Text = “” + m_intCount + “sec ~ “+ m_StrBuf;    timer1.Enabled = true;   }   private void Form1_Load(object sender, EventArgs e)   {    m_intCount = 0;    m_StrBuf = “”;    StreamReader sr = new StreamReader(“google_seo.txt”);    while (!sr.EndOfStream)// 每次讀取一行,直到檔尾    {     string line = sr.ReadLine();// 讀取文字到 line 變數     if(line!=””)     {      m_ALUrl.Add(line);     }    }    sr.Close();// 關閉串流    timer1.Enabled = true;   }   private void Navigate(String address)   {    if (String.IsNullOrEmpty(address)) return;    if (address.Equals(“about:blank”)) return;    if (!address.StartsWith(“http://”) &&     !address.StartsWith(“https://”))    {     address = “http://” + address;    }    try    {     webBrowser1.Navigate(new Uri(address));    }    catch (System.UriFormatException)    {     return;    }   }  } }

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦