From da58b567c5fbaffdd949fcf8b283617f2045a751 Mon Sep 17 00:00:00 2001 From: Potato-Y Date: Sun, 25 Apr 2021 14:37:46 +0900 Subject: [PATCH] 1.5.9 Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 메인 화면 사용자 정보 구조 변경 --- .../Game Utility App/Game Utility App.csproj | 3 + .../Game Utility App/MainForm/Basic Check.cs | 59 ++++++++++--------- .../MainForm/Main.Designer.cs | 40 +++---------- Version.1/Game Utility App/MainForm/Main.cs | 55 +++++------------ .../MainForm/Setting/MainSetting.Designer.cs | 18 +++--- .../Properties/AssemblyInfo.cs | 6 +- Version.1/Game Utility App/packages.config | 1 + 7 files changed, 70 insertions(+), 112 deletions(-) diff --git a/Version.1/Game Utility App/Game Utility App.csproj b/Version.1/Game Utility App/Game Utility App.csproj index 21b0529..9804c7a 100644 --- a/Version.1/Game Utility App/Game Utility App.csproj +++ b/Version.1/Game Utility App/Game Utility App.csproj @@ -75,6 +75,9 @@ ..\packages\WindowsAPICodePack-Shell.1.1.1\lib\Microsoft.WindowsAPICodePack.Shell.dll + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + diff --git a/Version.1/Game Utility App/MainForm/Basic Check.cs b/Version.1/Game Utility App/MainForm/Basic Check.cs index 3b6ebee..8258afe 100644 --- a/Version.1/Game Utility App/MainForm/Basic Check.cs +++ b/Version.1/Game Utility App/MainForm/Basic Check.cs @@ -1,7 +1,9 @@ using GameUtilityApp.Notice; using GameUtilityApp.Properties; using Microsoft.Win32; +using Newtonsoft.Json.Linq; using System; +using System.IO; using System.Net; using System.Net.Http; using System.Net.NetworkInformation; @@ -12,7 +14,7 @@ namespace GameUtilityApp { class Basic_Check { - int thisrelese = 20200929; + int thisrelese = 20210425; int termsOfUseRelese = 20200818; /// @@ -282,49 +284,50 @@ string CheckFor45PlusVersion(int releaseKey) /// string UserCountHomepageHtml; + public readonly int LOAD = 0; + public readonly int RELOAD = 1; + string userDataResponseText = string.Empty; //서버에서 정보 가져오기 - private void GetUserCountData() - { + private void GetUserCountData(int type) + { try { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; - var client = new HttpClient(); //웹으로부터 다운로드 받을 수 있는 클래스의 인스턴스를 제작 한다. + /*var client = new HttpClient(); //웹으로부터 다운로드 받을 수 있는 클래스의 인스턴스를 제작 한다. var response = client.GetAsync("http://potatoystudio.pe.kr/?device=mobile").Result; //웹으로부터 다운로드 - UserCountHomepageHtml = response.Content.ReadAsStringAsync().Result; //다운로드 결과를 html 로 받아 온다. - } - catch (Exception) - { + UserCountHomepageHtml = response.Content.ReadAsStringAsync().Result; //다운로드 결과를 html 로 받아 온다.*/ - } - } + string url = "https://script.google.com/macros/s/AKfycbyQ9B-jOm6yGr2bF3n-6SEX3l4C1p8-_M-l8poJPDWfbjd_S5Gaha4EF_lL1GsnMSwW/exec"; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "GET"; + request.Timeout = 10 * 1000; - public string GetNowUserCountData() - { - GetUserCountData(); - try - { - var now_match = Regex.Match(UserCountHomepageHtml, ".+?"); //정규식을 사용해서 위의 문장과 동일한 패턴을 가져온다. - string now_result = now_match.Value; //캡쳐 된 내용을 가져온다. - return now_result.Substring(6, now_result.Length - 13); + using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) + { + Stream respStream = resp.GetResponseStream(); + using (StreamReader sr = new StreamReader(respStream)) + { + userDataResponseText = sr.ReadToEnd(); + } + } } catch (Exception) { - MessageBox.Show("유저 데이터를 가져오는데 오류가 발생하였습니다."); - return "0"; - } + } } - public string GetTodayCountData() + public string GetTodayCountData(int type) { + GetUserCountData(type); try { - var today_match = Regex.Match(UserCountHomepageHtml, @"
오늘
\n
.+?
"); //정규식을 사용해서 위의 문장과 동일한 패턴을 가져온다. - string today_result = today_match.Value; //캡쳐 된 내용을 가져온다. - return today_result.Substring(24, today_result.Length - 29); + JObject json = JObject.Parse(userDataResponseText); + JToken jToken = json["today"]; + return jToken.ToString(); } catch (Exception) { @@ -337,9 +340,9 @@ public string GetTotalCountData() { try { - var total_match = Regex.Match(UserCountHomepageHtml, @"
전체
\n
.+?
"); //정규식을 사용해서 위의 문장과 동일한 패턴을 가져온다. - string total_result = total_match.Value; //캡쳐 된 내용을 가져온다. - return total_result.Substring(24, total_result.Length - 29); + JObject json = JObject.Parse(userDataResponseText); + JToken jToken = json["total"]; + return jToken.ToString(); } catch (Exception) { diff --git a/Version.1/Game Utility App/MainForm/Main.Designer.cs b/Version.1/Game Utility App/MainForm/Main.Designer.cs index 5b4e160..11472e2 100644 --- a/Version.1/Game Utility App/MainForm/Main.Designer.cs +++ b/Version.1/Game Utility App/MainForm/Main.Designer.cs @@ -66,11 +66,9 @@ private void InitializeComponent() this.groupBox5 = new System.Windows.Forms.GroupBox(); this.button8 = new System.Windows.Forms.Button(); this.webBrowser2 = new System.Windows.Forms.WebBrowser(); - this.label10 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.label11 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); @@ -477,19 +475,10 @@ private void InitializeComponent() this.webBrowser2.TabIndex = 7; this.webBrowser2.Url = new System.Uri("", System.UriKind.Relative); // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(3, 0); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(75, 14); - this.label10.TabIndex = 0; - this.label10.Text = "현재 사용자 : "; - // // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(3, 20); + this.label12.Location = new System.Drawing.Point(3, 0); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(75, 14); this.label12.TabIndex = 8; @@ -498,7 +487,7 @@ private void InitializeComponent() // label13 // this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(3, 40); + this.label13.Location = new System.Drawing.Point(3, 20); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(100, 14); this.label13.TabIndex = 9; @@ -509,12 +498,10 @@ private void InitializeComponent() this.tableLayoutPanel2.ColumnCount = 2; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 44.48819F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 55.51181F)); - this.tableLayoutPanel2.Controls.Add(this.label13, 0, 2); - this.tableLayoutPanel2.Controls.Add(this.label10, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.label12, 0, 1); - this.tableLayoutPanel2.Controls.Add(this.label11, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.label14, 1, 1); - this.tableLayoutPanel2.Controls.Add(this.label15, 1, 2); + this.tableLayoutPanel2.Controls.Add(this.label12, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.label14, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.label13, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.label15, 1, 1); this.tableLayoutPanel2.Location = new System.Drawing.Point(335, 134); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 3; @@ -524,19 +511,10 @@ private void InitializeComponent() this.tableLayoutPanel2.Size = new System.Drawing.Size(254, 61); this.tableLayoutPanel2.TabIndex = 11; // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(116, 0); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(48, 14); - this.label11.TabIndex = 10; - this.label11.Text = "label11"; - // // label14 // this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(116, 20); + this.label14.Location = new System.Drawing.Point(116, 0); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(48, 14); this.label14.TabIndex = 11; @@ -545,7 +523,7 @@ private void InitializeComponent() // label15 // this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(116, 40); + this.label15.Location = new System.Drawing.Point(116, 20); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(48, 14); this.label15.TabIndex = 12; @@ -748,11 +726,9 @@ private void InitializeComponent() private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button10; private System.Windows.Forms.WebBrowser webBrowser2; - private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; - private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label15; private System.Windows.Forms.Button button11; diff --git a/Version.1/Game Utility App/MainForm/Main.cs b/Version.1/Game Utility App/MainForm/Main.cs index a50de47..4c382b4 100644 --- a/Version.1/Game Utility App/MainForm/Main.cs +++ b/Version.1/Game Utility App/MainForm/Main.cs @@ -22,18 +22,6 @@ private void UpdateCheck() Basic_Check newCheck = new Basic_Check(); newCheck.DotNetverCheck(); //업데이트 확인 전 .net 버전 먼저 확인한다. newCheck.NetworkCheck(); - - try - { - String path = "http://potatoystudio.pe.kr/"; //사이트 접속 - webBrowser2.Navigate(path); - } - catch (Exception) - { - MessageBox.Show("인터넷 오류", "오류"); - Application.Exit(); - this.Close(); - } //서버 페이지 연결 만약 0이면 업데이트가 없는 상태, 1이면 업데이트가 있는 상태 @@ -62,7 +50,6 @@ private void UpdateCheck() private void Form1_Load(object sender, EventArgs e) //프로그램 로딩 { - label11.Text = "0"; label14.Text = "0"; label15.Text = "0"; //필수 시작점 @@ -106,7 +93,7 @@ private void Form1_Load(object sender, EventArgs e) //프로그램 로딩 //레이블 영역 끝 UpdateCheck(); - UserCount(); + UserCount(new Basic_Check().LOAD); //레지 불러오기 RegReload_keyboard(); RegReload_Response(); @@ -150,25 +137,12 @@ private void loadtooltip() } //사용자 파악 - private void UserCount() + private void UserCount(int type) { - try - { - String path = "http://potatoystudio.pe.kr/"; - webBrowser2.Navigate(path); - } - catch (Exception) - { - MessageBox.Show("Error"); - Application.Exit(); - this.Close(); - } - try { Basic_Check userCheck = new Basic_Check(); - label11.Text = userCheck.GetNowUserCountData(); - label14.Text = userCheck.GetTodayCountData(); + label14.Text = userCheck.GetTodayCountData(type); label15.Text = userCheck.GetTotalCountData(); } catch (Exception) @@ -196,7 +170,7 @@ private void KeyboardClick(object sender, EventArgs e) RegSave_keyboard(); MessageBox.Show("Keyboard 부분을 저장하였습니다.", "Save"); RegReload_keyboard(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + //UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void ResponseClick(object sender, EventArgs e) @@ -204,7 +178,7 @@ private void ResponseClick(object sender, EventArgs e) RegSave_Response(); MessageBox.Show("Keyboard Response 부분을 저장하였습니다.", "Save"); RegReload_Response(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + //UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void ToggleKeysClick(object sender, EventArgs e) @@ -212,7 +186,7 @@ private void ToggleKeysClick(object sender, EventArgs e) RegSave_ToggleKeys(); MessageBox.Show("ToggleKeys 부분을 저장하였습니다.", "Save"); RegReload_ToggleKeys(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + //UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void SaveAll(object sender, EventArgs e) //전체 세이브 @@ -224,7 +198,7 @@ private void SaveAll(object sender, EventArgs e) //전체 세이브 RegReload_keyboard(); RegReload_Response(); RegReload_ToggleKeys(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + // UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } //세이브 버튼 끝 @@ -234,7 +208,7 @@ private void ReloadClick(object sender, EventArgs e) //레지 새로고침 RegReload_Response(); RegReload_ToggleKeys(); MessageBox.Show("모두 저장 전으로 새로고침 되었습니다.", "Reload"); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + // UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void RecommendReg_Click(object sender, EventArgs e) //권장 레지로 설정 @@ -265,34 +239,34 @@ private void RecommendReg_Click(object sender, EventArgs e) //권장 레지로 RegReload_keyboard(); RegReload_Response(); RegReload_ToggleKeys(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + // UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void SettingButton_Click(object sender, EventArgs e) { MainSetting newForm = new MainSetting(); newForm.ShowDialog(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + //UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void Utility_Click(object sender, EventArgs e) { UtilityChoice newForm = new UtilityChoice(); newForm.ShowDialog(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + //UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void Sponsor_Click(object sender, EventArgs e) { Sponsor newForm = new Sponsor(); newForm.ShowDialog(); - UserCount(); + //UserCount(new Basic_Check().RELOAD); } private void UseHelp_Click(object sender, EventArgs e) { Process.Start("https://repotato.tistory.com/138"); - UserCount(); + //UserCount(new Basic_Check().RELOAD); } //숫자만 입력되도록 하며 입력시 글자색이 파란색으로 변경 @@ -334,6 +308,7 @@ private void textbox3_keyup(object sender, KeyEventArgs e) { if (vs.Major == 10) { + MessageBox.Show(vs.Major + " " + vs.Minor); try { if (win10_message_count == 0) @@ -506,7 +481,7 @@ private void RegPluse_Click(object sender, EventArgs e) RegReload_keyboard(); RegReload_Response(); RegReload_ToggleKeys(); - UserCount(); //버튼 누를 때마다 사용자 수 재설정 + //UserCount(new Basic_Check().RELOAD); //버튼 누를 때마다 사용자 수 재설정 } private void Homepage_Click(object sender, EventArgs e) diff --git a/Version.1/Game Utility App/MainForm/Setting/MainSetting.Designer.cs b/Version.1/Game Utility App/MainForm/Setting/MainSetting.Designer.cs index 630466c..daf61e4 100644 --- a/Version.1/Game Utility App/MainForm/Setting/MainSetting.Designer.cs +++ b/Version.1/Game Utility App/MainForm/Setting/MainSetting.Designer.cs @@ -76,16 +76,16 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(-4, 230); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(302, 14); + this.label1.Size = new System.Drawing.Size(334, 14); this.label1.TabIndex = 2; - this.label1.Text = "Copyright (C) 2020. Potato-Y Studio all rights reserved"; + this.label1.Text = "Copyright (C) 2020-2021. Potato-Y Studio all rights reserved"; // // groupBox1 // this.groupBox1.Controls.Add(this.checkBox1); this.groupBox1.Location = new System.Drawing.Point(12, 13); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(295, 52); + this.groupBox1.Size = new System.Drawing.Size(308, 52); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "자동 시작"; @@ -101,7 +101,7 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.button2); this.groupBox2.Location = new System.Drawing.Point(12, 72); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(295, 121); + this.groupBox2.Size = new System.Drawing.Size(308, 121); this.groupBox2.TabIndex = 4; this.groupBox2.TabStop = false; this.groupBox2.Text = "프로그램"; @@ -113,7 +113,7 @@ private void InitializeComponent() this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(45, 14); this.label5.TabIndex = 10; - this.label5.Text = "v 1.5.8"; + this.label5.Text = "v 1.5.9"; // // label4 // @@ -144,7 +144,7 @@ private void InitializeComponent() // // button4 // - this.button4.Location = new System.Drawing.Point(176, 22); + this.button4.Location = new System.Drawing.Point(189, 22); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(113, 25); this.button4.TabIndex = 6; @@ -154,7 +154,7 @@ private void InitializeComponent() // // button3 // - this.button3.Location = new System.Drawing.Point(176, 53); + this.button3.Location = new System.Drawing.Point(189, 53); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(113, 25); this.button3.TabIndex = 5; @@ -164,7 +164,7 @@ private void InitializeComponent() // // button2 // - this.button2.Location = new System.Drawing.Point(176, 85); + this.button2.Location = new System.Drawing.Point(189, 84); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(113, 25); this.button2.TabIndex = 0; @@ -199,7 +199,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.CancelButton = this.button1; - this.ClientSize = new System.Drawing.Size(319, 287); + this.ClientSize = new System.Drawing.Size(332, 287); this.Controls.Add(this.linkLabel2); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.groupBox2); diff --git a/Version.1/Game Utility App/Properties/AssemblyInfo.cs b/Version.1/Game Utility App/Properties/AssemblyInfo.cs index 6deaddb..04a2934 100644 --- a/Version.1/Game Utility App/Properties/AssemblyInfo.cs +++ b/Version.1/Game Utility App/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GameUtilityApp")] -[assembly: AssemblyCopyright("Copyright © 2020 Potato-Y Studio")] +[assembly: AssemblyCopyright("Copyright © 2020-2021. Potato-Y Studio")] [assembly: AssemblyTrademark("Project Potato-Y Studio")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 // 기본값으로 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.8.0")] -[assembly: AssemblyFileVersion("1.5.8.0")] +[assembly: AssemblyVersion("1.5.9.0")] +[assembly: AssemblyFileVersion("1.5.9.0")] diff --git a/Version.1/Game Utility App/packages.config b/Version.1/Game Utility App/packages.config index ab5060a..a75cea7 100644 --- a/Version.1/Game Utility App/packages.config +++ b/Version.1/Game Utility App/packages.config @@ -1,5 +1,6 @@  + \ No newline at end of file