From c96b3798102cb9f2fb658edc0ea047bbced39c30 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:49:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=BA=E5=88=B6=E6=9B=BF=E6=8D=A2adb?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之后再加个吐司通知弹一下 --- .../ViewModels/UI/SettingsViewModel.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 1259f122e2..582b002b2a 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -2703,12 +2703,28 @@ namespace MaaWpfGui.ViewModels.UI const string UnzipDir = "adb"; const string NewAdb = UnzipDir + "/platform-tools/adb.exe"; - if (Directory.Exists(UnzipDir)) + try { - Directory.Delete(UnzipDir, true); + if (Directory.Exists(UnzipDir)) + { + Directory.Delete(UnzipDir, true); + } + } + catch (Exception ex) + { + _logger.Error(ex.ToString() + "; already replace"); + return; } - ZipFile.ExtractToDirectory(GoogleAdbFilename, UnzipDir); + try + { + ZipFile.ExtractToDirectory(GoogleAdbFilename, UnzipDir); + } + catch (Exception ex) + { + _logger.Error(ex.ToString()); + return; + } bool replaced = false; if (AdbPath != NewAdb && File.Exists(AdbPath))