diff --git a/UotanToolbox/Common/Global.cs b/UotanToolbox/Common/Global.cs index 7015dca1..cb8080b6 100644 --- a/UotanToolbox/Common/Global.cs +++ b/UotanToolbox/Common/Global.cs @@ -14,7 +14,7 @@ internal class Global public static AvaloniaList deviceslist; public static string thisdevice = null; public static ZipInfo Zipinfo = new ZipInfo("", "", "", "", "", false, PatchMode.None, ""); - public static BootInfo Bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", ""); + public static BootInfo Bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", "", ""); public static int mb_exitcode, cpio_exitcode, load_times; //分区表储存 public static string sdatable = ""; @@ -44,7 +44,8 @@ public class BootInfo public bool HaveDTB { get; set; } public string DTBName { get; set; } public string Arch { get; set; } - public BootInfo(string sha1, string path, string tempPath, bool isUseful, bool gki2, string version, string kmi, string osversion, string patchlevel, bool haveramdisk, bool havekernel, bool havedtb, string dtbname, string arch) + public string Compress { get; set; } + public BootInfo(string sha1, string path, string tempPath, bool isUseful, bool gki2, string version, string kmi, string osversion, string patchlevel, bool haveramdisk, bool havekernel, bool havedtb, string dtbname, string arch, string compress) { SHA1 = sha1; Path = path; @@ -60,7 +61,7 @@ public BootInfo(string sha1, string path, string tempPath, bool isUseful, bool g HaveDTB = havedtb; DTBName = dtbname; Arch = arch; - + Compress = compress; } } public class ZipInfo diff --git a/UotanToolbox/Common/PatchHelper/BootDetect.cs b/UotanToolbox/Common/PatchHelper/BootDetect.cs index 7df50529..9aa782a9 100644 --- a/UotanToolbox/Common/PatchHelper/BootDetect.cs +++ b/UotanToolbox/Common/PatchHelper/BootDetect.cs @@ -11,7 +11,7 @@ internal class BootDetect private static string GetTranslation(string key) => FeaturesHelper.GetTranslation(key); public static async Task Boot_Detect(string path) { - BootInfo bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", ""); + BootInfo bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", "", ""); bootinfo.Path = path; bootinfo.SHA1 = await FileHelper.SHA1HashAsync(bootinfo.Path); bootinfo.TempPath = Path.Combine(Global.tmp_path, "Boot-" + StringHelper.RandomString(8)); @@ -22,6 +22,7 @@ public static async Task Boot_Detect(string path) } string osVersionPattern = @"OS_VERSION\s+\[(.*?)\]"; string osPatchLevelPattern = @"OS_PATCH_LEVEL\s+\[(.*?)\]"; + string osKernelFMTPattern = @"KERNEL_FMT\s*\[([^\]]*)\]"; (string mb_output, Global.mb_exitcode) = await CallExternalProgram.MagiskBoot($"unpack \"{path}\"", bootinfo.TempPath); if (Global.mb_exitcode != 0) { @@ -29,6 +30,7 @@ public static async Task Boot_Detect(string path) } bootinfo.OSVersion = Regex.Match(mb_output, osVersionPattern).Groups[1].Value; bootinfo.PatchLevel = Regex.Match(mb_output, osPatchLevelPattern).Groups[1].Value; + bootinfo.Compress = Regex.Match(mb_output, osKernelFMTPattern).Groups[1].Value; bootinfo.IsUseful = true; (bootinfo.HaveDTB, bootinfo.DTBName) = await Task.Run(() => dtb_detect(bootinfo.TempPath)); (bootinfo.Version, bootinfo.KMI, bootinfo.HaveKernel, bootinfo.GKI2, bootinfo.Arch) = await kernel_detect(bootinfo.TempPath); diff --git a/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs b/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs index 44a28562..ef3b77ae 100644 --- a/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs +++ b/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs @@ -1,14 +1,14 @@ -using Avalonia.Collections; +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Platform.Storage; using Avalonia.Threading; using SukiUI.Controls; -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Threading.Tasks; using UotanToolbox.Common; using UotanToolbox.Common.PatchHelper; using UotanToolbox.Features.Components; @@ -391,7 +391,7 @@ private async void OpenBootFile(object sender, RoutedEventArgs args) BootFile.Text = StringHelper.FilePath(files[0].Path.ToString()); Global.Bootinfo = await BootDetect.Boot_Detect(BootFile.Text); ArchList.SelectedItem = Global.Bootinfo.Arch; - SukiHost.ShowDialog(new PureDialog($"{GetTranslation("Basicflash_DetectdBoot")}\nArch:{Global.Bootinfo.Arch}\nOS:{Global.Bootinfo.OSVersion}\nPatch_level:{Global.Bootinfo.PatchLevel}\nRamdisk:{Global.Bootinfo.HaveRamdisk}\nKMI:{Global.Bootinfo.KMI}"), allowBackgroundClose: true); + SukiHost.ShowDialog(new PureDialog($"{GetTranslation("Basicflash_DetectdBoot")}\nArch:{Global.Bootinfo.Arch}\nOS:{Global.Bootinfo.OSVersion}\nPatch_level:{Global.Bootinfo.PatchLevel}\nRamdisk:{Global.Bootinfo.HaveRamdisk}\nKMI:{Global.Bootinfo.KMI}\nKERNEL_FMT:{Global.Bootinfo.Compress}"), allowBackgroundClose: true); } catch (Exception ex) { @@ -443,7 +443,7 @@ private async void StartPatch(object sender, RoutedEventArgs args) FileHelper.OpenFolder(Path.GetDirectoryName(Global.Bootinfo.Path)); } Global.Zipinfo = new ZipInfo("", "", "", "", "", false, PatchMode.None, ""); - Global.Bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", ""); + Global.Bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", "", ""); SetDefaultMagisk(); BootFile.Text = null; ArchList.SelectedItem = null;