Restruct AppViewer codes

This commit is contained in:
ema
2025-06-04 15:13:43 +08:00
parent 59124967d2
commit 3bd1239457
37 changed files with 448 additions and 52 deletions

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="QuickLook.Plugin.AppViewer.ApkInfoPanel"
<UserControl x:Class="QuickLook.Plugin.AppViewer.InfoPanels.ApkInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -18,7 +18,7 @@
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Plugin.AppViewer.ApkPackageParser;
using QuickLook.Plugin.AppViewer.PackageParsers.Apk;
using System;
using System.Globalization;
using System.IO;
@@ -27,11 +27,11 @@ using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace QuickLook.Plugin.AppViewer;
namespace QuickLook.Plugin.AppViewer.InfoPanels;
public partial class ApkInfoPanel : UserControl, IAppInfoPanel
{
private ContextObject _context;
private readonly ContextObject _context;
public ApkInfoPanel(ContextObject context)
{

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="QuickLook.Plugin.AppViewer.AppxInfoPanel"
<UserControl x:Class="QuickLook.Plugin.AppViewer.InfoPanels.AppxInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -18,7 +18,7 @@
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Plugin.AppViewer.AppxPackageParser;
using QuickLook.Plugin.AppViewer.PackageParsers.Appx;
using System.Globalization;
using System.IO;
using System.Reflection;
@@ -26,11 +26,11 @@ using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace QuickLook.Plugin.AppViewer;
namespace QuickLook.Plugin.AppViewer.InfoPanels;
public partial class AppxInfoPanel : UserControl, IAppInfoPanel
{
private ContextObject _context;
private readonly ContextObject _context;
public AppxInfoPanel(ContextObject context)
{

View File

@@ -0,0 +1,183 @@
<UserControl x:Class="QuickLook.Plugin.AppViewer.InfoPanels.DebInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Plugin.AppViewer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontSize="14"
UseLayoutRounding="True"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="GroupBox.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="15" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image x:Name="image"
Grid.Row="1"
Grid.Column="0"
Width="120"
Height="120"
Margin="8"
VerticalAlignment="Top"
Source="/QuickLook.Plugin.AppViewer;component/Resources/debian.png"
Stretch="Fill" />
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10" />
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="* " />
</Grid.RowDefinitions>
<Grid Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
MaxHeight="60"
Padding="3"
FontSize="19"
FontWeight="SemiBold"
LineHeight="25"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap">
<TextBlock.Inlines>
<Run x:Name="filename" Text="FilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilename.ext" />
</TextBlock.Inlines>
</TextBlock>
</Grid>
<!-- Application Name -->
<TextBlock x:Name="applicationNameTitle"
Grid.Row="3"
Grid.Column="1"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Application Name" />
<TextBlock x:Name="applicationName"
Grid.Row="3"
Grid.Column="2"
Margin="8,0,0,0"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Searching..."
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
<!-- Version Name -->
<TextBlock x:Name="versionNameTitle"
Grid.Row="4"
Grid.Column="1"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Version" />
<TextBlock x:Name="versionName"
Grid.Row="4"
Grid.Column="2"
Margin="8,0,0,0"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Searching..."
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
<!-- Version Code -->
<TextBlock x:Name="versionCodeTitle"
Grid.Row="5"
Grid.Column="1"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Version Code" />
<TextBlock x:Name="versionCode"
Grid.Row="5"
Grid.Column="2"
Margin="8,0,0,0"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Searching..."
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
<!-- Total Size -->
<TextBlock x:Name="totalSizeTitle"
Grid.Row="6"
Grid.Column="1"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Total Size" />
<TextBlock x:Name="totalSize"
Grid.Row="6"
Grid.Column="2"
Margin="8,0,0,0"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Calculating size..." />
<!-- Last Modified -->
<TextBlock x:Name="modDateTitle"
Grid.Row="7"
Grid.Column="1"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Last Modified" />
<TextBlock x:Name="modDate"
Grid.Row="7"
Grid.Column="2"
Margin="8,0,0,0"
Padding="3"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Text="Searching..."
TextTrimming="CharacterEllipsis" />
<!-- Permissions -->
<GroupBox x:Name="permissionsGroupBox"
Grid.Row="8"
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="3,3,16,16"
Padding="3"
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
Foreground="{DynamicResource WindowTextForegroundAlternative}"
Header="Capabilities">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ScrollViewer.Resources>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</ScrollViewer.Resources>
<ItemsControl x:Name="permissions">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Margin="8,3,16,3"
IsReadOnly="True"
Text="{Binding ., Mode=OneTime}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</GroupBox>
</Grid>
</Grid>
</UserControl>

View File

@@ -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 <http://www.gnu.org/licenses/>.
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;
});
}
});
}
}

View File

@@ -1,6 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:Wpf.Ui.Controls">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type GroupBox}">
<Setter Property="BorderThickness" Value="1" />

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="QuickLook.Plugin.AppViewer.HapInfoPanel"
<UserControl x:Class="QuickLook.Plugin.AppViewer.InfoPanels.HapInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -18,7 +18,7 @@
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Plugin.AppViewer.HapPackageParser;
using QuickLook.Plugin.AppViewer.PackageParsers.Hap;
using System;
using System.Globalization;
using System.IO;
@@ -27,11 +27,11 @@ using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace QuickLook.Plugin.AppViewer;
namespace QuickLook.Plugin.AppViewer.InfoPanels;
public partial class HapInfoPanel : UserControl, IAppInfoPanel
{
private ContextObject _context;
private readonly ContextObject _context;
public HapInfoPanel(ContextObject context)
{

View File

@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace QuickLook.Plugin.AppViewer;
namespace QuickLook.Plugin.AppViewer.InfoPanels;
public interface IAppInfoPanel
{

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="QuickLook.Plugin.AppViewer.IpaInfoPanel"
<UserControl x:Class="QuickLook.Plugin.AppViewer.InfoPanels.IpaInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -18,7 +18,7 @@
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Plugin.AppViewer.IpaPackageParser;
using QuickLook.Plugin.AppViewer.PackageParsers.Ipa;
using System;
using System.Globalization;
using System.IO;
@@ -27,11 +27,11 @@ using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace QuickLook.Plugin.AppViewer;
namespace QuickLook.Plugin.AppViewer.InfoPanels;
public partial class IpaInfoPanel : UserControl, IAppInfoPanel
{
private ContextObject _context;
private readonly ContextObject _context;
public IpaInfoPanel(ContextObject context)
{

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="QuickLook.Plugin.AppViewer.MsiInfoPanel"
<UserControl x:Class="QuickLook.Plugin.AppViewer.InfoPanels.MsiInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -18,7 +18,7 @@
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Plugin.AppViewer.MsiPackageParser;
using QuickLook.Plugin.AppViewer.PackageParsers.Msi;
using System;
using System.Globalization;
using System.IO;
@@ -26,11 +26,11 @@ using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace QuickLook.Plugin.AppViewer;
namespace QuickLook.Plugin.AppViewer.InfoPanels;
public partial class MsiInfoPanel : UserControl, IAppInfoPanel
{
private ContextObject _context;
private readonly ContextObject _context;
public MsiInfoPanel(ContextObject context)
{

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="QuickLook.Plugin.AppViewer.WgtInfoPanel"
<UserControl x:Class="QuickLook.Plugin.AppViewer.InfoPanels.WgtInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -18,18 +18,18 @@
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Plugin.AppViewer.WgtPackageParser;
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;
namespace QuickLook.Plugin.AppViewer.InfoPanels;
public partial class WgtInfoPanel : UserControl, IAppInfoPanel
{
private ContextObject _context;
private readonly ContextObject _context;
public WgtInfoPanel(ContextObject context)
{

View File

@@ -1,6 +1,23 @@
using System.Collections.Generic;
// 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 <http://www.gnu.org/licenses/>.
namespace QuickLook.Plugin.AppViewer.ApkPackageParser;
using System.Collections.Generic;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Apk;
public class ApkInfo
{

View File

@@ -19,7 +19,7 @@ using ICSharpCode.SharpZipLib.Zip;
using System.IO;
using System.Linq;
namespace QuickLook.Plugin.AppViewer.ApkPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Apk;
public static class ApkParser
{

View File

@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Xml;
namespace QuickLook.Plugin.AppViewer.AppxPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Appx;
public class AppxBundleReader : IDisposable
{
@@ -96,9 +96,9 @@ public class AppxBundleReader : IDisposable
if (packagesNode != null)
{
string arch = (RuntimeInformation.OSArchitecture == Architecture.Arm64)
string arch = RuntimeInformation.OSArchitecture == Architecture.Arm64
? "arm64"
: (Environment.Is64BitProcess ? "x64" : "x86");
: Environment.Is64BitProcess ? "x64" : "x86";
var packages = packagesNode.ChildNodes.Select(package =>
{

View File

@@ -17,7 +17,7 @@
using System.Drawing;
namespace QuickLook.Plugin.AppViewer.AppxPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Appx;
public class AppxInfo
{

View File

@@ -17,7 +17,7 @@
using System.IO;
namespace QuickLook.Plugin.AppViewer.AppxPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Appx;
public static class AppxParser
{

View File

@@ -23,7 +23,7 @@ using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
namespace QuickLook.Plugin.AppViewer.AppxPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Appx;
public class AppxReader : IDisposable
{

View File

@@ -0,0 +1,65 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Deb;
public static class ArReader
{
public static ArEntry[] Read(string filePath)
{
var entries = new List<ArEntry>();
using var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
using var br = new BinaryReader(fs);
// Check ar magic
var magic = br.ReadBytes(8);
if (Encoding.ASCII.GetString(magic) != "!<arch>\n")
throw new InvalidDataException("Not a valid ar file");
while (fs.Position < fs.Length)
{
var header = br.ReadBytes(60);
if (header.Length < 60)
break;
string name = Encoding.ASCII.GetString(header, 0, 16).Trim();
string sizeStr = Encoding.ASCII.GetString(header, 48, 10).Trim();
string fmag = Encoding.ASCII.GetString(header, 58, 2);
if (fmag != "`\n")
throw new InvalidDataException("Invalid header end");
long size = long.Parse(sizeStr);
byte[] data = br.ReadBytes((int)size);
// Completion alignment: ar file is evenly aligned
if (size % 2 != 0)
br.ReadByte();
entries.Add(new ArEntry
{
FileName = name,
FileSize = size,
Data = data
});
}
return [.. entries];
}
}
public class ArEntry
{
public string FileName { get; set; } = string.Empty;
public long FileSize { get; set; }
public byte[] Data { get; set; } = [];
public override string ToString()
{
return $"{FileName} ({FileSize})";
}
}

View File

@@ -0,0 +1,22 @@
// 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 <http://www.gnu.org/licenses/>.
namespace QuickLook.Plugin.AppViewer.PackageParsers.Deb;
public class DebInfo
{
}

View File

@@ -0,0 +1,27 @@
// 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 <http://www.gnu.org/licenses/>.
namespace QuickLook.Plugin.AppViewer.PackageParsers.Deb;
public static class DebParser
{
public static DebInfo Parse(string path)
{
ArEntry[] ar = ArReader.Read(path);
return new();
}
}

View File

@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace QuickLook.Plugin.AppViewer.HapPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Hap;
public sealed class HapInfo
{

View File

@@ -21,7 +21,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
namespace QuickLook.Plugin.AppViewer.HapPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Hap;
internal static class HapParser
{

View File

@@ -17,7 +17,7 @@
using System.Linq;
namespace QuickLook.Plugin.AppViewer.IpaPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Ipa;
public class IpaInfo
{

View File

@@ -17,7 +17,7 @@
using System.Linq;
namespace QuickLook.Plugin.AppViewer.IpaPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Ipa;
public static class IpaParser
{

View File

@@ -22,7 +22,7 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace QuickLook.Plugin.AppViewer.IpaPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Ipa;
public class IpaReader
{

View File

@@ -23,7 +23,7 @@ using System.IO;
using System.Text;
using System.Xml;
namespace QuickLook.Plugin.AppViewer.IpaPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Ipa;
/// <summary>
/// https://github.com/animetrics/PlistCS
@@ -161,7 +161,7 @@ public static class Plist
WriteBinaryString("bplist00", false);
offsetTableOffset = (long)objectTable.Count;
offsetTableOffset = objectTable.Count;
offsetTable.Add(objectTable.Count - 8);
@@ -313,9 +313,9 @@ public static class Plist
}
else if (value is int || value is long)
{
writer.WriteElementString("integer", ((int)value).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
writer.WriteElementString("integer", ((int)value).ToString(NumberFormatInfo.InvariantInfo));
}
else if (value is System.Collections.Generic.Dictionary<string, object> ||
else if (value is Dictionary<string, object> ||
value.GetType().ToString().StartsWith("System.Collections.Generic.Dictionary`2[System.String"))
{
// Convert to Dictionary<string, object>
@@ -340,7 +340,7 @@ public static class Plist
}
else if (value is float || value is double)
{
writer.WriteElementString("real", ((double)value).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
writer.WriteElementString("real", ((double)value).ToString(NumberFormatInfo.InvariantInfo));
}
else if (value is DateTime time)
{
@@ -759,7 +759,7 @@ public static class Plist
// 0 return null
// 9 return true
// 8 return false
return (objectTable[offsetTable[objRef]] == 0) ? null : (objectTable[offsetTable[objRef]] == 9);
return objectTable[offsetTable[objRef]] == 0 ? null : objectTable[offsetTable[objRef]] == 9;
}
case 0x10:
{

View File

@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace QuickLook.Plugin.AppViewer.MsiPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Msi;
public sealed class MsiInfo
{

View File

@@ -17,7 +17,7 @@
using WixToolset.Dtf.WindowsInstaller;
namespace QuickLook.Plugin.AppViewer.MsiPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Msi;
public static class MsiParser
{

View File

@@ -18,7 +18,7 @@
using System.Collections.Generic;
using System.Globalization;
namespace QuickLook.Plugin.AppViewer.WgtPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Wgt;
public sealed class WgtInfo
{

View File

@@ -23,7 +23,7 @@ using System.IO.Compression;
using System.Linq;
using System.Text;
namespace QuickLook.Plugin.AppViewer.WgtPackageParser;
namespace QuickLook.Plugin.AppViewer.PackageParsers.Wgt;
internal static class WgtParser
{

View File

@@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using QuickLook.Common.Plugin;
using QuickLook.Plugin.AppViewer.InfoPanels;
using System;
using System.IO;
using System.Linq;
@@ -47,6 +48,9 @@ public class Plugin : IViewer
".hap", ".hap.1", // HarmonyOS Package
//".har", // HarmonyOS Archive
// Ubuntu
//".deb", // Debian Package
// Others
".wgt", ".wgtu", // UniApp Widget
];
@@ -74,6 +78,7 @@ public class Plugin : IViewer
".hap" => new Size { Width = 560, Height = 500 },
".msi" => new Size { Width = 520, Height = 230 },
".msix" or ".msixbundle" or ".appx" or ".appxbundle" => new Size { Width = 560, Height = 328 },
".deb" => new Size { Width = 600, Height = 345 },
".wgt" or ".wgtu" => new Size { Width = 600, Height = 345 },
_ => throw new NotSupportedException("Extension is not supported."),
};
@@ -89,6 +94,7 @@ public class Plugin : IViewer
".hap" => new HapInfoPanel(context),
".msi" => new MsiInfoPanel(context),
".msix" or ".msixbundle" or ".appx" or ".appxbundle" => new AppxInfoPanel(context),
".deb" => new DebInfoPanel(context),
".wgt" or ".wgtu" => new WgtInfoPanel(context),
_ => throw new NotSupportedException("Extension is not supported."),
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB