diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/ApkInfoPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/ApkInfoPanel.xaml similarity index 99% rename from QuickLook.Plugin/QuickLook.Plugin.AppViewer/ApkInfoPanel.xaml rename to QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/ApkInfoPanel.xaml index c56c8c8..a916084 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/ApkInfoPanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/ApkInfoPanel.xaml @@ -1,4 +1,4 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/DebInfoPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/DebInfoPanel.xaml.cs new file mode 100644 index 0000000..98dfee1 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/DebInfoPanel.xaml.cs @@ -0,0 +1,78 @@ +// Copyright © 2017-2025 QL-Win Contributors +// +// This file is part of QuickLook program. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using QuickLook.Common.ExtensionMethods; +using QuickLook.Common.Helpers; +using QuickLook.Common.Plugin; +using QuickLook.Plugin.AppViewer.PackageParsers.Deb; +using QuickLook.Plugin.AppViewer.PackageParsers.Wgt; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Threading.Tasks; +using System.Windows.Controls; + +namespace QuickLook.Plugin.AppViewer.InfoPanels; + +public partial class DebInfoPanel : UserControl, IAppInfoPanel +{ + private readonly ContextObject _context; + + public DebInfoPanel(ContextObject context) + { + _context = context; + + DataContext = this; + InitializeComponent(); + + string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config"); + applicationNameTitle.Text = TranslationHelper.Get("APP_NAME", translationFile); + versionNameTitle.Text = TranslationHelper.Get("APP_VERSION_NAME", translationFile); + versionCodeTitle.Text = TranslationHelper.Get("APP_VERSION_CODE", translationFile); + totalSizeTitle.Text = TranslationHelper.Get("TOTAL_SIZE", translationFile); + modDateTitle.Text = TranslationHelper.Get("LAST_MODIFIED", translationFile); + permissionsGroupBox.Header = TranslationHelper.Get("PERMISSIONS", translationFile); + } + + public void DisplayInfo(string path) + { + var name = Path.GetFileName(path); + filename.Text = string.IsNullOrEmpty(name) ? path : name; + + _ = Task.Run(() => + { + if (File.Exists(path)) + { + var size = new FileInfo(path).Length; + DebInfo wgtInfo = DebParser.Parse(path); + var last = File.GetLastWriteTime(path); + + Dispatcher.Invoke(() => + { + //applicationName.Text = wgtInfo.AppNameLocale ?? wgtInfo.AppName; + //versionName.Text = wgtInfo.AppVersionName; + //versionCode.Text = wgtInfo.AppVersionCode; + //totalSize.Text = size.ToPrettySize(2); + //modDate.Text = last.ToString(CultureInfo.CurrentCulture); + //permissions.ItemsSource = wgtInfo.Permissions; + + _context.IsBusy = false; + }); + } + }); + } +} diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/GroupBox.xaml b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/GroupBox.xaml similarity index 92% rename from QuickLook.Plugin/QuickLook.Plugin.AppViewer/GroupBox.xaml rename to QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/GroupBox.xaml index 8e6133e..104cdf5 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/GroupBox.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/InfoPanels/GroupBox.xaml @@ -1,6 +1,4 @@ - +