mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-10 01:17:13 +00:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1ce2fc2f89 | ||
![]() |
c2acdaa182 | ||
![]() |
eff9d795f0 | ||
![]() |
27c2257feb | ||
![]() |
9803f5d6a8 | ||
![]() |
00ef7d1e01 | ||
![]() |
06e7dbaae7 | ||
![]() |
34f69cc4f4 | ||
![]() |
74e8394b07 | ||
![]() |
0370876a3f | ||
![]() |
dd322ac7e9 | ||
![]() |
6e8c0ce593 | ||
![]() |
75c45f96c2 | ||
![]() |
f7b22fb600 | ||
![]() |
4170dc7a16 | ||
![]() |
47f4106b5d | ||
![]() |
b28fcbb398 | ||
![]() |
97f8232767 | ||
![]() |
8fa4f6cc5b | ||
![]() |
ebcb223ef0 | ||
![]() |
90b23cd1f8 | ||
![]() |
beca7d06ca |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -290,8 +290,11 @@ __pycache__/
|
||||
/QuickLook.Installer/C_QuickLookComponents.wxs
|
||||
/Build/*
|
||||
!/Build/Assets
|
||||
!/Build/AppxManifest.*
|
||||
!/Build/AppxManifest.xml
|
||||
!/Build/assetslayout.resfiles
|
||||
!/Build/priconfig.xml
|
||||
!/Build/micasetup.json
|
||||
!/Build/micasetup.cmd
|
||||
!/Build/openssl-sign.cnf
|
||||
!/Build/sideload.crt
|
||||
!/Build/sideload.key
|
||||
!/Build/sideload.pfx
|
@@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10">
|
||||
<Identity Name="21090PaddyXu.QuickLook" Version="0.0.0.0"
|
||||
Publisher='E=xupaddy@gmail.com, CN="Open Source Developer, Pengfei Xu", O=Open Source Developer, C=FI' />
|
||||
<Properties>
|
||||
<DisplayName>QuickLook</DisplayName>
|
||||
<PublisherDisplayName>Paddy Xu</PublisherDisplayName>
|
||||
<Description>Bring macOS “Quick Look” feature to Windows</Description>
|
||||
<Logo>Assets\storelogo.png</Logo>
|
||||
</Properties>
|
||||
<Resources>
|
||||
<Resource Language="en-us" />
|
||||
<Resource uap:Scale="100" />
|
||||
<Resource uap:Scale="125" />
|
||||
<Resource uap:Scale="150" />
|
||||
<Resource uap:Scale="200" />
|
||||
<Resource uap:Scale="400" />
|
||||
</Resources>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.15063.0" />
|
||||
</Dependencies>
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
<Applications>
|
||||
<Application Id="Main" Executable="Package\QuickLook.exe" EntryPoint="Windows.FullTrustApplication">
|
||||
<Extensions>
|
||||
<desktop:Extension Category="windows.startupTask" Executable="Package\QuickLook.exe"
|
||||
EntryPoint="Windows.FullTrustApplication">
|
||||
<desktop:StartupTask TaskId="QuickLookTask" Enabled="true" DisplayName="QuickLook" />
|
||||
</desktop:Extension>
|
||||
</Extensions>
|
||||
<uap:VisualElements DisplayName="QuickLook"
|
||||
Description="Bring macOS “Quick Look” feature to Windows"
|
||||
BackgroundColor="transparent"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"
|
||||
Square310x310Logo="Assets\LargeTile.png"
|
||||
Square71x71Logo="Assets\SmallTile.png">
|
||||
<uap:ShowNameOnTiles>
|
||||
<uap:ShowOn Tile="square150x150Logo" />
|
||||
<uap:ShowOn Tile="wide310x150Logo" />
|
||||
<uap:ShowOn Tile="square310x310Logo" />
|
||||
</uap:ShowNameOnTiles>
|
||||
</uap:DefaultTile>
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
</Package>
|
@@ -3,10 +3,15 @@
|
||||
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10">
|
||||
<!-- Invalid package identity name: QL-Win.QuickLook (expected: 21090PaddyXu.QuickLook) -->
|
||||
<!-- Invalid package family name: QL-Win.QuickLook_wgqddy12gm212 (expected: 21090PaddyXu.QuickLook_egxr34yet59cg) -->
|
||||
<!-- Invalid package publisher name: CN=F4F538EC-55CB-41B8-9531-25CC140D0339 (expected: CN=CE36AF3D-FF94-43EB-9908-7EC8FD1D29FB) -->
|
||||
<Identity Name="21090PaddyXu.QuickLook" Version="0.0.0.0" Publisher="CN=CE36AF3D-FF94-43EB-9908-7EC8FD1D29FB" />
|
||||
<Properties>
|
||||
<DisplayName>QuickLook</DisplayName>
|
||||
<PublisherDisplayName>Paddy Xu</PublisherDisplayName>
|
||||
<!-- We can not set the name to QL-Win, see the following error message -->
|
||||
<!-- Package acceptance validation error: The PublisherDisplayName element in the app manifest of QuickLook-4.0.1.0.appx is QL-Win, which doesn't match your publisher display name: emako. -->
|
||||
<PublisherDisplayName>emako</PublisherDisplayName>
|
||||
<Description>Bring macOS “Quick Look” feature to Windows</Description>
|
||||
<Logo>Assets\storelogo.png</Logo>
|
||||
</Properties>
|
||||
@@ -19,7 +24,7 @@
|
||||
<Resource uap:Scale="400" />
|
||||
</Resources>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.15063.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.26100.0" />
|
||||
</Dependencies>
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
|
@@ -1,4 +0,0 @@
|
||||
cd /d %~dp0
|
||||
@REM 7z a Package.7z .\Package\* -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
makemica micasetup.json
|
||||
@pause
|
13
Build/openssl-sign.cnf
Normal file
13
Build/openssl-sign.cnf
Normal file
@@ -0,0 +1,13 @@
|
||||
[req]
|
||||
default_bits = 2048
|
||||
prompt = no
|
||||
default_md = sha256
|
||||
distinguished_name = dn
|
||||
x509_extensions = v3_req
|
||||
|
||||
[dn]
|
||||
CN = CE36AF3D-FF94-43EB-9908-7EC8FD1D29FB
|
||||
|
||||
[v3_req]
|
||||
keyUsage = critical, digitalSignature
|
||||
extendedKeyUsage = codeSigning
|
20
Build/sideload.crt
Normal file
20
Build/sideload.crt
Normal file
@@ -0,0 +1,20 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDMjCCAhqgAwIBAgIUBIWdItfat0Fw6npbHI2W7HE/0KYwDQYJKoZIhvcNAQEL
|
||||
BQAwLzEtMCsGA1UEAwwkQ0UzNkFGM0QtRkY5NC00M0VCLTk5MDgtN0VDOEZEMUQy
|
||||
OUZCMB4XDTI1MDUxMzE3NDgzNVoXDTI4MDUxMjE3NDgzNVowLzEtMCsGA1UEAwwk
|
||||
Q0UzNkFGM0QtRkY5NC00M0VCLTk5MDgtN0VDOEZEMUQyOUZCMIIBIjANBgkqhkiG
|
||||
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnAtbhjH01YmWv1U98kMj3epdpuZLE04pGXOR
|
||||
xfdBb1zX8Q75hy5SmIaHrsow7fTXfHsUzuJEmanllMbJGUpi46fLsb8Ijd4uQgXO
|
||||
wSDfIXrm34Buzpk6EKwEWmRMyORmfPwy0A+XdTHydDhEXndy1eGPJ1ZZnldVI8Ho
|
||||
ZF2MW35QBZDjlWZh3RppWNMksvlngrOX4PFfJ+DtOQUvNswbpyqVATMFBk9kShGM
|
||||
XHuieibzDlzxGNKSn3tDvutLBW5hm7iLqEuAeM7dwSac4C+N5FKWnXJndkN3k8AN
|
||||
nD0MHlErN1dLoJQqvAaCarZr8RSPhdanVOylMGkt97NLYZrLTQIDAQABo0YwRDAO
|
||||
BgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwHQYDVR0OBBYEFJEL
|
||||
e4QaWs4H2djQ6nnnc/30sZ/nMA0GCSqGSIb3DQEBCwUAA4IBAQBYBXkl/vEsGUHI
|
||||
qogCfb/DxFlsm059sxHAIhaNjuoTlgwzgj6KSPbKsfnYVMHZFqkg4AaTuRs9iqTL
|
||||
TStM14OjG95gn+7fJ4zxqquEEytk9yb2xj9ZpLAvzZzUrw5qo1lmM7yPRso38l62
|
||||
9g1G1/MVP6pO03QWKzvSV+IlU3DIP3M2r74G8dexL5/Cut1LkOc/tn2ZYt3Ij95e
|
||||
RM2vqxzK2pw6IAVG3wdNGAyN9K8BATRuAXFV6RXkeEBHFNV3wpyq4W+H6hpsrMJM
|
||||
rMZUUqLa8BTUQAsZ1jmL+dRmj2rESeOaOO9jPks4J4c8+v8aJQBmZhvxRyjyMtdL
|
||||
pWHSCCgm
|
||||
-----END CERTIFICATE-----
|
28
Build/sideload.key
Normal file
28
Build/sideload.key
Normal file
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCcC1uGMfTViZa/
|
||||
VT3yQyPd6l2m5ksTTikZc5HF90FvXNfxDvmHLlKYhoeuyjDt9Nd8exTO4kSZqeWU
|
||||
xskZSmLjp8uxvwiN3i5CBc7BIN8heubfgG7OmToQrARaZEzI5GZ8/DLQD5d1MfJ0
|
||||
OERed3LV4Y8nVlmeV1UjwehkXYxbflAFkOOVZmHdGmlY0ySy+WeCs5fg8V8n4O05
|
||||
BS82zBunKpUBMwUGT2RKEYxce6J6JvMOXPEY0pKfe0O+60sFbmGbuIuoS4B4zt3B
|
||||
JpzgL43kUpadcmd2Q3eTwA2cPQweUSs3V0uglCq8BoJqtmvxFI+F1qdU7KUwaS33
|
||||
s0thmstNAgMBAAECggEABS51XWPhmt5E5K6Pw4XKNkS207jC68MFJ1oIkE0bsvcf
|
||||
boWORe2vrW6OKSt/627dYZNJXMNI/tyUNIKooSUwr8QzGysE6DJlUSjrNXYszT+i
|
||||
VJqUU1o614c2unT+fbnj01OhMPp2OjHXOK0OTCAQQ/IySYlFqYssgbxJxgdl2+XX
|
||||
rDiSk5PvZ0Z8PUuG7EvNbRAnUmIQDVTd81My0kPk4M0w8Rg2p0sIN5klIDxTzC98
|
||||
5iUvS+53xch4f8jJOr8s7J/56R+tnIoqfVkIDI3Q4CUhq3s0DAC7GP4vpoynGXn0
|
||||
pLzHvOttFbqgcHkS2zrVOXKwl4Zym4p+kMCub6BCmwKBgQDcGzCvrMon4fIJrymG
|
||||
lmGZMeN8acjD0MKDT8JPgHkwXTz61AbOC2EGoOpWNqrYGOCv6xSMPiub1un6Y5X2
|
||||
KIuAJm+bY+py0Ed+EzZjrFkQpGt6xQ3FY2aFvA5uS3esgcF+OtcUrXEEq0dK9bZ6
|
||||
HB9P90QuND72bvfx9wjLon0dvwKBgQC1fcRbLpqA2lSGglcRoioA/okMPyMk7jH3
|
||||
n3IHjnpjsBu1FPrWH8Tqtop4vrEVS1cxM7P7FXWwWPqUH/2XbCk1R3T9ZD+i1kHi
|
||||
qvSqp4L0dfTk6ibZpywGXRnpQzT5kKJTrSSx9L7Ni00HcvCI1+p4XNdJZm7jNDSy
|
||||
dGSPg1ox8wKBgB6TaF//ENYZfRX7TzlzCnvNglx2FX2eMmcrXULOBgfB7AasDYXx
|
||||
7riNAgCX94OtcQj/DwusV0J+yGIQE3TujPJwZHChoJ/ybvwEjzmpZ3X4YTXcydzx
|
||||
wfwx848+zJEaNVbjtZ0Zuul7IZw4JfEwluj04HPKrjRtleP2/THMkLThAoGBAJYh
|
||||
BwB2OJBGCo2J3ARWJHDWHP/oamXuM58mYekmTs+PqhvM0wG1HesaPMlM1KdMvz+Q
|
||||
CV21jrjlocJOBDPx4NSV24yQFKPaoH2j9OgF0SnvOTjzCFgbFSveb8SpN3UJ031s
|
||||
SGJ8lijpBjsXNSm9kdMm2V96QFfpo33LEjQ077NJAoGARnnvnenmfwlu/5Oq2Ojs
|
||||
WWzOxXTpiGXLnbUNUvQMvqXxGygCGoA18vVveLr6eKfojM8iKtGF91S9NsUkBEkd
|
||||
VKOFnc9OQ5dtoBkN6XZBUCmJCzQZS20A3jq9oionsJlIWOgb/X3L1cS2SZ3ocgKS
|
||||
lCCN2IGaKiGJCPJprpFW7fg=
|
||||
-----END PRIVATE KEY-----
|
BIN
Build/sideload.pfx
Normal file
BIN
Build/sideload.pfx
Normal file
Binary file not shown.
Submodule QuickLook.Common updated: ef476e971f...474d7be09e
@@ -50,6 +50,8 @@ void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
|
||||
medium.tymed = TYMED_HGLOBAL;
|
||||
|
||||
// Try CF_HDROP first
|
||||
// If the file path is too long, the call might fail but CFSTR_SHELLIDLIST will do it
|
||||
// https://github.com/QL-Win/QuickLook/issues/1643
|
||||
if (SUCCEEDED(dao->GetData(&formatetc, &medium)))
|
||||
{
|
||||
HDROP hDrop = HDROP(medium.hGlobal);
|
||||
@@ -73,7 +75,7 @@ void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
|
||||
static const CLIPFORMAT cfShellIDList = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLIST);
|
||||
formatetc.cfFormat = cfShellIDList;
|
||||
|
||||
if (SUCCEEDED(dao->GetData(&formatetc, &medium)))
|
||||
if (SUCCEEDED(dao->GetData(&formatetc, &medium)))
|
||||
{
|
||||
CIDA* pida = (CIDA*)GlobalLock(medium.hGlobal);
|
||||
if (!pida)
|
||||
@@ -98,7 +100,7 @@ void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
|
||||
PWSTR pszPath = nullptr;
|
||||
if (SUCCEEDED(shellItem->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, &pszPath)))
|
||||
{
|
||||
StringCchCopyW(buffer, MAX_PATH, pszPath); // returns e.g., ::{645FF040-5081-101B-9F08-00AA002F954E}
|
||||
StringCchCopyW(buffer, MAX_PATH_EX, pszPath); // returns e.g., ::{645FF040-5081-101B-9F08-00AA002F954E}
|
||||
CoTaskMemFree(pszPath);
|
||||
}
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ public class ArchiveFileEntry : IComparable<ArchiveFileEntry>
|
||||
if (IsFolder)
|
||||
return $"{Name}";
|
||||
|
||||
var en = Encrypted ? "*" : "";
|
||||
var en = Encrypted ? "*" : string.Empty;
|
||||
return $"{Name}{en},{IsFolder},{Size},{ModifiedDate}";
|
||||
}
|
||||
}
|
||||
|
@@ -18,9 +18,9 @@
|
||||
using QuickLook.Common.Annotations;
|
||||
using QuickLook.Common.ExtensionMethods;
|
||||
using QuickLook.Common.Helpers;
|
||||
using SharpCompress.Archives;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Readers;
|
||||
using PureSharpCompress.Archives;
|
||||
using PureSharpCompress.Common;
|
||||
using PureSharpCompress.Readers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -37,7 +37,7 @@ namespace QuickLook.Plugin.ArchiveViewer;
|
||||
/// </summary>
|
||||
public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropertyChanged
|
||||
{
|
||||
private readonly Dictionary<string, ArchiveFileEntry> _fileEntries = new Dictionary<string, ArchiveFileEntry>();
|
||||
private readonly Dictionary<string, ArchiveFileEntry> _fileEntries = [];
|
||||
private bool _disposed;
|
||||
private double _loadPercent;
|
||||
private ulong _totalZippedSize;
|
||||
@@ -82,7 +82,7 @@ public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropert
|
||||
_totalZippedSize = (ulong)new FileInfo(path).Length;
|
||||
|
||||
var root = new ArchiveFileEntry(Path.GetFileName(path), true);
|
||||
_fileEntries.Add("", root);
|
||||
_fileEntries.Add(string.Empty, root);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -123,7 +123,7 @@ public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropert
|
||||
if (_disposed)
|
||||
return;
|
||||
|
||||
fileListView.SetDataContext(_fileEntries[""].Children.Keys);
|
||||
fileListView.SetDataContext(_fileEntries[string.Empty].Children.Keys);
|
||||
archiveCount.Content =
|
||||
$"{_type} archive{t}";
|
||||
archiveSizeC.Content =
|
||||
@@ -137,38 +137,37 @@ public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropert
|
||||
|
||||
private void LoadItemsFromArchive(string path)
|
||||
{
|
||||
using (var stream = File.OpenRead(path))
|
||||
using var stream = File.OpenRead(path);
|
||||
|
||||
// ReaderFactory is slow... so limit its usage
|
||||
string[] useReader = [".tar.gz", ".tgz", ".tar.bz2", ".tar.lz", ".tar.xz"];
|
||||
|
||||
if (useReader.Any(path.ToLower().EndsWith))
|
||||
{
|
||||
// ReaderFactory is slow... so limit its usage
|
||||
string[] useReader = { ".tar.gz", ".tgz", ".tar.bz2", ".tar.lz", ".tar.xz" };
|
||||
var reader = ReaderFactory.Open(stream, new ChardetReaderOptions());
|
||||
|
||||
if (useReader.Any(path.ToLower().EndsWith))
|
||||
_type = reader.ArchiveType.ToString();
|
||||
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
var reader = ReaderFactory.Open(stream, new ChardetReaderOptions());
|
||||
|
||||
_type = reader.ArchiveType.ToString();
|
||||
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (_disposed)
|
||||
return;
|
||||
LoadPercent = 100d * stream.Position / stream.Length;
|
||||
ProcessByLevel(reader.Entry);
|
||||
}
|
||||
if (_disposed)
|
||||
return;
|
||||
LoadPercent = 100d * stream.Position / stream.Length;
|
||||
ProcessByLevel(reader.Entry);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
var archive = ArchiveFactory.Open(stream, new ChardetReaderOptions());
|
||||
|
||||
_type = archive.Type.ToString();
|
||||
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
var archive = ArchiveFactory.Open(stream, new ChardetReaderOptions());
|
||||
|
||||
_type = archive.Type.ToString();
|
||||
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
if (_disposed)
|
||||
return;
|
||||
LoadPercent = 100d * stream.Position / stream.Length;
|
||||
ProcessByLevel(entry);
|
||||
}
|
||||
if (_disposed)
|
||||
return;
|
||||
LoadPercent = 100d * stream.Position / stream.Length;
|
||||
ProcessByLevel(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,17 +211,17 @@ public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropert
|
||||
{
|
||||
var d = Path.GetDirectoryName(path);
|
||||
|
||||
return d ?? "";
|
||||
return d ?? string.Empty;
|
||||
}
|
||||
|
||||
private string[] GetPathFragments(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return new string[0];
|
||||
return [];
|
||||
|
||||
var frags = path.Split('\\', '/').Where(f => !string.IsNullOrEmpty(f)).ToArray();
|
||||
|
||||
return frags.Select((s, i) => frags.Take(i + 1).Aggregate((a, b) => a + "\\" + b)).ToArray();
|
||||
return [.. frags.Select((s, i) => frags.Take(i + 1).Aggregate((a, b) => a + "\\" + b))];
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
|
@@ -15,8 +15,8 @@
|
||||
// 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 SharpCompress.Common;
|
||||
using SharpCompress.Readers;
|
||||
using PureSharpCompress.Common;
|
||||
using PureSharpCompress.Readers;
|
||||
using System;
|
||||
using System.Text;
|
||||
using UtfUnknown;
|
||||
|
@@ -96,7 +96,7 @@ public class BooleanToAsteriskConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
var b = (bool)value;
|
||||
|
||||
return b ? "*" : "";
|
||||
return b ? "*" : string.Empty;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
@@ -112,7 +112,7 @@ public class SizePrettyPrintConverter : DependencyObject, IMultiValueConverter
|
||||
var size = (ulong)values[0];
|
||||
var isFolder = (bool)values[1];
|
||||
|
||||
return isFolder ? "" : ((long)size).ToPrettySize(2);
|
||||
return isFolder ? string.Empty : ((long)size).ToPrettySize(2);
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
@@ -128,7 +128,7 @@ public class DatePrintConverter : DependencyObject, IMultiValueConverter
|
||||
var date = (DateTime)values[0];
|
||||
var isFolder = (bool)values[1];
|
||||
|
||||
return isFolder ? "" : date.ToString(CultureInfo.CurrentCulture);
|
||||
return isFolder ? string.Empty : date.ToString(CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
|
@@ -52,7 +52,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
||||
<PackageReference Include="PureSharpCompress" Version="0.39.0" />
|
||||
<PackageReference Include="UTF.Unknown" Version="2.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -61,7 +61,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40">
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3240.44">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
@@ -45,7 +45,7 @@ public class Plugin : IViewer
|
||||
".mdc", ".mef", ".mos", ".mrw",
|
||||
".nef", ".nrw",
|
||||
".obm", ".orf",
|
||||
".pbm", ".pef", ".pgm", ".png", ".pnm", ".ppm", ".psb", ".psd", ".ptx", ".pxn",
|
||||
".pbm", ".pcx", ".pef", ".pgm", ".png", ".pnm", ".ppm", ".psb", ".psd", ".ptx", ".pxn",
|
||||
".qoi",
|
||||
".r3d", ".raf", ".raw", ".rw2", ".rwl", ".rwz",
|
||||
".sr2", ".srf", ".srw", ".svg", ".svgz",
|
||||
|
@@ -58,7 +58,7 @@
|
||||
<PackageReference Include="QuickLook.ImageGlass.WebP" Version="1.4.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Svg.Skia" Version="3.0.0">
|
||||
<PackageReference Include="Svg.Skia" Version="3.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.6.0">
|
||||
|
@@ -55,7 +55,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MsgReader" Version="5.7.0" />
|
||||
<PackageReference Include="MsgReader" Version="5.7.2" />
|
||||
<PackageReference Include="OpenMcdf" Version="2.4.1" />
|
||||
<PackageReference Include="RtfPipe" Version="2.0.7677.4303" />
|
||||
</ItemGroup>
|
||||
|
@@ -137,16 +137,10 @@ internal class ResourceManager
|
||||
}
|
||||
}
|
||||
|
||||
private class VersionInfo
|
||||
private class VersionInfo(string embeddedHash, string extractedHash)
|
||||
{
|
||||
public string EmbeddedHash { get; set; }
|
||||
public string ExtractedHash { get; set; }
|
||||
|
||||
public VersionInfo(string embeddedHash, string extractedHash)
|
||||
{
|
||||
EmbeddedHash = embeddedHash;
|
||||
ExtractedHash = extractedHash;
|
||||
}
|
||||
public string EmbeddedHash { get; set; } = embeddedHash;
|
||||
public string ExtractedHash { get; set; } = extractedHash;
|
||||
}
|
||||
|
||||
private static string CalculateDirectoryHash(string directory)
|
||||
@@ -169,8 +163,8 @@ internal class ResourceManager
|
||||
combinedBytes.AddRange(contentBytes);
|
||||
}
|
||||
|
||||
var hash = sha256.ComputeHash(combinedBytes.ToArray());
|
||||
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
||||
var hash = sha256.ComputeHash([.. combinedBytes]);
|
||||
return BitConverter.ToString(hash).Replace("-", string.Empty).ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,32 +184,28 @@ internal class ResourceManager
|
||||
private string CalculateEmbeddedResourcesHash()
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
using (var sha256 = SHA256.Create())
|
||||
using var sha256 = SHA256.Create();
|
||||
var combinedBytes = new List<byte>();
|
||||
var resourceNames = assembly.GetManifestResourceNames()
|
||||
.Where(name => name.StartsWith(_resourcePrefix) &&
|
||||
!name.EndsWith(".version"))
|
||||
.OrderBy(name => name)
|
||||
.ToList();
|
||||
|
||||
foreach (var resourceName in resourceNames)
|
||||
{
|
||||
var combinedBytes = new List<byte>();
|
||||
var resourceNames = assembly.GetManifestResourceNames()
|
||||
.Where(name => name.StartsWith(_resourcePrefix) &&
|
||||
!name.EndsWith(".version"))
|
||||
.OrderBy(name => name)
|
||||
.ToList();
|
||||
var nameBytes = Encoding.UTF8.GetBytes(resourceName.ToLowerInvariant());
|
||||
combinedBytes.AddRange(nameBytes);
|
||||
|
||||
foreach (var resourceName in resourceNames)
|
||||
{
|
||||
var nameBytes = Encoding.UTF8.GetBytes(resourceName.ToLowerInvariant());
|
||||
combinedBytes.AddRange(nameBytes);
|
||||
|
||||
using (var stream = assembly.GetManifestResourceStream(resourceName))
|
||||
{
|
||||
if (stream == null) continue;
|
||||
var buffer = new byte[stream.Length];
|
||||
stream.Read(buffer, 0, buffer.Length);
|
||||
combinedBytes.AddRange(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
var hash = sha256.ComputeHash(combinedBytes.ToArray());
|
||||
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
||||
using var stream = assembly.GetManifestResourceStream(resourceName);
|
||||
if (stream == null) continue;
|
||||
var buffer = new byte[stream.Length];
|
||||
stream.Read(buffer, 0, buffer.Length);
|
||||
combinedBytes.AddRange(buffer);
|
||||
}
|
||||
|
||||
var hash = sha256.ComputeHash([.. combinedBytes]);
|
||||
return BitConverter.ToString(hash).Replace("-", string.Empty).ToLowerInvariant();
|
||||
}
|
||||
|
||||
private void GenerateVersionFile()
|
||||
|
@@ -27,7 +27,7 @@ namespace QuickLook.Plugin.PDFViewer;
|
||||
internal static class PdfPageExtension
|
||||
{
|
||||
private static int _renderCount;
|
||||
private static readonly object LockObj = new object();
|
||||
private static readonly object LockObj = new();
|
||||
|
||||
public static BitmapSource RenderThumbnail(this PdfDocumentWrapper doc, int page)
|
||||
{
|
||||
|
@@ -55,7 +55,7 @@ public partial class PdfViewerControl : UserControl, INotifyPropertyChanged, IDi
|
||||
pagePanel.ImageScrolled += NavigatePage;
|
||||
}
|
||||
|
||||
public ObservableCollection<int> PageThumbnails { get; set; } = new ObservableCollection<int>();
|
||||
public ObservableCollection<int> PageThumbnails { get; set; } = [];
|
||||
|
||||
public int TotalPages => PdfDocumentWrapper.PdfDocument.PageCount;
|
||||
|
||||
|
@@ -64,7 +64,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="PdfiumViewer.Updated" Version="2.14.5" />
|
||||
<PackageReference Include="bblanchon.PDFiumV8.Win32" Version="137.0.7123" />
|
||||
<PackageReference Include="bblanchon.PDFiumV8.Win32" Version="138.0.7188" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -83,13 +83,33 @@ public partial class PEInfoPanel : UserControl
|
||||
|
||||
try
|
||||
{
|
||||
using var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
using var binaryReader = new BinaryReader(stream);
|
||||
var byteArray = binaryReader.ReadBytes(1024); // Fast reading
|
||||
var peImage = PEImage.FromBinary(byteArray);
|
||||
var machine = peImage.CoffHeader.Machine;
|
||||
int maxAttempts = 3;
|
||||
int bufferSize = 1024;
|
||||
|
||||
arch = machine.ToImageMachineName();
|
||||
for (int attempt = 0; attempt < maxAttempts; attempt++)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
using var binaryReader = new BinaryReader(stream);
|
||||
var byteArray = binaryReader.ReadBytes(bufferSize);
|
||||
var peImage = PEImage.FromBinary(byteArray);
|
||||
var machine = peImage.CoffHeader.Machine;
|
||||
|
||||
arch = machine.ToImageMachineName();
|
||||
break; // Successfully parsed, jumped out of the loop
|
||||
}
|
||||
catch (Exception e) when (e.Message == "Section headers incomplete.")
|
||||
{
|
||||
// Extended buffer size
|
||||
bufferSize *= 2;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Non-Section headers errors will not be retryed
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@@ -63,7 +63,6 @@ public class Plugin : IViewer
|
||||
_ip.Tag = context;
|
||||
|
||||
context.ViewerContent = _ip;
|
||||
context.Title = $"{Path.GetFileName(path)}";
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace QuickLook.Plugin.VideoViewer;
|
||||
|
||||
@@ -48,7 +49,7 @@ public sealed class TimeTickToShortStringConverter : DependencyObject, IValueCon
|
||||
|
||||
public sealed class VolumeToIconConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
private static readonly string[] Volumes = { "\xE74F", "\xE993", "\xE994", "\xE995" };
|
||||
private static readonly string[] Volumes = ["\xE74F", "\xE993", "\xE994", "\xE995"];
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
@@ -69,3 +70,19 @@ public sealed class VolumeToIconConverter : DependencyObject, IValueConverter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CoverArtConverter : IValueConverter
|
||||
{
|
||||
private static readonly BitmapImage emptyImage =
|
||||
new(new Uri("pack://application:,,,/QuickLook.Plugin.VideoViewer;component/Resources/empty.png", UriKind.Absolute));
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value ?? emptyImage;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@
|
||||
<PackageReference Include="MediaInfo.Wrapper" Version="21.9.3">
|
||||
<Aliases>MediaInfoWrapper</Aliases>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MediaInfoDLL" Version="24.12.0">
|
||||
<PackageReference Include="MediaInfoDLL" Version="25.4.0">
|
||||
<Aliases>MediaInfoDLL</Aliases>
|
||||
</PackageReference>
|
||||
<Reference Include="WindowsBase" />
|
||||
@@ -49,7 +49,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<PackageReference Include="UTF.Unknown" Version="2.5.1" />
|
||||
<PackageReference Include="Melanchall.DryWetMidi" Version="7.2.0" />
|
||||
<PackageReference Include="Melanchall.DryWetMidi" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -187,17 +187,17 @@
|
||||
<DestinationFolder>$(OutDir)\LAVFilters-x86\</DestinationFolder>
|
||||
<Link>LAVFilters-x86\swscale-lav-8.dll</Link>
|
||||
</Content>
|
||||
<Content Include="$(NuGetPackageRoot)\MediaInfoDLL\24.12.0\lib\netstandard2.0\x64\MediaInfo.dll">
|
||||
<Content Include="$(NuGetPackageRoot)\MediaInfoDLL\25.4.0\lib\netstandard2.0\x64\MediaInfo.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<DestinationFolder>$(OutDir)MediaInfo-x64\</DestinationFolder>
|
||||
<Link>MediaInfo-x64\MediaInfo.dll</Link>
|
||||
</Content>
|
||||
<Content Include="$(NuGetPackageRoot)\MediaInfoDLL\24.12.0\lib\netstandard2.0\x86\MediaInfo.dll">
|
||||
<Content Include="$(NuGetPackageRoot)\MediaInfoDLL\25.4.0\lib\netstandard2.0\x86\MediaInfo.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<DestinationFolder>$(OutDir)MediaInfo-x86\</DestinationFolder>
|
||||
<Link>MediaInfo-x86\MediaInfo.dll</Link>
|
||||
</Content>
|
||||
<!--<Content Include="$(NuGetPackageRoot)\MediaInfoDLL\24.12.0\lib\netstandard2.0\arm64\MediaInfo.dll">
|
||||
<!--<Content Include="$(NuGetPackageRoot)\MediaInfoDLL\25.4.0\lib\netstandard2.0\arm64\MediaInfo.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<DestinationFolder>$(OutDir)MediaInfo-ARM64\</DestinationFolder>
|
||||
<Link>MediaInfo-ARM64\MediaInfo.dll</Link>
|
||||
|
@@ -41,18 +41,18 @@ public class RegFileObject
|
||||
|
||||
public RegFileObject()
|
||||
{
|
||||
regvalues = new Dictionary<string, Dictionary<string, RegValueObject>>();
|
||||
regvalues = [];
|
||||
}
|
||||
|
||||
public RegFileObject(string RegFileName)
|
||||
{
|
||||
regvalues = new Dictionary<string, Dictionary<string, RegValueObject>>();
|
||||
regvalues = [];
|
||||
Read(RegFileName);
|
||||
}
|
||||
|
||||
public RegFileObject(byte[] RegFileContents)
|
||||
{
|
||||
regvalues = new Dictionary<string, Dictionary<string, RegValueObject>>();
|
||||
regvalues = [];
|
||||
Read(RegFileContents);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class RegFileObject
|
||||
if (sKey.EndsWith("=")) sKey = sKey.Substring(0, sKey.Length - 1);
|
||||
sKey = StripeBraces(sKey);
|
||||
if (sKey == "@")
|
||||
sKey = "";
|
||||
sKey = string.Empty;
|
||||
else
|
||||
sKey = StripeLeadingChars(sKey, "\"");
|
||||
|
||||
@@ -226,7 +226,7 @@ public class RegFileObject
|
||||
while (sKey.EndsWith("\r\n")) sKey = sKey.Substring(0, sKey.Length - 2);
|
||||
|
||||
if (sKey == "@")
|
||||
sKey = "";
|
||||
sKey = string.Empty;
|
||||
else
|
||||
sKey = StripeLeadingChars(sKey, "\"");
|
||||
|
||||
@@ -443,7 +443,7 @@ public class RegValueObject
|
||||
return "HKEY_CURRENT_USER";
|
||||
}
|
||||
|
||||
return "";
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -512,44 +512,21 @@ public class RegValueObject
|
||||
|
||||
private string SetRegEntryType(string sRegDataType)
|
||||
{
|
||||
switch (sRegDataType)
|
||||
return sRegDataType switch
|
||||
{
|
||||
case "REG_QWORD":
|
||||
return "hex(b):";
|
||||
|
||||
case "REG_RESOURCE_REQUIREMENTS_LIST":
|
||||
return "hex(a):";
|
||||
|
||||
case "REG_FULL_RESOURCE_DESCRIPTOR":
|
||||
return "hex(9):";
|
||||
|
||||
case "REG_RESOURCE_LIST":
|
||||
return "hex(8):";
|
||||
|
||||
case "REG_MULTI_SZ":
|
||||
return "hex(7):";
|
||||
|
||||
case "REG_LINK":
|
||||
return "hex(6):";
|
||||
|
||||
case "REG_DWORD":
|
||||
return "dword:";
|
||||
|
||||
case "REG_EXPAND_SZ":
|
||||
return "hex(2):";
|
||||
|
||||
case "REG_NONE":
|
||||
return "hex(0):";
|
||||
|
||||
case "REG_BINARY":
|
||||
return "hex:";
|
||||
|
||||
case "REG_SZ":
|
||||
return "";
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
"REG_QWORD" => "hex(b):",
|
||||
"REG_RESOURCE_REQUIREMENTS_LIST" => "hex(a):",
|
||||
"REG_FULL_RESOURCE_DESCRIPTOR" => "hex(9):",
|
||||
"REG_RESOURCE_LIST" => "hex(8):",
|
||||
"REG_MULTI_SZ" => "hex(7):",
|
||||
"REG_LINK" => "hex(6):",
|
||||
"REG_DWORD" => "dword:",
|
||||
"REG_EXPAND_SZ" => "hex(2):",
|
||||
"REG_NONE" => "hex(0):",
|
||||
"REG_BINARY" => "hex:",
|
||||
"REG_SZ" => string.Empty,
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
/*
|
||||
hex: REG_BINARY
|
||||
|
@@ -14,6 +14,7 @@
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<local:TimeTickToShortStringConverter x:Key="TimeTickToShortStringConverter" />
|
||||
<local:VolumeToIconConverter x:Key="VolumeToIconConverter" />
|
||||
<local:CoverArtConverter x:Key="CoverArtConverter" />
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
@@ -54,23 +55,14 @@
|
||||
Opacity="0.6" />
|
||||
<Image x:Name="imageCoverArt"
|
||||
Grid.Column="0"
|
||||
Margin="20,40,20,40">
|
||||
Margin="20,40,20,40"
|
||||
Source="{Binding CoverArt, ElementName=viewerPanel, Converter={StaticResource CoverArtConverter}}">
|
||||
<Image.Effect>
|
||||
<DropShadowEffect BlurRadius="6"
|
||||
Direction="0"
|
||||
ShadowDepth="0"
|
||||
Color="#FF898989" />
|
||||
</Image.Effect>
|
||||
<Image.Style>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Source" Value="{Binding CoverArt, ElementName=viewerPanel}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding CoverArt, ElementName=viewerPanel, FallbackValue=0, TargetNullValue=0}" Value="0">
|
||||
<Setter Property="Source" Value="Resources/empty.png" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
</Image>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.Effect>
|
||||
|
@@ -20,6 +20,7 @@ using QuickLook.Common.Helpers;
|
||||
using QuickLook.Helpers;
|
||||
using QuickLook.NativeMethods;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -31,9 +32,6 @@ using Wpf.Ui.Violeta.Appearance;
|
||||
|
||||
namespace QuickLook;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public static readonly string LocalDataPath = SettingHelper.LocalDataPath;
|
||||
@@ -50,11 +48,77 @@ public partial class App : Application
|
||||
private bool _cleanExit = true;
|
||||
private Mutex _isRunning;
|
||||
|
||||
static App()
|
||||
{
|
||||
// Explicitly set to PerMonitor to avoid being overridden by the system
|
||||
if (SHCore.SetProcessDpiAwareness(SHCore.PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE) is uint result)
|
||||
{
|
||||
Debug.WriteLine(
|
||||
result == 0 ?
|
||||
"DPI Awareness applied successfully" :
|
||||
$"DPI Awareness manual setup failed. Error Code: {result}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
|
||||
// Exception handling events which are not caught in the Task thread
|
||||
TaskScheduler.UnobservedTaskException += (_, e) =>
|
||||
{
|
||||
ProcessHelper.WriteLog(((Exception)args.ExceptionObject).ToString());
|
||||
try
|
||||
{
|
||||
ProcessHelper.WriteLog(e.Exception.ToString());
|
||||
Wpf.Ui.Violeta.Controls.ExceptionReport.Show(e.Exception);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProcessHelper.WriteLog(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
e.SetObserved();
|
||||
}
|
||||
};
|
||||
|
||||
// Exception handling events which are not caught in UI thread
|
||||
DispatcherUnhandledException += (_, e) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
ProcessHelper.WriteLog(e.Exception.ToString());
|
||||
Wpf.Ui.Violeta.Controls.ExceptionReport.Show(e.Exception);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProcessHelper.WriteLog(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Exception handling events which are not caught in Non-UI thread
|
||||
// Such as a child thread created by ourself
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.ExceptionObject is Exception ex)
|
||||
{
|
||||
ProcessHelper.WriteLog(ex.ToString());
|
||||
Wpf.Ui.Violeta.Controls.ExceptionReport.Show(ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProcessHelper.WriteLog(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize MessageBox patching
|
||||
@@ -133,7 +197,7 @@ public partial class App : Application
|
||||
{
|
||||
TrayIconManager.GetInstance();
|
||||
if (!e.Args.Contains("/autorun") && !IsUWP)
|
||||
TrayIconManager.ShowNotification("", TranslationHelper.Get("APP_START"));
|
||||
TrayIconManager.ShowNotification(string.Empty, TranslationHelper.Get("APP_START"));
|
||||
if (e.Args.Contains("/first"))
|
||||
AutoStartupHelper.CreateAutorunShortcut();
|
||||
|
||||
|
@@ -49,7 +49,7 @@ internal static class AutoStartupHelper
|
||||
catch (Exception e)
|
||||
{
|
||||
ProcessHelper.WriteLog(e.ToString());
|
||||
TrayIconManager.ShowNotification("", "Failed to add QuickLook to Startup folder.");
|
||||
TrayIconManager.ShowNotification(string.Empty, "Failed to add QuickLook to Startup folder.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ internal static class AutoStartupHelper
|
||||
catch (Exception e)
|
||||
{
|
||||
ProcessHelper.WriteLog(e.ToString());
|
||||
TrayIconManager.ShowNotification("", "Failed to delete QuickLook startup shortcut.");
|
||||
TrayIconManager.ShowNotification(string.Empty, "Failed to delete QuickLook startup shortcut.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ internal class Updater
|
||||
{
|
||||
if (!silent)
|
||||
Application.Current.Dispatcher.Invoke(
|
||||
() => TrayIconManager.ShowNotification("",
|
||||
() => TrayIconManager.ShowNotification(string.Empty,
|
||||
TranslationHelper.Get("Update_NoUpdate")));
|
||||
return;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ internal class Updater
|
||||
Application.Current.Dispatcher.Invoke(
|
||||
() =>
|
||||
{
|
||||
TrayIconManager.ShowNotification("",
|
||||
TrayIconManager.ShowNotification(string.Empty,
|
||||
string.Format(TranslationHelper.Get("Update_Found"), nVersion),
|
||||
timeout: 20000,
|
||||
clickEvent:
|
||||
@@ -74,7 +74,7 @@ internal class Updater
|
||||
{
|
||||
Debug.WriteLine(e.Message);
|
||||
Application.Current.Dispatcher.Invoke(
|
||||
() => TrayIconManager.ShowNotification("",
|
||||
() => TrayIconManager.ShowNotification(string.Empty,
|
||||
string.Format(TranslationHelper.Get("Update_Error"), e.Message)));
|
||||
}
|
||||
});
|
||||
@@ -110,7 +110,7 @@ internal class Updater
|
||||
{
|
||||
Debug.WriteLine(e.Message);
|
||||
Application.Current.Dispatcher.Invoke(
|
||||
() => TrayIconManager.ShowNotification("",
|
||||
() => TrayIconManager.ShowNotification(string.Empty,
|
||||
string.Format(TranslationHelper.Get("Update_Error"), e.Message)));
|
||||
}
|
||||
});
|
||||
|
16
QuickLook/NativeMethods/SHCore.cs
Normal file
16
QuickLook/NativeMethods/SHCore.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace QuickLook.NativeMethods;
|
||||
|
||||
internal static class SHCore
|
||||
{
|
||||
public enum PROCESS_DPI_AWARENESS
|
||||
{
|
||||
PROCESS_DPI_UNAWARE,
|
||||
PROCESS_SYSTEM_DPI_AWARE,
|
||||
PROCESS_PER_MONITOR_DPI_AWARE
|
||||
}
|
||||
|
||||
[DllImport("shcore.dll")]
|
||||
public static extern uint SetProcessDpiAwareness(PROCESS_DPI_AWARENESS awareness);
|
||||
}
|
@@ -1,23 +1,24 @@
|
||||
// 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 System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
@@ -45,17 +46,15 @@ using System.Windows;
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
@@ -65,4 +64,7 @@ using System.Windows;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// If .NET Version is higher than 4.6.2 (Not include 4.6.2), use the following line
|
||||
// [assembly: DisableDpiAwareness]
|
||||
|
@@ -102,16 +102,16 @@
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.0.2.2">
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.0.2.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Lib.Harmony" Version="2.3.5">
|
||||
<PackageReference Include="Lib.Harmony" Version="2.3.6">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="UnblockZoneIdentifier " Version="1.0.0">
|
||||
<PackageReference Include="UnblockZoneIdentifier" Version="1.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
@@ -53,7 +53,7 @@ internal class TrayIconManager : IDisposable
|
||||
Icon = GetTrayIconByDPI(),
|
||||
ContextMenu = new ContextMenu(
|
||||
[
|
||||
new MenuItem($"v{Application.ProductVersion}{(App.IsUWP ? " (UWP)" : "")}") {Enabled = false},
|
||||
new MenuItem($"v{Application.ProductVersion}{(App.IsUWP ? " (UWP)" : string.Empty)}") {Enabled = false},
|
||||
new MenuItem("-"),
|
||||
new MenuItem(TranslationHelper.Get("Icon_CheckUpdate"), (_, _) => Updater.CheckForUpdates()),
|
||||
new MenuItem(TranslationHelper.Get("Icon_GetPlugin"),
|
||||
|
@@ -69,12 +69,12 @@ public partial class ViewerWindow : INotifyPropertyChanged
|
||||
case nameof(ContextObject.Title):
|
||||
if (!string.IsNullOrWhiteSpace(ContextObject.Title))
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
Dispatcher?.Invoke(() =>
|
||||
{
|
||||
ShowInTaskbar = true;
|
||||
// We can not update the Title when ShowInTaskbar is false
|
||||
// https://github.com/QL-Win/QuickLook/issues/1628
|
||||
Title = $"QuickLook - {ContextObject.Title}";
|
||||
ShowInTaskbar = false;
|
||||
}));
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -20,6 +20,7 @@ using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
using QuickLook.Helpers;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
@@ -108,6 +109,15 @@ public partial class ViewerWindow : Window
|
||||
buttonShare.ToolTip = TranslationHelper.Get("MW_Share");
|
||||
}
|
||||
|
||||
public new void Close()
|
||||
{
|
||||
// Workaround to prevent DPI jump animation when closing window in .NET Framework 4.6.2
|
||||
// Safe to remove this line if QuickLook no longer targets .NET Framework 4.6.2
|
||||
Hide();
|
||||
|
||||
base.Close();
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
@@ -54,8 +54,8 @@
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- The combination of below two tags have the following effect : 1) Per-Monitor for >= Windows 10 Anniversary Update 2) System < Windows 10 Anniversary Update -->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>-->
|
||||
<!--<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>-->
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
# QuickLook
|
||||
|
||||
<a href="https://trendshift.io/repositories/3258" target="_blank"><img src="https://trendshift.io/api/badge/repositories/3258" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
[](https://ci.appveyor.com/project/xupefei/QuickLook)
|
||||
[](https://github.com/QL-Win/QuickLook/releases)
|
||||
@@ -31,7 +33,7 @@ I am aware that several alternatives are already available on the Internet (e.g.
|
||||
|
||||
Get it from one of the following sources:
|
||||
|
||||
* Microsoft Store (Windows 10 users only, no preview in open/save-dialogs available) <a href="https://www.microsoft.com/store/apps/9nv4bs3l1h4s?ocid=badge" target="_blank"><img src="https://developer.microsoft.com/store/badges/images/English_get_L.png" height="22px" alt="Store Link" /></a>
|
||||
* Microsoft Store (Windows 10 and later only). Not supported on Windows 10 S. Not support file preview in Open-File or Save-File dialogs. <a href="https://www.microsoft.com/store/apps/9nv4bs3l1h4s?ocid=badge" target="_blank"><img src="https://developer.microsoft.com/store/badges/images/English_get_L.png" height="22px" alt="Store Link" /></a>
|
||||
* Installer or portable archive of the stable version from [GitHub Release](https://github.com/QL-Win/QuickLook/releases)
|
||||
* Using [Scoop](https://scoop.sh/): `scoop bucket add extras && scoop install extras/quicklook`
|
||||
* Nightly builds from [AppVeyor](https://ci.appveyor.com/project/xupefei/quicklook/build/artifacts) and [GitHub Action](https://github.com/QL-Win/QuickLook/releases/)
|
||||
@@ -68,6 +70,10 @@ See the [Wiki page](https://github.com/QL-Win/QuickLook/wiki)
|
||||
|
||||
See the [Translation guide](https://github.com/QL-Win/QuickLook/wiki/Translations)
|
||||
|
||||
## Community
|
||||
|
||||
QQ Group: [371388501](https://qm.qq.com/q/KIczirznua)
|
||||
|
||||
## Developer
|
||||
|
||||
- **Formatter**: [CodeMaid.config](CodeMaid.config), [Settings.XamlStyler](Settings.XamlStyler)
|
||||
|
10
Scripts/pack-7z.ps1
Normal file
10
Scripts/pack-7z.ps1
Normal file
@@ -0,0 +1,10 @@
|
||||
$version = git describe --always --tags --exclude latest
|
||||
|
||||
Set-Location ../Build
|
||||
|
||||
Write-Output "This file makes QuickLook portable." >> .\Package\portable.lock
|
||||
|
||||
Remove-Item .\QuickLook-$version.7z -ErrorAction SilentlyContinue
|
||||
7z.exe a .\QuickLook-$version.7z .\Package\* -t7z -mx=9 -ms=on -m0=lzma2 -mf=BCJ2 -r -y
|
||||
|
||||
Remove-Item .\Package\portable.lock
|
6
Scripts/pack-all.ps1
Normal file
6
Scripts/pack-all.ps1
Normal file
@@ -0,0 +1,6 @@
|
||||
# Please build the msi installation package in advance
|
||||
powershell -file "pack-7z.ps1"
|
||||
powershell -file "pack-setup.ps1"
|
||||
powershell -file "pack-appx.ps1"
|
||||
powershell -file "sign-appx.ps1"
|
||||
Pause
|
@@ -1,35 +0,0 @@
|
||||
$version = git describe --always --tags "--abbrev=0" --exclude latest
|
||||
|
||||
if($version.Split('.').Length.Equals(3))
|
||||
{
|
||||
$version += ".0"
|
||||
}
|
||||
|
||||
function Update-Version($path)
|
||||
{
|
||||
$xml = [xml](Get-Content $path)
|
||||
$xml.Package.Identity.Version="$version"
|
||||
$xml.Save("$path")
|
||||
}
|
||||
|
||||
if(-not (Test-Path env:CI))
|
||||
{
|
||||
# prapare folders
|
||||
Remove-Item -Recurse ..\Build\Appx -ErrorAction SilentlyContinue
|
||||
Copy-Item -Recurse ..\Build\Package ..\Build\Appx\Package
|
||||
Copy-Item -Recurse ..\Build\Assets ..\Build\Appx\Assets
|
||||
Copy-item ..\Build\AppxManifest.dev.xml ..\Build\Appx\AppxManifest.xml
|
||||
|
||||
# set version to git version
|
||||
Update-Version("..\Build\Appx\AppxManifest.xml")
|
||||
|
||||
# generate resources
|
||||
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe'
|
||||
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
|
||||
|
||||
# packing
|
||||
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe'
|
||||
$folder = '..\Build\Appx\'
|
||||
|
||||
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx
|
||||
}
|
@@ -24,11 +24,11 @@ if(-not (Test-Path env:CI))
|
||||
Update-Version("..\Build\Appx\AppxManifest.xml")
|
||||
|
||||
# generate resources
|
||||
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makepri.exe'
|
||||
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\makepri.exe'
|
||||
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
|
||||
|
||||
# packing
|
||||
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makeappx.exe'
|
||||
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\makeappx.exe'
|
||||
$folder = '..\Build\Appx\'
|
||||
|
||||
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx
|
||||
|
@@ -1,16 +1,10 @@
|
||||
$version = git describe --always --tags --exclude latest
|
||||
|
||||
Set-Location ../Build
|
||||
|
||||
Remove-Item .\QuickLook.7z -ErrorAction SilentlyContinue
|
||||
7z a QuickLook.7z .\Package\* -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
Remove-Item .\Package.7z -ErrorAction SilentlyContinue
|
||||
7z a Package.7z .\Package\* -t7z -mx=9 -ms=on -m0=lzma2 -mf=BCJ2 -r -y
|
||||
makemica micasetup.json
|
||||
|
||||
Write-Output "This file makes QuickLook portable." >> .\Package\portable.lock
|
||||
7z a QuickLook.7z .\Package\portable.lock -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
|
||||
$version = git describe --always --tags --exclude latest
|
||||
Remove-Item .\QuickLook-$version.7z -ErrorAction SilentlyContinue
|
||||
Rename-Item .\QuickLook.7z QuickLook-$version.7z
|
||||
Remove-Item .\QuickLook-$version.exe -ErrorAction SilentlyContinue
|
||||
Rename-Item .\QuickLook.exe QuickLook-$version.exe
|
||||
|
||||
pause
|
||||
Remove-Item .\Package.7z -ErrorAction SilentlyContinue
|
@@ -1,5 +1,22 @@
|
||||
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe'
|
||||
$files = gci '..\Build\QuickLook-*.appx' | %{('"{0}"' -f $_.FullName)}
|
||||
$opensslExe = 'C:\Program Files\Git\usr\bin\openssl.exe'
|
||||
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe'
|
||||
$timestampUrl = 'http://time.certum.pl/'
|
||||
$version = git describe --always --tags "--abbrev=0" --exclude latest
|
||||
|
||||
.$signExe sign /a /v /fd sha256 /t $timestampUrl $files
|
||||
if($version.Split('.').Length.Equals(3))
|
||||
{
|
||||
$version += ".0"
|
||||
}
|
||||
|
||||
Set-Location ../Build
|
||||
|
||||
if (-not (Test-Path sideload.key)) {
|
||||
.$opensslExe genrsa -out "sideload.key" 2048
|
||||
}
|
||||
if (-not (Test-Path sideload.pfx)) {
|
||||
.$opensslExe req -new -x509 -days 825 -key "sideload.key" -out "sideload.crt" -config "openssl-sign.cnf" -subj "/CN=CE36AF3D-FF94-43EB-9908-7EC8FD1D29FB"
|
||||
.$opensslExe pkcs12 -export -out "sideload.pfx" -inkey "sideload.key" -in "sideload.crt" -password pass:123456
|
||||
}
|
||||
|
||||
.$signExe sign /fd sha256 /f "sideload.pfx" /p 123456 /td sha256 /tr $timestampUrl QuickLook-$version.appx
|
||||
.$signExe verify /pa /v QuickLook-$version.appx
|
||||
|
Reference in New Issue
Block a user