diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/ApkInfoPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/ApkInfoPanel.xaml index 9433b74..16ca386 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/ApkInfoPanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/ApkInfoPanel.xaml @@ -74,6 +74,7 @@ + + + + Densities { get; set; } = []; public string LaunchableActivity { get; set; } + + public string[] ABIs { get; set; } = []; } diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Apk/ApkParser.cs b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Apk/ApkParser.cs index 03d9fea..8087ec8 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Apk/ApkParser.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Apk/ApkParser.cs @@ -16,6 +16,9 @@ // along with this program. If not, see . using ICSharpCode.SharpZipLib.Zip; +using System; +using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; @@ -25,33 +28,62 @@ public static class ApkParser { public static ApkInfo Parse(string path) { - using var zip = new ZipFile(path); - - var apkReader = new ApkReader.ApkReader(); - ApkReader.ApkInfo baseInfo = apkReader.Read(path); - ApkInfo info = new() + try { - VersionName = baseInfo.VersionName, - VersionCode = baseInfo.VersionCode, - TargetSdkVersion = baseInfo.TargetSdkVersion, - Permissions = baseInfo.Permissions, - PackageName = baseInfo.PackageName, - MinSdkVersion = baseInfo.MinSdkVersion, - Icon = baseInfo.Icon, - Icons = baseInfo.Icons, - Label = baseInfo.Label, - Labels = baseInfo.Labels, - Locales = baseInfo.Locales, - Densities = baseInfo.Densities, - LaunchableActivity = baseInfo.LaunchableActivity, - }; + using var zip = new ZipFile(path); - if (baseInfo.HasIcon) - { - ZipEntry entry = zip.GetEntry(baseInfo.Icons.Values.LastOrDefault()); - using var s = new BinaryReader(zip.GetInputStream(entry)); - info.Logo = s.ReadBytes((int)entry.Size); + var apkReader = new ApkReader.ApkReader(); + ApkReader.ApkInfo baseInfo = apkReader.Read(path); + ApkInfo info = new() + { + VersionName = baseInfo.VersionName, + VersionCode = baseInfo.VersionCode, + TargetSdkVersion = baseInfo.TargetSdkVersion, + Permissions = baseInfo.Permissions, + PackageName = baseInfo.PackageName, + MinSdkVersion = baseInfo.MinSdkVersion, + Icon = baseInfo.Icon, + Icons = baseInfo.Icons, + Label = baseInfo.Label, + Labels = baseInfo.Labels, + Locales = baseInfo.Locales, + Densities = baseInfo.Densities, + LaunchableActivity = baseInfo.LaunchableActivity, + }; + + if (baseInfo.HasIcon) + { + ZipEntry entry = zip.GetEntry(baseInfo.Icons.Values.LastOrDefault()); + using var s = new BinaryReader(zip.GetInputStream(entry)); + info.Logo = s.ReadBytes((int)entry.Size); + } + + var abiSet = new HashSet(); + + foreach (ZipEntry entry in zip) + { + if (entry.IsFile && entry.Name.StartsWith("lib/")) + { + var relativePath = entry.Name.Substring("lib/".Length); + int slashIndex = relativePath.IndexOf('/'); + + if (slashIndex > 0) + { + string abi = relativePath.Substring(0, slashIndex); + abiSet.Add(abi); + } + } + } + + info.ABIs = [.. abiSet]; + + return info; } - return info; + catch (Exception e) + { + Debug.WriteLine(e); + } + + return new ApkInfo(); } } diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Plugin.cs index 860cd2e..2ce53a7 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Plugin.cs @@ -75,7 +75,7 @@ public class Plugin : IViewer { context.PreferredSize = Path.GetExtension(ConfirmPath(path)).ToLower() switch { - ".apk" => new Size { Width = 560, Height = 505 }, + ".apk" => new Size { Width = 560, Height = 510 }, ".ipa" => new Size { Width = 560, Height = 510 }, ".hap" => new Size { Width = 560, Height = 500 }, ".msi" => new Size { Width = 560, Height = 230 }, diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Translations.config b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Translations.config index 376952e..41b0f37 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Translations.config +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/Translations.config @@ -9,6 +9,7 @@ Last Modified Publisher Capabilities + ABIs Application Version Version Name @@ -41,6 +42,7 @@ Modificado em Editora Recursos + ABIs Nome do aplicativo Versão Nome da versão @@ -73,6 +75,7 @@ 修改时间 发布者 功能 + 支持的 ABI 应用名称 版本 版本名称 @@ -105,6 +108,7 @@ 修改時間 發行者 功能 + 支援的 ABI 程式名稱 版本 版本名稱 @@ -137,6 +141,7 @@ 更新日時 発行元 機能 + 対応ABI アプリケーションネーム バージョン バージョン名 @@ -169,6 +174,7 @@ Zuletzt geändert Herausgeber Funktionen + Unterstützte ABIs Anwendung Version Bezeichnung der Version