diff --git a/Form1.Designer.cs b/Form1.Designer.cs index d0381f7..4fcde5e 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -29,25 +29,34 @@ private void InitializeComponent() { this.Process = new System.Windows.Forms.CheckBox(); + this.tbURL = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // Process // this.Process.Appearance = System.Windows.Forms.Appearance.Button; - this.Process.AutoSize = true; - this.Process.Location = new System.Drawing.Point(90, 61); + this.Process.Location = new System.Drawing.Point(104, 65); this.Process.Name = "Process"; - this.Process.Size = new System.Drawing.Size(62, 22); + this.Process.Size = new System.Drawing.Size(139, 77); this.Process.TabIndex = 0; this.Process.Text = "Process"; + this.Process.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.Process.UseVisualStyleBackColor = true; this.Process.CheckedChanged += new System.EventHandler(this.Process_CheckedChanged); // + // tbURL + // + this.tbURL.Location = new System.Drawing.Point(12, 12); + this.tbURL.Name = "tbURL"; + this.tbURL.Size = new System.Drawing.Size(343, 21); + this.tbURL.TabIndex = 1; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 262); + this.ClientSize = new System.Drawing.Size(367, 212); + this.Controls.Add(this.tbURL); this.Controls.Add(this.Process); this.Name = "Form1"; this.Text = "Form1"; @@ -59,6 +68,7 @@ #endregion private System.Windows.Forms.CheckBox Process; + private System.Windows.Forms.TextBox tbURL; } } diff --git a/Form1.cs b/Form1.cs index 548513c..5e4e438 100644 --- a/Form1.cs +++ b/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(); + } } } }