diff --git a/Form1.Designer.cs b/Form1.Designer.cs index e601b64..4f28238 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -43,6 +43,7 @@ private void InitializeComponent() this.serachBtn = new System.Windows.Forms.Button(); this.autoManagerBtn = new System.Windows.Forms.Button(); this.gcrkCrawler = new System.Windows.Forms.TabPage(); + this.updateShowLabel = new System.Windows.Forms.Label(); this.updateLinkLabel = new System.Windows.Forms.LinkLabel(); this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); @@ -67,7 +68,6 @@ private void InitializeComponent() this.isMinor = new System.Windows.Forms.CheckBox(); this.pageProgressBar = new System.Windows.Forms.ProgressBar(); this.tabPages = new System.Windows.Forms.TabControl(); - this.updateShowLabel = new System.Windows.Forms.Label(); this.dataToText.SuspendLayout(); this.gcrkCrawler.SuspendLayout(); this.tabPages.SuspendLayout(); @@ -245,15 +245,24 @@ private void InitializeComponent() this.gcrkCrawler.Text = "갤창랭킹"; this.gcrkCrawler.UseVisualStyleBackColor = true; // + // updateShowLabel + // + this.updateShowLabel.AutoSize = true; + this.updateShowLabel.Location = new System.Drawing.Point(10, 62); + this.updateShowLabel.Name = "updateShowLabel"; + this.updateShowLabel.Size = new System.Drawing.Size(0, 15); + this.updateShowLabel.TabIndex = 27; + // // updateLinkLabel // this.updateLinkLabel.AutoSize = true; - this.updateLinkLabel.Location = new System.Drawing.Point(10, 35); + this.updateLinkLabel.Location = new System.Drawing.Point(5, 35); this.updateLinkLabel.Name = "updateLinkLabel"; this.updateLinkLabel.Size = new System.Drawing.Size(77, 15); this.updateLinkLabel.TabIndex = 26; this.updateLinkLabel.TabStop = true; this.updateLinkLabel.Text = "현재 버전:"; + this.updateLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.updateLinkLabel_LinkClicked); // // linkLabel2 // @@ -269,12 +278,12 @@ private void InitializeComponent() // linkLabel1 // this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(391, 3); + this.linkLabel1.Location = new System.Drawing.Point(384, 3); this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(392, 15); + this.linkLabel1.Size = new System.Drawing.Size(107, 15); this.linkLabel1.TabIndex = 24; this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "링크: https://github.com/hanel2527/dcinisde-crawler.ver.2"; + this.linkLabel1.Text = "사용 방법 안내"; this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // // endPageText @@ -458,14 +467,6 @@ private void InitializeComponent() this.tabPages.Size = new System.Drawing.Size(798, 506); this.tabPages.TabIndex = 0; // - // updateShowLabel - // - this.updateShowLabel.AutoSize = true; - this.updateShowLabel.Location = new System.Drawing.Point(10, 62); - this.updateShowLabel.Name = "updateShowLabel"; - this.updateShowLabel.Size = new System.Drawing.Size(0, 15); - this.updateShowLabel.TabIndex = 27; - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); @@ -473,7 +474,7 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(800, 501); this.Controls.Add(this.tabPages); this.Name = "Form1"; - this.Text = "Form1"; + this.Text = "갤창랭킹.v2.0.8-beta"; this.Load += new System.EventHandler(this.Form1_Load); this.dataToText.ResumeLayout(false); this.dataToText.PerformLayout(); diff --git a/Form1.cs b/Form1.cs index 5edabd5..b1317b0 100644 --- a/Form1.cs +++ b/Form1.cs @@ -26,18 +26,20 @@ private void Form1_Load(object sender, EventArgs e) this.AutoSize = true; this.AutoSizeMode = AutoSizeMode.GrowAndShrink; this.updateLinkLabel.Text = "현재 버전: " + version; + hdc.GallchangrankingCrawler tempGcrk = new GallchangrankingCrawler(); + tempGcrk.NewVersionUpdateExist += UpdateUpdateLinkLabel; + tempGcrk.UpdateChecker(this.version); + } - private void UpdateConsole(object text, EventArgs e) + private void UpdateUpdateLinkLabel(object text, EventArgs e) { - textConsole.AppendText((string)text); + updateLinkLabel.Text = (string)text; } private void gallCheckBtn_Click(object sender, EventArgs e) { hdc.GallchangrankingCrawler tempGcrk = new hdc.GallchangrankingCrawler(1, 2, gallIdTextBox.Text, isMinor.Checked); tempGcrk.GallCheck(tempGcrk.gallUrl); textConsole.AppendText(tempGcrk.gallName); - tempGcrk.NewVersionUpdateExist += UpdateConsole; - tempGcrk.UpdateChecker(); } private void NewPageUpdate(object sender, EventArgs e) @@ -166,13 +168,18 @@ private void button1_Click(object sender, EventArgs e) private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { this.linkLabel1.LinkVisited = true; - System.Diagnostics.Process.Start("https://github.com/hanel2527/dcinisde-crawler.ver.2"); + System.Diagnostics.Process.Start("https://gall.dcinside.com/board/view/?id=retouching&no=7413"); } - private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { this.linkLabel2.LinkVisited = true; System.Diagnostics.Process.Start("https://gall.dcinside.com/board/lists?id=retouching"); } + + private void updateLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + this.updateLinkLabel.LinkVisited = true; + System.Diagnostics.Process.Start("https://github.com/hanel2527/dcinisde-crawler.ver.2/releases/latest"); + } } } diff --git a/gallchangranking.cs b/gallchangranking.cs index 560ce19..3f472bf 100644 --- a/gallchangranking.cs +++ b/gallchangranking.cs @@ -286,19 +286,25 @@ int GetOnlyInt(string str) } else { return -1; } } - public string UpdateChecker() //구현 + public void UpdateChecker(string currentVersion) //구현 { - string github = "https://github.com/hanel2527/dcinisde-crawler.ver.2/"; + string github = "https://github.com/hanel2527/dcinisde-crawler.ver.2/blob/master/versions.txt"; var client = new WebClient(); client.Encoding = System.Text.Encoding.UTF8; string text = client.DownloadString(github); hap.HtmlDocument doc = new hap.HtmlDocument(); doc.LoadHtml(text); - if(NewVersionUpdateExist != null) + hap.HtmlNode myVersions = doc.DocumentNode. + SelectSingleNode("//table[@class='highlight tab-size js-file-line-container']"); + text = myVersions.InnerText.Trim(); + string[] versions = text.Split(new[] { ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries); + if (NewVersionUpdateExist != null) { - NewVersionUpdateExist(text, null); + if (versions[0].Equals(currentVersion)) + NewVersionUpdateExist("최신 버전입니다: " + versions[0], null); + else + NewVersionUpdateExist("새로운 업데이트가 있습니다(클릭): " + versions[0], null); } - return "최신 버전입니다"; } public void Crawler() {