This commit is contained in:
62
Form1.cs
62
Form1.cs
@@ -14,11 +14,14 @@ namespace WebChecker
|
||||
WebBrowser wb = new WebBrowser();
|
||||
string url = "http://me.sayclub.com/profile/home/view/ban8";
|
||||
Timer m_Timer = new Timer();
|
||||
bool m_bProcessing = false;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
tbURL.Text = url;
|
||||
|
||||
m_Timer.Interval = 5000;
|
||||
m_Timer.Tick += new EventHandler(m_Timer_Tick);
|
||||
|
||||
@@ -28,31 +31,72 @@ namespace WebChecker
|
||||
void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||||
{
|
||||
HtmlDocument doc = wb.Document;
|
||||
HtmlElement element = doc.GetElementById("sbVisitedUser");
|
||||
string strCnt = (string)element.InnerText.Clone();
|
||||
|
||||
strCnt = strCnt.Substring(0, strCnt.IndexOf("명"));
|
||||
strCnt = strCnt.Substring(strCnt.IndexOf("오늘")+"오늘".Length);
|
||||
strCnt = strCnt.Trim();
|
||||
HtmlElement element = doc.GetElementById("sbPersonalInfo");
|
||||
element = element.Children[element.Children.Count-1];
|
||||
element = element.Children[0];
|
||||
element = element.GetElementsByTagName("IMG")[0];
|
||||
|
||||
int iCnt = Convert.ToInt32(strCnt);
|
||||
string attr = element.GetAttribute("src");
|
||||
|
||||
if(iCnt > 3)
|
||||
MessageBox.Show(iCnt + "명 : 확인해바라");
|
||||
if(attr.IndexOf("login") >= 0)
|
||||
{
|
||||
Process.Checked = false;
|
||||
MessageBox.Show("loged in");
|
||||
}
|
||||
|
||||
m_bProcessing = false;
|
||||
|
||||
|
||||
|
||||
|
||||
//string strStatus = element.InnerText;
|
||||
//string[] strList = strStatus.Split(':');
|
||||
|
||||
//strStatus = strList[1];
|
||||
//strStatus = strStatus.Trim();
|
||||
|
||||
|
||||
|
||||
//HtmlElement element = doc.GetElementById("sbVisitedUser");
|
||||
//string strCnt = (string)element.InnerText.Clone();
|
||||
|
||||
//strCnt = strCnt.Substring(0, strCnt.IndexOf("명"));
|
||||
//strCnt = strCnt.Substring(strCnt.IndexOf("오늘")+"오늘".Length);
|
||||
//strCnt = strCnt.Trim();
|
||||
|
||||
//int iCnt = Convert.ToInt32(strCnt);
|
||||
|
||||
//if(iCnt > 3)
|
||||
// MessageBox.Show(iCnt + "명 : 확인해바라");
|
||||
}
|
||||
|
||||
void m_Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if(wb.IsBusy == false)
|
||||
if(m_bProcessing == false && wb.IsBusy == false)
|
||||
{
|
||||
m_bProcessing = true;
|
||||
wb.Navigate(url);
|
||||
}
|
||||
}
|
||||
|
||||
private void Process_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(Process.Checked == true)
|
||||
{
|
||||
m_Timer.Start();
|
||||
|
||||
url = tbURL.Text;
|
||||
tbURL.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Timer.Stop();
|
||||
|
||||
tbURL.Enabled = true;
|
||||
if(wb.IsBusy == true)
|
||||
wb.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user