diff --git a/UotanToolbox/Common/CallExternalProgram.cs b/UotanToolbox/Common/CallExternalProgram.cs index b17529c8..77323086 100644 --- a/UotanToolbox/Common/CallExternalProgram.cs +++ b/UotanToolbox/Common/CallExternalProgram.cs @@ -16,7 +16,9 @@ public static async Task ADB(string adbshell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process adb = new Process(); adb.StartInfo = adbexe; @@ -38,7 +40,9 @@ public static async Task HDC(string hdcshell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process hdc = new Process(); hdc.StartInfo = hdcexe; @@ -60,7 +64,9 @@ public static async Task Fastboot(string fbshell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process fb = new Process(); fb.StartInfo = fastboot; @@ -82,7 +88,9 @@ public static async Task Devcon(string shell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process devcon = new Process(); devcon.StartInfo = fastboot; @@ -104,7 +112,9 @@ public static async Task Sudo(string shell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process fb = new Process(); fb.StartInfo = fastboot; @@ -126,7 +136,9 @@ public static async Task QCNTool(string shell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process qcn = new Process(); qcn.StartInfo = qcntool; @@ -148,7 +160,9 @@ public static async Task Pnputil(string shell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process pnp = new Process(); pnp.StartInfo = pnputil; @@ -169,7 +183,9 @@ public static async Task LsUSB() CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process fb = new Process(); fb.StartInfo = fastboot; @@ -191,7 +207,9 @@ public static async Task LinuxLS(string shell) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process fb = new Process(); fb.StartInfo = fastboot; @@ -215,6 +233,8 @@ public static async Task Scrcpy(string arg) UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8, WorkingDirectory = Path.Combine(Global.bin_path, "platform-tools") }; using Process sc = new Process(); @@ -240,7 +260,9 @@ public static async Task SevenZip(string args) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process SevenZip = new Process(); SevenZip.StartInfo = SevenZipexe; @@ -273,7 +295,9 @@ public static async Task SevenZip(string args) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; Process mb = new Process { @@ -308,7 +332,9 @@ public static async Task File(string path) CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = true + RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8 }; using Process process = new Process { diff --git a/UotanToolbox/Features/Appmgr/AppmgrViewModel.cs b/UotanToolbox/Features/Appmgr/AppmgrViewModel.cs index 30fd7f15..ef676326 100644 --- a/UotanToolbox/Features/Appmgr/AppmgrViewModel.cs +++ b/UotanToolbox/Features/Appmgr/AppmgrViewModel.cs @@ -99,9 +99,7 @@ await Task.Run(async () => { await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{Path.Join(Global.runpath, "Push", "list_apps")}\" /data/local/tmp/"); await CallExternalProgram.ADB($"-s {Global.thisdevice} shell chmod 777 /data/local/tmp/list_apps"); - await CallExternalProgram.ADB($"-s {Global.thisdevice} shell /data/local/tmp/list_apps > /data/local/tmp/apps.txt"); - await CallExternalProgram.ADB($"-s {Global.thisdevice} pull /data/local/tmp/apps.txt {Global.tmp_path}"); - string fulllists = File.ReadAllText(Path.Join(Global.tmp_path, "apps.txt")); + string fulllists = await CallExternalProgram.ADB($"-s {Global.thisdevice} shell /data/local/tmp/list_apps "); List fullapplications = StringHelper.ParseApplicationInfo(fulllists); string fullApplicationsList = !IsSystemAppDisplayed ? await CallExternalProgram.ADB($"-s {Global.thisdevice} shell pm list packages -3") @@ -147,9 +145,7 @@ await Dispatcher.UIThread.InvokeAsync(() => .ThenBy(app => app.Name) .ToList(); Applications = new ObservableCollection(applicationInfos); - await CallExternalProgram.ADB($"-s {Global.thisdevice} shell rm /data/local/tmp/apps.txt"); await CallExternalProgram.ADB($"-s {Global.thisdevice} shell rm /data/local/tmp/list_apps"); - File.Delete(Path.Join(Global.tmp_path, "apps.txt")); } else if (sukiViewModel.Status == GetTranslation("Home_OpenHOS")) {