From 034d999d25d1a6764724e2258abd81e04942d8c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Fri, 2 Feb 2024 18:40:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20=E5=BB=B6=E9=95=BF?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=97=B4=E9=9A=94=EF=BC=8C=E5=9B=9E=E8=BD=A6?= =?UTF-8?q?/Y=E4=B9=9F=E8=83=BD=E4=BD=BF=E7=94=A8=E6=97=A7=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Program.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index 958a756..11d34dc 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -31,9 +31,13 @@ new EventLog("AppInit") { }.Enqueue(); var usePreviousData = false; var historyCache = new CacheFile("ExportData"); -if (historyCache.LastWriteTime.AddMinutes(10) > DateTime.UtcNow) { +if (historyCache.LastWriteTime.AddMinutes(60) > DateTime.UtcNow) { Console.WriteLine(App.UsePreviousData); - usePreviousData = Console.ReadLine() == "yes"; + var text = Console.ReadLine(); + if (text != null) { + text = text.ToUpper(); + usePreviousData = (text == "" || text == "Y" || text == "YES"); + } } Export: if(usePreviousData) { From 504c8a2a9a08fadf3aca29f43fdbb7ca7b5bed7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Tue, 6 Feb 2024 22:46:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=91=94=20=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=97=A7=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Program.cs b/src/Program.cs index 11d34dc..9f13970 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -36,7 +36,7 @@ if (historyCache.LastWriteTime.AddMinutes(60) > DateTime.UtcNow) { var text = Console.ReadLine(); if (text != null) { text = text.ToUpper(); - usePreviousData = (text == "" || text == "Y" || text == "YES"); + usePreviousData = (text == "Y" || text == "YES"); } } Export: From cd0f49d83dfe529f74f819e23de6db6a71d3713d Mon Sep 17 00:00:00 2001 From: HolographicHat <58809250+HolographicHat@users.noreply.github.com> Date: Tue, 6 Feb 2024 23:19:41 +0800 Subject: [PATCH 3/3] shorten code --- src/Program.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index c69b1d7..5af746d 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -39,13 +39,9 @@ try { if (historyCache.LastWriteTime.AddMinutes(60) > DateTime.UtcNow && data != null) { Console.WriteLine(App.UsePreviousData); - var text = Console.ReadLine(); - if (text != null) { - text = text.ToUpper(); - if (text == "Y" || text == "YES") { - Export.Choose(data); - return; - } + if (Console.ReadLine()?.ToUpper() is "Y" or "YES") { + Export.Choose(data); + return; } } @@ -56,4 +52,4 @@ StartAndWaitResult(AppConfig.GamePath, str => { historyCache.Write(bytes); Export.Choose(list); return true; -}); \ No newline at end of file +});