From dd4c3979196ec7f130c4a855a837d4ac11dbc1fe Mon Sep 17 00:00:00 2001 From: mujianwu Date: Tue, 19 Nov 2024 19:57:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E8=A3=85=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=AD=98=E5=9C=A8=E7=A9=BA=E6=A0=BC=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UotanToolbox/Common/FeaturesHelper.cs | 9 +++++---- UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs | 8 ++++---- .../Customizedflash/CustomizedflashView.axaml.cs | 2 +- .../Features/FormatExtract/FormatExtractView.axaml.cs | 2 +- UotanToolbox/Features/Home/HomeView.axaml.cs | 4 ++-- UotanToolbox/Features/Home/HomeViewModel.cs | 3 ++- UotanToolbox/MainViewModel.cs | 3 ++- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/UotanToolbox/Common/FeaturesHelper.cs b/UotanToolbox/Common/FeaturesHelper.cs index 52f1b31c..78229c21 100644 --- a/UotanToolbox/Common/FeaturesHelper.cs +++ b/UotanToolbox/Common/FeaturesHelper.cs @@ -1,4 +1,5 @@ using System.Globalization; +using System.IO; using System.Resources; using System.Threading.Tasks; @@ -18,15 +19,15 @@ public static string GetTranslation(string key) public static async void PushMakefs(string device) { - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/mkfs.f2fs /tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "mkfs.f2fs")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell chmod +x /tmp/mkfs.f2fs"); - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/mkntfs /tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "mkntfs")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell chmod +x /tmp/mkntfs"); } public static async Task GetPartTable(string device) { - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/parted /tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "parted")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell chmod +x /tmp/parted"); Global.sdatable = await CallExternalProgram.ADB($"-s {device} shell /tmp/parted /dev/block/sda print"); Global.sdbtable = await CallExternalProgram.ADB($"-s {device} shell /tmp/parted /dev/block/sdb print"); @@ -39,7 +40,7 @@ public static async Task GetPartTable(string device) public static async Task GetPartTableSystem(string device) { - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/parted /data/local/tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "parted")}\" /data/local/tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell su -c \"chmod +x /data/local/tmp/parted\""); Global.sdatable = await CallExternalProgram.ADB($"-s {device} shell su -c \"/data/local/tmp/parted /dev/block/sda print\""); Global.sdbtable = await CallExternalProgram.ADB($"-s {device} shell su -c \"/data/local/tmp/parted /dev/block/sdb print\""); diff --git a/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs b/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs index 16ac6935..e17ada80 100644 --- a/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs +++ b/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs @@ -303,7 +303,7 @@ private async Task FlashRec(string shell) output = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} oem reboot-recovery"); if (output.Contains("unknown command")) { - await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc {Global.runpath}/Image/misc.img"); + await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc \"{Path.Combine(Global.runpath, "Image", "misc.img")}\""); await CallExternalProgram.Fastboot($"-s {Global.thisdevice} reboot"); } }, true) @@ -692,7 +692,7 @@ private async void FlashMagisk(object sender, RoutedEventArgs args) { if (sukiViewModel.Status == "Recovery") { - _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push {MagiskFile.Text} /tmp/magisk.apk"); + _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{MagiskFile.Text}\" /tmp/magisk.apk"); _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} shell twrp install /tmp/magisk.apk"); } else @@ -807,7 +807,7 @@ private async void DisableOffRec(object sender, RoutedEventArgs args) { if (sukiViewModel.Status == "Recovery") { - _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push {Global.runpath}/ZIP/DisableAutoRecovery.zip /tmp/"); + _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{Path.Combine(Global.runpath, "ZIP", "DisableAutoRecovery.zip")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} shell twrp install /tmp/DisableAutoRecovery.zip"); } else @@ -877,7 +877,7 @@ private async void SyncAB(object sender, RoutedEventArgs args) { if (sukiViewModel.Status == "Recovery") { - _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push {Global.runpath}/ZIP/copy-partitions.zip /tmp/"); + _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{Path.Combine(Global.runpath, "ZIP", "copy-partitions.zip")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} shell twrp install /tmp/copy-partitions.zip"); } else diff --git a/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs b/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs index b9fcc5d1..3830d87a 100644 --- a/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs +++ b/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs @@ -630,7 +630,7 @@ private async void DisableVbmeta(object sender, RoutedEventArgs args) if (sukiViewModel.Status == GetTranslation("Home_Fastboot") || sukiViewModel.Status == GetTranslation("Home_Fastbootd")) { CustomizedflashLog.Text = ""; - string shell = string.Format($"-s {Global.thisdevice} --disable-verity --disable-verification flash vbmeta {Global.runpath}/Image/vbmeta.img"); + string shell = string.Format($"-s {Global.thisdevice} --disable-verity --disable-verification flash vbmeta \"{Path.Combine(Global.runpath, "Image", "vbmeta.img")}\""); await Fastboot(shell); } else diff --git a/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs b/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs index f22796ec..f2f85b78 100644 --- a/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs +++ b/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs @@ -308,7 +308,7 @@ private async void Enable9091(object sender, RoutedEventArgs args) { BusyQCN.IsBusy = true; QCN.IsEnabled = false; - await CallExternalProgram.ADB($"-s {Global.thisdevice} push APK/mi_diag.apk /sdcard"); + await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{Path.Combine(Global.runpath, "APK", "mi_diag.apk")}\" /sdcard"); await CallExternalProgram.ADB($"-s {Global.thisdevice} shell \"am start -a miui.intent.action.OPEN\""); Global.MainDialogManager.CreateDialog() .WithTitle(GetTranslation("Common_Error")) diff --git a/UotanToolbox/Features/Home/HomeView.axaml.cs b/UotanToolbox/Features/Home/HomeView.axaml.cs index 77463df0..da49df1a 100644 --- a/UotanToolbox/Features/Home/HomeView.axaml.cs +++ b/UotanToolbox/Features/Home/HomeView.axaml.cs @@ -92,7 +92,7 @@ private async void OpenAFDI(object sender, RoutedEventArgs args) } else if (RuntimeInformation.OSArchitecture == Architecture.Arm64) { - string drvpath = String.Format($"{Global.runpath}/Drive/adb/*.inf"); + string drvpath = String.Format($"\"{Path.Combine(Global.runpath, "Drive", "adb", "*.inf")}\""); string shell = String.Format("/add-driver {0} /subdirs /install", drvpath); string drvlog = await CallExternalProgram.Pnputil(shell); FileHelper.Write($"{Global.log_path}/drive.txt", drvlog); @@ -122,7 +122,7 @@ private async void Open9008DI(object sender, RoutedEventArgs args) } else if (RuntimeInformation.OSArchitecture == Architecture.Arm64) { - string drvpath = String.Format($"{Global.runpath}/drive/9008/*.inf"); + string drvpath = String.Format($"\"{Path.Combine(Global.runpath, "Drive", "9008", "*.inf")}\""); string shell = String.Format("/add-driver {0} /subdirs /install", drvpath); string drvlog = await CallExternalProgram.Pnputil(shell); FileHelper.Write($"{Global.log_path}/drive.txt", drvlog); diff --git a/UotanToolbox/Features/Home/HomeViewModel.cs b/UotanToolbox/Features/Home/HomeViewModel.cs index f9ac9c57..0ae32c68 100644 --- a/UotanToolbox/Features/Home/HomeViewModel.cs +++ b/UotanToolbox/Features/Home/HomeViewModel.cs @@ -9,6 +9,7 @@ using SukiUI.Toasts; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net.Http; using System.Threading.Tasks; @@ -293,7 +294,7 @@ public async Task RebootRec() string output = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} oem reboot-recovery"); if (output.Contains("unknown command")) { - _ = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc {Global.runpath}/Image/misc.img"); + _ = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc \"{Path.Combine(Global.runpath, "Image", "misc.img")}\""); _ = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} reboot"); } else diff --git a/UotanToolbox/MainViewModel.cs b/UotanToolbox/MainViewModel.cs index 836aa084..31f4f555 100644 --- a/UotanToolbox/MainViewModel.cs +++ b/UotanToolbox/MainViewModel.cs @@ -10,6 +10,7 @@ using SukiUI.Toasts; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using UotanToolbox.Common; @@ -163,7 +164,7 @@ public async Task RebootRec() string output = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} oem reboot-recovery"); if (output.Contains("unknown command")) { - await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc {Global.runpath}/Image/misc.img"); + await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc \"{Path.Combine(Global.runpath, "Image", "misc.img")}\""); await CallExternalProgram.Fastboot($"-s {Global.thisdevice} reboot"); } else if (sukiViewModel.Status == GetTranslation("Home_OpenHOS"))