mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-09 12:29:30 +00:00
Compare commits
49 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c6c727d2cc | ||
![]() |
dea3d05660 | ||
![]() |
7b5b01a7b4 | ||
![]() |
0ee6e3621b | ||
![]() |
437d47ed05 | ||
![]() |
b80c264cdf | ||
![]() |
bd9b32ff91 | ||
![]() |
7c8655aff3 | ||
![]() |
df4f642b51 | ||
![]() |
95492fdd80 | ||
![]() |
e8524dced5 | ||
![]() |
698e780988 | ||
![]() |
660dc88001 | ||
![]() |
c93be2cb51 | ||
![]() |
fc14b58fa5 | ||
![]() |
1ed5f5ba2a | ||
![]() |
22c08f62fa | ||
![]() |
b39a58f1b9 | ||
![]() |
d3217a0983 | ||
![]() |
e8125c51c5 | ||
![]() |
ef51c459ab | ||
![]() |
f726841d99 | ||
![]() |
e640a8b98a | ||
![]() |
fe6dae67ce | ||
![]() |
eaa918079c | ||
![]() |
69d6aa0f0a | ||
![]() |
51ddd18c34 | ||
![]() |
c10773249f | ||
![]() |
cbaf636173 | ||
![]() |
4a476aff4b | ||
![]() |
28b9552dcd | ||
![]() |
971285fc95 | ||
![]() |
1ad78c9f4b | ||
![]() |
237b99b305 | ||
![]() |
2b8b0e5c6d | ||
![]() |
49bb96e92d | ||
![]() |
1e5de83f62 | ||
![]() |
df66c425e3 | ||
![]() |
f32536f51e | ||
![]() |
3ef980bb17 | ||
![]() |
885b3ed53f | ||
![]() |
8c8ade0bf9 | ||
![]() |
9478f9d4d7 | ||
![]() |
0dd8e919ca | ||
![]() |
a5763e460e | ||
![]() |
dc0d275015 | ||
![]() |
9fc90ae479 | ||
![]() |
b6dc1cafcb | ||
![]() |
b683ce0fd1 |
@@ -3,7 +3,7 @@ branches:
|
||||
only:
|
||||
- master
|
||||
skip_branch_with_pr: true
|
||||
image: Visual Studio 2019
|
||||
image: Visual Studio 2022
|
||||
configuration: Release
|
||||
platform: Any CPU
|
||||
clone_script:
|
||||
|
Submodule QuickLook.Common updated: 7b4e2fd3a0...065530d935
@@ -103,7 +103,7 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer)
|
||||
auto b = new WCHAR[size];
|
||||
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path, -1, b, size);
|
||||
|
||||
wcscpy_s(buffer, MAX_PATH_EX, b); // DOpus supports Long Path
|
||||
wcscpy_s(buffer, wcslen(b) + 1, b); // DOpus supports Long Path
|
||||
|
||||
delete[] b;
|
||||
return; // we now cares only the first result
|
||||
|
@@ -18,16 +18,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "HelperMethods.h"
|
||||
|
||||
void HelperMethods::GetSelectedInternal(CComQIPtr<IWebBrowserApp> pwba, PWCHAR buffer)
|
||||
void HelperMethods::GetSelectedInternal(CComPtr<IShellBrowser> psb, PWCHAR buffer)
|
||||
{
|
||||
CComQIPtr<IServiceProvider> psp;
|
||||
if (FAILED(pwba->QueryInterface(IID_IServiceProvider, reinterpret_cast<void**>(&psp))))
|
||||
return;
|
||||
|
||||
CComPtr<IShellBrowser> psb;
|
||||
if (FAILED(psp->QueryService(SID_STopLevelBrowser, IID_IShellBrowser, reinterpret_cast<LPVOID*>(&psb))))
|
||||
return;
|
||||
|
||||
CComPtr<IShellView> psv;
|
||||
if (FAILED(psb->QueryActiveShellView(&psv)))
|
||||
return;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
class HelperMethods
|
||||
{
|
||||
public:
|
||||
static void GetSelectedInternal(CComQIPtr<IWebBrowserApp> pWebBrowserApp, PWCHAR buffer);
|
||||
static void GetSelectedInternal(CComPtr<IShellBrowser> psb, PWCHAR buffer);
|
||||
static void ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer);
|
||||
static bool IsCursorActivated(HWND hwndfg);
|
||||
static bool IsExplorerSearchBoxFocused();
|
||||
|
@@ -22,13 +22,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
@@ -104,7 +104,8 @@ void Shell32::getSelectedFromExplorer(PWCHAR buffer)
|
||||
if (FAILED(psw.CoCreateInstance(CLSID_ShellWindows)))
|
||||
return;
|
||||
|
||||
auto hwndfg = GetForegroundWindow();
|
||||
auto hwndfgw = GetForegroundWindow();
|
||||
auto hwndfgt = FindWindowEx(hwndfgw, nullptr, L"ShellTabWindowClass", nullptr);
|
||||
|
||||
auto count = 0L;
|
||||
psw->get_Count(&count);
|
||||
@@ -120,18 +121,26 @@ void Shell32::getSelectedFromExplorer(PWCHAR buffer)
|
||||
if (S_OK != psw->Item(vi, &pdisp))
|
||||
continue;
|
||||
|
||||
CComQIPtr<IWebBrowserApp> pwba;
|
||||
if (FAILED(pdisp->QueryInterface(IID_IWebBrowserApp, reinterpret_cast<void**>(&pwba))))
|
||||
CComPtr<IServiceProvider> psp;
|
||||
if (FAILED(pdisp->QueryInterface(IID_IServiceProvider, reinterpret_cast<void**>(&psp))))
|
||||
continue;
|
||||
|
||||
HWND hwndwba;
|
||||
if (FAILED(pwba->get_HWND(reinterpret_cast<LONG_PTR*>(&hwndwba))))
|
||||
CComPtr<IShellBrowser> psb;
|
||||
if (FAILED(psp->QueryService(IID_IShellBrowser, IID_IShellBrowser, reinterpret_cast<LPVOID*>(&psb))))
|
||||
continue;
|
||||
|
||||
if (hwndwba != hwndfg || HelperMethods::IsCursorActivated(hwndwba))
|
||||
HWND phwnd;
|
||||
if (FAILED(psb->GetWindow(&phwnd)))
|
||||
continue;
|
||||
|
||||
HelperMethods::GetSelectedInternal(pwba, buffer);
|
||||
if (hwndfgw != phwnd && (hwndfgt != nullptr && hwndfgt != phwnd))
|
||||
continue;
|
||||
|
||||
if (HelperMethods::IsCursorActivated(0))
|
||||
continue;
|
||||
|
||||
HelperMethods::GetSelectedInternal(psb, buffer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +149,7 @@ void Shell32::getSelectedFromDesktop(PWCHAR buffer)
|
||||
CoInitialize(nullptr);
|
||||
|
||||
CComPtr<IShellWindows> psw;
|
||||
CComQIPtr<IWebBrowserApp> pwba;
|
||||
CComPtr<IWebBrowserApp> pwba;
|
||||
|
||||
if (FAILED(psw.CoCreateInstance(CLSID_ShellWindows)))
|
||||
return;
|
||||
@@ -155,5 +164,13 @@ void Shell32::getSelectedFromDesktop(PWCHAR buffer)
|
||||
if (HelperMethods::IsCursorActivated(reinterpret_cast<HWND>(LongToHandle(phwnd))))
|
||||
return;
|
||||
|
||||
HelperMethods::GetSelectedInternal(pwba, buffer);
|
||||
CComPtr<IServiceProvider> psp;
|
||||
if (FAILED(pwba->QueryInterface(IID_IServiceProvider, reinterpret_cast<void**>(&psp))))
|
||||
return;
|
||||
|
||||
CComPtr<IShellBrowser> psb;
|
||||
if (FAILED(psp->QueryService(IID_IShellBrowser, IID_IShellBrowser, reinterpret_cast<LPVOID*>(&psb))))
|
||||
return;
|
||||
|
||||
HelperMethods::GetSelectedInternal(psb, buffer);
|
||||
}
|
||||
|
@@ -42,13 +42,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
@@ -90,14 +90,14 @@ void GetCurrentSelection()
|
||||
if (hMapFile == nullptr)
|
||||
return;
|
||||
|
||||
auto buffer = static_cast<PWCHAR>(MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH * sizeof WCHAR));
|
||||
auto buffer = static_cast<PWCHAR>(MapViewOfFile(hMapFile, FILE_MAP_WRITE, 0, 0, 0));
|
||||
if (buffer == nullptr)
|
||||
{
|
||||
CloseHandle(hMapFile);
|
||||
return;
|
||||
}
|
||||
|
||||
wcscpy_s(buffer, MAX_PATH_EX, dllBuffer);
|
||||
wcscpy_s(buffer, wcslen(dllBuffer) + 1, dllBuffer);
|
||||
|
||||
UnmapViewOfFile(buffer);
|
||||
CloseHandle(hMapFile);
|
||||
|
@@ -22,13 +22,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
@@ -26,7 +26,7 @@ namespace QuickLook.Plugin.ArchiveViewer
|
||||
public class Plugin : IViewer
|
||||
{
|
||||
private static readonly string[] Extensions =
|
||||
{".rar", ".zip", ".tar", ".tgz", ".gz", ".bz2", ".lz", ".xz", ".7z", ".jar", ".crx"};
|
||||
{".rar", ".zip", ".tar", ".tgz", ".gz", ".bz2", ".lz", ".xz", ".7z", ".jar", ".crx", ".nupkg"};
|
||||
|
||||
private ArchiveInfoPanel _panel;
|
||||
|
||||
|
@@ -59,8 +59,8 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="SharpCompress, Version=0.25.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\SharpCompress.0.25.1\lib\net46\SharpCompress.dll</HintPath>
|
||||
<Reference Include="SharpCompress, Version=0.26.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\SharpCompress.0.26.0\lib\net46\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
@@ -78,9 +78,12 @@
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encoding.CodePages, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Text.Encoding.CodePages.4.5.1\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="UtfUnknown, Version=2.0.0.0, Culture=neutral, PublicKeyToken=90217ce7a23260d4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\UTF.Unknown.2.3.0\lib\net40\UtfUnknown.dll</HintPath>
|
||||
<HintPath>..\..\packages\UTF.Unknown.2.5.0\lib\net40\UtfUnknown.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="SharpCompress" version="0.25.1" targetFramework="net462" />
|
||||
<package id="SharpCompress" version="0.26.0" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net462" />
|
||||
<package id="UTF.Unknown" version="2.3.0" targetFramework="net462" />
|
||||
<package id="System.Text.Encoding.CodePages" version="4.5.1" targetFramework="net462" />
|
||||
<package id="UTF.Unknown" version="2.5.0" targetFramework="net462" />
|
||||
</packages>
|
@@ -48,14 +48,14 @@ namespace QuickLook.Plugin.CsvViewer
|
||||
|
||||
using (var sr = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||
{
|
||||
var conf = new Configuration {MissingFieldFound = null, BadDataFound = null};
|
||||
var conf = new CsvConfiguration(CultureInfo.CurrentUICulture) {MissingFieldFound = null, BadDataFound = null, DetectDelimiter = true};
|
||||
|
||||
using (var parser = new CsvParser(sr, conf))
|
||||
{
|
||||
var i = 0;
|
||||
while (true)
|
||||
while (parser.Read())
|
||||
{
|
||||
var row = parser.Read();
|
||||
var row = parser.Record;
|
||||
if (row == null)
|
||||
break;
|
||||
row = Concat(new[] {$"{i++ + 1}".PadLeft(6)}, row);
|
||||
|
@@ -34,7 +34,7 @@ namespace QuickLook.Plugin.CsvViewer
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
return !Directory.Exists(path) && path.ToLower().EndsWith(".csv");
|
||||
return !Directory.Exists(path) && (path.ToLower().EndsWith(".csv") || path.ToLower().EndsWith(".tsv"));
|
||||
}
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
|
@@ -56,13 +56,23 @@
|
||||
</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CsvHelper, Version=12.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\CsvHelper.12.3.2\lib\net45\CsvHelper.dll</HintPath>
|
||||
<Reference Include="CsvHelper, Version=27.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\CsvHelper.27.1.1\lib\net45\CsvHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
|
@@ -1,7 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CsvHelper" version="12.3.2" targetFramework="net462" />
|
||||
<package id="Microsoft.CSharp" version="4.5.0" targetFramework="net462" />
|
||||
<package id="CsvHelper" version="27.1.1" targetFramework="net462" />
|
||||
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
</packages>
|
@@ -61,14 +61,14 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Web.WebView2.Core, Version=1.0.664.37, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Web.WebView2.1.0.664.37\lib\net462\Microsoft.Web.WebView2.Core.dll</HintPath>
|
||||
<Reference Include="Microsoft.Web.WebView2.Core, Version=1.0.1020.30, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Web.WebView2.1.0.1020.30\lib\net45\Microsoft.Web.WebView2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.WebView2.WinForms, Version=1.0.664.37, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Web.WebView2.1.0.664.37\lib\net462\Microsoft.Web.WebView2.WinForms.dll</HintPath>
|
||||
<Reference Include="Microsoft.Web.WebView2.WinForms, Version=1.0.1020.30, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Web.WebView2.1.0.1020.30\lib\net45\Microsoft.Web.WebView2.WinForms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.WebView2.Wpf, Version=1.0.664.37, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Web.WebView2.1.0.664.37\lib\net462\Microsoft.Web.WebView2.Wpf.dll</HintPath>
|
||||
<Reference Include="Microsoft.Web.WebView2.Wpf, Version=1.0.1020.30, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Web.WebView2.1.0.1020.30\lib\net45\Microsoft.Web.WebView2.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -124,11 +124,11 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\packages\Microsoft.Web.WebView2.1.0.664.37\build\Microsoft.Web.WebView2.targets" Condition="Exists('..\..\packages\Microsoft.Web.WebView2.1.0.664.37\build\Microsoft.Web.WebView2.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.Web.WebView2.1.0.1020.30\build\Microsoft.Web.WebView2.targets" Condition="Exists('..\..\packages\Microsoft.Web.WebView2.1.0.1020.30\build\Microsoft.Web.WebView2.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Web.WebView2.1.0.664.37\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Web.WebView2.1.0.664.37\build\Microsoft.Web.WebView2.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.Web.WebView2.1.0.1020.30\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Web.WebView2.1.0.1020.30\build\Microsoft.Web.WebView2.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
@@ -7,9 +7,15 @@
|
||||
<de>
|
||||
<WEBVIEW2_NOT_AVAILABLE>Für das Anzeigen dieses Dateityps wird MS Edge WebView2 benötigt. Hier klicken zum Downloaden.</WEBVIEW2_NOT_AVAILABLE>
|
||||
</de>
|
||||
<fr>
|
||||
<WEBVIEW2_NOT_AVAILABLE>Microsoft Edge WebView2 est requis pour afficher ce type de fichier. Cliquez ici pour le télécharger.</WEBVIEW2_NOT_AVAILABLE>
|
||||
</fr>
|
||||
<ja>
|
||||
<WEBVIEW2_NOT_AVAILABLE>このファイルを閲覧するには、Microsoft Edge WebView2 がインストールされている必要があります。 ここをクリックしてダウンロードを開始する。</WEBVIEW2_NOT_AVAILABLE>
|
||||
</ja>
|
||||
<ko-KR>
|
||||
<WEBVIEW2_NOT_AVAILABLE>이 파일을 표시하려면 Microsoft Edge WebView2가 필요합니다. 여기를 클릭해서 다운로드 하세요.</WEBVIEW2_NOT_AVAILABLE>
|
||||
</ko-KR>
|
||||
<zh-CN>
|
||||
<WEBVIEW2_NOT_AVAILABLE>查看此文件需要安装 Microsoft Edge WebView2。 点击这里开始下载。</WEBVIEW2_NOT_AVAILABLE>
|
||||
</zh-CN>
|
||||
@@ -19,4 +25,13 @@
|
||||
<es>
|
||||
<WEBVIEW2_NOT_AVAILABLE>Es necesario tener instalado Microsoft Edge WebView2 para ver este fichero. Haga clic aquí para descargarlo.</WEBVIEW2_NOT_AVAILABLE>
|
||||
</es>
|
||||
<it>
|
||||
<WEBVIEW2_NOT_AVAILABLE>Visualizzare questo file richiede che Microsoft Edge WebView2 sia installato. Clicca qui per scaricarlo.</WEBVIEW2_NOT_AVAILABLE>
|
||||
</it>
|
||||
<ar>
|
||||
<WEBVIEW2_NOT_AVAILABLE>مطلوب لعرض هذا الملف. انقر هنا لتحميله Microsoft Edge WebView2</WEBVIEW2_NOT_AVAILABLE>
|
||||
</ar>
|
||||
<pl>
|
||||
<WEBVIEW2_NOT_AVAILABLE>Wyświetlenie tego pliku wymaga zainstalowania Microsoft Edge WebView2. Kliknij tutaj, aby go pobrać.</WEBVIEW2_NOT_AVAILABLE>
|
||||
</pl>
|
||||
</Translations>
|
||||
|
@@ -18,6 +18,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
@@ -92,7 +93,8 @@ namespace QuickLook.Plugin.HtmlViewer
|
||||
{
|
||||
var button = new Button
|
||||
{
|
||||
Content = TranslationHelper.Get("WEBVIEW2_NOT_AVAILABLE"),
|
||||
Content = TranslationHelper.Get("WEBVIEW2_NOT_AVAILABLE",
|
||||
domain: Assembly.GetExecutingAssembly().GetName().Name),
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Padding = new Thickness(20, 6, 20, 6)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Microsoft.Web.WebView2" version="1.0.664.37" targetFramework="net462" />
|
||||
<package id="Microsoft.Web.WebView2" version="1.0.1020.30" targetFramework="net462" />
|
||||
</packages>
|
@@ -48,12 +48,12 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
public event EventHandler ImageLoaded;
|
||||
public event EventHandler DoZoomToFit;
|
||||
|
||||
private static AnimationProvider InitAnimationProvider(Uri path, MetaProvider meta)
|
||||
private static AnimationProvider InitAnimationProvider(Uri path, MetaProvider meta, ContextObject contextObject)
|
||||
{
|
||||
var ext = Path.GetExtension(path.LocalPath).ToLower();
|
||||
var type = Providers.First(p => p.Key.Contains(ext) || p.Key.Contains("*")).Value;
|
||||
|
||||
var provider = type.CreateInstance<AnimationProvider>(path, meta);
|
||||
var provider = type.CreateInstance<AnimationProvider>(path, meta, contextObject);
|
||||
|
||||
return provider;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
//var thumbnail = instance.Meta?.GetThumbnail(true);
|
||||
//instance.Source = thumbnail;
|
||||
|
||||
instance._animation = InitAnimationProvider((Uri) ev.NewValue, instance.Meta);
|
||||
instance._animation = InitAnimationProvider((Uri) ev.NewValue, instance.Meta, instance.ContextObject);
|
||||
ShowThumbnailAndStartAnimation(instance);
|
||||
}
|
||||
|
||||
|
@@ -20,21 +20,25 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using QuickLook.Common.Plugin;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
||||
{
|
||||
internal abstract class AnimationProvider : IDisposable
|
||||
{
|
||||
protected AnimationProvider(Uri path, MetaProvider meta)
|
||||
protected AnimationProvider(Uri path, MetaProvider meta, ContextObject contextObject)
|
||||
{
|
||||
Path = path;
|
||||
Meta = meta;
|
||||
ContextObject = contextObject;
|
||||
}
|
||||
|
||||
public Uri Path { get; }
|
||||
|
||||
public MetaProvider Meta { get; }
|
||||
|
||||
public ContextObject ContextObject { get; }
|
||||
|
||||
public Int32AnimationUsingKeyFrames Animator { get; protected set; }
|
||||
|
||||
public abstract void Dispose();
|
||||
|
@@ -26,6 +26,7 @@ using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using LibAPNG;
|
||||
using QuickLook.Common.ExtensionMethods;
|
||||
using QuickLook.Common.Plugin;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
{
|
||||
@@ -37,11 +38,11 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
private int _lastEffectivePreviousPreviousFrameIndex;
|
||||
private NativeProvider _nativeImageProvider;
|
||||
|
||||
public APngProvider(Uri path, MetaProvider meta) : base(path, meta)
|
||||
public APngProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
|
||||
{
|
||||
if (!IsAnimatedPng(path.LocalPath))
|
||||
{
|
||||
_nativeImageProvider = new NativeProvider(path, meta);
|
||||
_nativeImageProvider = new NativeProvider(path, meta, contextObject);
|
||||
Animator = _nativeImageProvider.Animator;
|
||||
return;
|
||||
}
|
||||
|
@@ -16,12 +16,13 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using QuickLook.Common.Plugin;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
{
|
||||
internal class DcrawProvider : NativeProvider
|
||||
{
|
||||
public DcrawProvider(Uri path, MetaProvider meta) : base(path, meta)
|
||||
public DcrawProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using QuickLook.Common.ExtensionMethods;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
using Size = System.Windows.Size;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
@@ -33,18 +34,18 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
private bool _isPlaying;
|
||||
private NativeProvider _nativeProvider;
|
||||
|
||||
public GifProvider(Uri path, MetaProvider meta) : base(path, meta)
|
||||
public GifProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
|
||||
{
|
||||
if (!ImageAnimator.CanAnimate(Image.FromFile(path.LocalPath)))
|
||||
{
|
||||
_nativeProvider = new NativeProvider(path, meta);
|
||||
_nativeProvider = new NativeProvider(path, meta, contextObject);
|
||||
return;
|
||||
}
|
||||
|
||||
_fileHandle = (Bitmap) Image.FromFile(path.LocalPath);
|
||||
|
||||
_fileHandle.SetResolution(DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Horizontal,
|
||||
DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Vertical);
|
||||
_fileHandle.SetResolution(DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Horizontal,
|
||||
DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Vertical);
|
||||
|
||||
Animator = new Int32AnimationUsingKeyFrames {RepeatBehavior = RepeatBehavior.Forever};
|
||||
Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0))));
|
||||
|
@@ -23,14 +23,15 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ImageMagick;
|
||||
using ImageMagick.Formats.Dng;
|
||||
using ImageMagick.Formats;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
{
|
||||
internal class ImageMagickProvider : AnimationProvider
|
||||
{
|
||||
public ImageMagickProvider(Uri path, MetaProvider meta) : base(path, meta)
|
||||
public ImageMagickProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
|
||||
{
|
||||
Animator = new Int32AnimationUsingKeyFrames();
|
||||
Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0,
|
||||
@@ -80,6 +81,7 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
{
|
||||
var settings = new MagickReadSettings
|
||||
{
|
||||
BackgroundColor = MagickColors.None,
|
||||
Defines = new DngReadDefines
|
||||
{
|
||||
OutputColor = DngOutputColor.SRGB,
|
||||
@@ -92,19 +94,23 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
{
|
||||
using (var mi = new MagickImage(Path.LocalPath, settings))
|
||||
{
|
||||
var profile = mi.GetColorProfile();
|
||||
if (mi.ColorSpace == ColorSpace.RGB || mi.ColorSpace == ColorSpace.sRGB ||
|
||||
mi.ColorSpace == ColorSpace.scRGB)
|
||||
if (profile?.Description != null && !profile.Description.Contains("sRGB"))
|
||||
if (SettingHelper.Get("UseColorProfile", false, "QuickLook.Plugin.ImageViewer"))
|
||||
{
|
||||
if (mi.ColorSpace == ColorSpace.RGB || mi.ColorSpace == ColorSpace.sRGB || mi.ColorSpace == ColorSpace.scRGB)
|
||||
{
|
||||
mi.SetProfile(ColorProfile.SRGB);
|
||||
if (ContextObject.ColorProfileName != null)
|
||||
mi.SetProfile(new ColorProfile(ContextObject.ColorProfileName)); // map to monitor color
|
||||
}
|
||||
}
|
||||
|
||||
mi.AutoOrient();
|
||||
|
||||
if (mi.Width != (int) fullSize.Width || mi.Height != (int) fullSize.Height)
|
||||
mi.Resize((int) fullSize.Width, (int) fullSize.Height);
|
||||
|
||||
mi.Density = new Density(DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Horizontal,
|
||||
DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Vertical);
|
||||
mi.Density = new Density(DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Horizontal,
|
||||
DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Vertical);
|
||||
|
||||
var img = mi.ToBitmapSourceWithDensity();
|
||||
|
||||
|
@@ -22,12 +22,13 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
|
||||
{
|
||||
internal class NativeProvider : AnimationProvider
|
||||
{
|
||||
public NativeProvider(Uri path, MetaProvider meta) : base(path, meta)
|
||||
public NativeProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
|
||||
{
|
||||
Animator = new Int32AnimationUsingKeyFrames();
|
||||
Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0,
|
||||
|
@@ -30,8 +30,8 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
{
|
||||
// a dirty hack... but is the fastest
|
||||
|
||||
var newDpiX = (double) DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Horizontal;
|
||||
var newDpiY = (double) DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Vertical;
|
||||
var newDpiX = (double) DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Horizontal;
|
||||
var newDpiY = (double) DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Vertical;
|
||||
|
||||
var dpiX = img.GetType().GetField("_dpiX",
|
||||
BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
@@ -278,7 +278,7 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
{
|
||||
Theme = Theme == Themes.Dark ? Themes.Light : Themes.Dark;
|
||||
|
||||
SettingHelper.Set("LastTheme", (int) Theme);
|
||||
SettingHelper.Set("LastTheme", (int) Theme, "QuickLook.Plugin.ImageViewer");
|
||||
}
|
||||
|
||||
private void ShowMeta()
|
||||
|
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using ImageMagick;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
using QuickLook.Plugin.ImageViewer.AnimatedImage.Providers;
|
||||
@@ -27,13 +28,28 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
{
|
||||
public class Plugin : IViewer
|
||||
{
|
||||
private static readonly HashSet<string> Formats = new HashSet<string>(new[]
|
||||
private static readonly HashSet<string> WellKnownImageExtensions = new HashSet<string>(new[]
|
||||
{
|
||||
".apng", ".ari", ".arw", ".avif", ".bay", ".bmp", ".cap", ".cr2", ".cr3", ".crw", ".dcr", ".dcs", ".dng",
|
||||
".drf", ".eip", ".emf", ".erf", ".exr", ".fff", ".gif", ".hdr", ".heic", ".heif", ".ico", ".icon", ".iiq",
|
||||
".jfif", ".jpeg", ".jpg", ".k25", ".kdc", ".mdc", ".mef", ".mos", ".mrw", ".nef", ".nrw", ".obm", ".orf",
|
||||
".pbm", ".pef", ".pgm", ".png", ".pnm", ".ppm", ".psd", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rw2",
|
||||
".rwl", ".rwz", ".sr2", ".srf", ".srw", ".svg", ".tga", ".tif", ".tiff", ".wdp", ".webp", ".wmf", ".x3f"
|
||||
".apng", ".ari", ".arw", ".avif",
|
||||
".bay", ".bmp",
|
||||
".cap", ".cr2", ".cr3", ".crw",
|
||||
".dcr", ".dcs", ".dng", ".drf",
|
||||
".eip", ".emf", ".erf", ".exr",
|
||||
".fff",
|
||||
".gif",
|
||||
".hdr", ".heic", ".heif",
|
||||
".ico", ".icon", ".iiq",
|
||||
".jfif", ".jp2", ".jpeg", ".jpg", ".jxl",
|
||||
".k25", ".kdc",
|
||||
".mdc", ".mef", ".mos", ".mrw",
|
||||
".nef", ".nrw",
|
||||
".obm", ".orf",
|
||||
".pbm", ".pef", ".pgm", ".png", ".pnm", ".ppm", ".psd", ".ptx", ".pxn",
|
||||
".r3d", ".raf", ".raw", ".rw2", ".rwl", ".rwz",
|
||||
".sr2", ".srf", ".srw", ".svg",
|
||||
".tga", ".tif", ".tiff",
|
||||
".wdp", ".webp", ".wmf",
|
||||
".x3f", ".xcf"
|
||||
});
|
||||
|
||||
private ImagePanel _ip;
|
||||
@@ -43,23 +59,47 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
|
||||
public void Init()
|
||||
{
|
||||
var useColorProfile = SettingHelper.Get("UseColorProfile", false, "QuickLook.Plugin.ImageViewer");
|
||||
|
||||
AnimatedImage.AnimatedImage.Providers.Add(
|
||||
new KeyValuePair<string[], Type>(new[] {".apng", ".png"},
|
||||
new KeyValuePair<string[], Type>(
|
||||
useColorProfile ? new[] { ".apng" } : new[] { ".apng", ".png" },
|
||||
typeof(APngProvider)));
|
||||
AnimatedImage.AnimatedImage.Providers.Add(
|
||||
new KeyValuePair<string[], Type>(new[] {".gif"},
|
||||
typeof(GifProvider)));
|
||||
AnimatedImage.AnimatedImage.Providers.Add(
|
||||
new KeyValuePair<string[], Type>(new[] {".bmp", ".jpg", ".jpeg", ".jfif", ".tif", ".tiff"},
|
||||
new KeyValuePair<string[], Type>(
|
||||
useColorProfile ? new string[0] : new[] { ".bmp", ".jpg", ".jpeg", ".jfif", ".tif", ".tiff" },
|
||||
typeof(NativeProvider)));
|
||||
AnimatedImage.AnimatedImage.Providers.Add(
|
||||
new KeyValuePair<string[], Type>(new[] {"*"},
|
||||
typeof(ImageMagickProvider)));
|
||||
}
|
||||
|
||||
private bool IsWellKnownImageExtension(string path)
|
||||
{
|
||||
return WellKnownImageExtensions.Contains(Path.GetExtension(path.ToLower()));
|
||||
}
|
||||
|
||||
private bool IsImageMagickSupported(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MagickImageInfo(path).Format != MagickFormat.Unknown;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
return !Directory.Exists(path) && Formats.Contains(Path.GetExtension(path.ToLower()));
|
||||
// Disabled due mishandling text file types e.g., "*.config".
|
||||
// Only check extension for well known image and animated image types.
|
||||
// For other image formats, let ImageMagick try to detect by file content.
|
||||
return !Directory.Exists(path) && (IsWellKnownImageExtension(path)); // || IsImageMagickSupported(path));
|
||||
}
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
@@ -73,7 +113,7 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
else
|
||||
context.PreferredSize = new Size(800, 600);
|
||||
|
||||
context.Theme = (Themes) SettingHelper.Get("LastTheme", 1);
|
||||
context.Theme = (Themes) SettingHelper.Get("LastTheme", 1, "QuickLook.Plugin.ImageViewer");
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
|
@@ -62,14 +62,14 @@
|
||||
<Reference Include="LibAPNG">
|
||||
<HintPath>.\LibAPNG.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Magick.NET-Q8-AnyCPU, Version=7.20.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Magick.NET-Q8-AnyCPU.7.20.0.1\lib\net40\Magick.NET-Q8-AnyCPU.dll</HintPath>
|
||||
<Reference Include="Magick.NET-Q8-AnyCPU, Version=8.4.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Magick.NET-Q8-AnyCPU.8.4.0\lib\net20\Magick.NET-Q8-AnyCPU.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Magick.NET.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Magick.NET.Core.3.0.0\lib\net40\Magick.NET.Core.dll</HintPath>
|
||||
<Reference Include="Magick.NET.Core, Version=8.4.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Magick.NET.Core.8.4.0\lib\net20\Magick.NET.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Magick.NET.SystemWindowsMedia, Version=1.0.2.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Magick.NET.SystemWindowsMedia.1.0.2\lib\net40\Magick.NET.SystemWindowsMedia.dll</HintPath>
|
||||
<Reference Include="Magick.NET.SystemWindowsMedia, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Magick.NET.SystemWindowsMedia.4.0.9\lib\net40\Magick.NET.SystemWindowsMedia.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Magick.NET.Core" version="3.0.0" targetFramework="net462" />
|
||||
<package id="Magick.NET.SystemWindowsMedia" version="1.0.2" targetFramework="net462" />
|
||||
<package id="Magick.NET-Q8-AnyCPU" version="7.20.0.1" targetFramework="net462" />
|
||||
<package id="Magick.NET.Core" version="8.4.0" targetFramework="net462" />
|
||||
<package id="Magick.NET.SystemWindowsMedia" version="4.0.9" targetFramework="net462" />
|
||||
<package id="Magick.NET-Q8-AnyCPU" version="8.4.0" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
</packages>
|
@@ -63,7 +63,7 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="UtfUnknown, Version=2.0.0.0, Culture=neutral, PublicKeyToken=90217ce7a23260d4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\UTF.Unknown.2.3.0\lib\net40\UtfUnknown.dll</HintPath>
|
||||
<HintPath>..\..\packages\UTF.Unknown.2.5.0\lib\net40\UtfUnknown.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="UTF.Unknown" version="2.3.0" targetFramework="net462" />
|
||||
<package id="UTF.Unknown" version="2.5.0" targetFramework="net462" />
|
||||
</packages>
|
@@ -49,9 +49,9 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
|
||||
public static BitmapSource Render(this PdfDocumentWrapper doc, int page, double factor, bool fixDpi = true)
|
||||
{
|
||||
var scale = DpiHelper.GetCurrentScaleFactor();
|
||||
var dpiX = fixDpi ? scale.Horizontal * DpiHelper.DefaultDpi : 96;
|
||||
var dpiY = fixDpi ? scale.Vertical * DpiHelper.DefaultDpi : 96;
|
||||
var scale = DisplayDeviceHelper.GetCurrentScaleFactor();
|
||||
var dpiX = fixDpi ? scale.Horizontal * DisplayDeviceHelper.DefaultDpi : 96;
|
||||
var dpiY = fixDpi ? scale.Vertical * DisplayDeviceHelper.DefaultDpi : 96;
|
||||
|
||||
Bitmap bitmap;
|
||||
|
||||
|
@@ -65,8 +65,8 @@
|
||||
</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PdfiumViewer, Version=2.14.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\PdfiumViewer.Updated.2.14.0\lib\net45\PdfiumViewer.dll</HintPath>
|
||||
<Reference Include="PdfiumViewer, Version=2.14.2.0, Culture=neutral, PublicKeyToken=97c6f28bf5a3df6e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\PdfiumViewer.Updated.2.14.2\lib\net45\PdfiumViewer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
|
@@ -2,5 +2,5 @@
|
||||
<packages>
|
||||
<package id="PDFium.x64.v8-xfa" version="4194.0.0" targetFramework="net462" />
|
||||
<package id="PDFium.x86.v8-xfa" version="4194.0.0" targetFramework="net462" />
|
||||
<package id="PdfiumViewer.Updated" version="2.14.0" targetFramework="net462" />
|
||||
<package id="PdfiumViewer.Updated" version="2.14.2" targetFramework="net462" />
|
||||
</packages>
|
@@ -16,14 +16,17 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Xml;
|
||||
using ICSharpCode.AvalonEdit;
|
||||
using ICSharpCode.AvalonEdit.Highlighting;
|
||||
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
|
||||
namespace QuickLook.Plugin.TextViewer
|
||||
@@ -32,33 +35,18 @@ namespace QuickLook.Plugin.TextViewer
|
||||
{
|
||||
private TextViewerPanel _tvp;
|
||||
|
||||
private static HighlightingManager _hlmLight;
|
||||
private static HighlightingManager _hlmDark;
|
||||
|
||||
public int Priority => -5;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
var hlm = HighlightingManager.Instance;
|
||||
|
||||
var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
if (string.IsNullOrEmpty(assemblyPath)) return;
|
||||
|
||||
var syntaxPath = Path.Combine(assemblyPath, "Syntax");
|
||||
if (!Directory.Exists(syntaxPath)) return;
|
||||
|
||||
foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd"))
|
||||
{
|
||||
var ext = Path.GetFileNameWithoutExtension(file);
|
||||
using (Stream s = File.OpenRead(Path.GetFullPath(file)))
|
||||
using (var reader = new XmlTextReader(s))
|
||||
{
|
||||
var xshd = HighlightingLoader.LoadXshd(reader);
|
||||
var highlightingDefinition = HighlightingLoader.Load(xshd, hlm);
|
||||
if (xshd.Extensions.Count > 0)
|
||||
hlm.RegisterHighlighting(ext, xshd.Extensions.ToArray(), highlightingDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
// pre-load
|
||||
var _ = new TextEditor();
|
||||
|
||||
_hlmLight = getHighlightingManager(Themes.Light, "Light");
|
||||
_hlmDark = getHighlightingManager(Themes.Dark, "Dark");
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
@@ -66,7 +54,7 @@ namespace QuickLook.Plugin.TextViewer
|
||||
if (Directory.Exists(path))
|
||||
return false;
|
||||
|
||||
if (path.ToLower().EndsWith(".txt"))
|
||||
if (new[] { ".txt", ".rtf" }.Any(path.ToLower().EndsWith))
|
||||
return true;
|
||||
|
||||
// if there is a matched highlighting scheme (by file extension), treat it as a plain text file
|
||||
@@ -86,16 +74,30 @@ namespace QuickLook.Plugin.TextViewer
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
//context.Theme = Themes.Light;
|
||||
|
||||
context.PreferredSize = new Size {Width = 800, Height = 600};
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
{
|
||||
_tvp = new TextViewerPanel(path, context);
|
||||
if (path.ToLower().EndsWith(".rtf"))
|
||||
{
|
||||
var rtfBox = new RichTextBox();
|
||||
FileStream fs = File.OpenRead(path);
|
||||
rtfBox.Selection.Load(fs, DataFormats.Rtf);
|
||||
rtfBox.IsReadOnly = true;
|
||||
rtfBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||
rtfBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||
|
||||
context.ViewerContent = _tvp;
|
||||
context.ViewerContent = rtfBox;
|
||||
context.IsBusy = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tvp = new TextViewerPanel(path, context);
|
||||
AssignHighlightingManager(_tvp, context);
|
||||
|
||||
context.ViewerContent = _tvp;
|
||||
}
|
||||
context.Title = $"{Path.GetFileName(path)}";
|
||||
}
|
||||
|
||||
@@ -113,5 +115,40 @@ namespace QuickLook.Plugin.TextViewer
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private HighlightingManager getHighlightingManager(Themes theme, string dirName)
|
||||
{
|
||||
var hlm = new HighlightingManager();
|
||||
|
||||
var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
if (string.IsNullOrEmpty(assemblyPath))
|
||||
return hlm;
|
||||
|
||||
var syntaxPath = Path.Combine(assemblyPath, "Syntax", dirName);
|
||||
if (!Directory.Exists(syntaxPath))
|
||||
return hlm;
|
||||
|
||||
foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd").OrderBy(f => f))
|
||||
{
|
||||
Debug.WriteLine(file);
|
||||
var ext = Path.GetFileNameWithoutExtension(file);
|
||||
using (Stream s = File.OpenRead(Path.GetFullPath(file)))
|
||||
using (var reader = new XmlTextReader(s))
|
||||
{
|
||||
var xshd = HighlightingLoader.LoadXshd(reader);
|
||||
var highlightingDefinition = HighlightingLoader.Load(xshd, hlm);
|
||||
if (xshd.Extensions.Count > 0)
|
||||
hlm.RegisterHighlighting(ext, xshd.Extensions.ToArray(), highlightingDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
return hlm;
|
||||
}
|
||||
private void AssignHighlightingManager(TextViewerPanel tvp, ContextObject context)
|
||||
{
|
||||
var darkThemeAllowed = SettingHelper.Get("AllowDarkTheme", false, "QuickLook.Plugin.TextViewer");
|
||||
var isDark = darkThemeAllowed && OSThemeHelper.AppsUseDarkTheme();
|
||||
tvp.HighlightingManager = isDark ? _hlmDark : _hlmLight;
|
||||
}
|
||||
}
|
||||
}
|
@@ -57,8 +57,8 @@
|
||||
</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.AvalonEdit, Version=6.0.1.278, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\AvalonEdit.6.0.1\lib\net45\ICSharpCode.AvalonEdit.dll</HintPath>
|
||||
<Reference Include="ICSharpCode.AvalonEdit, Version=6.1.3.50, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\AvalonEdit.6.1.3.50\lib\net45\ICSharpCode.AvalonEdit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
@@ -68,7 +68,7 @@
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UtfUnknown, Version=2.0.0.0, Culture=neutral, PublicKeyToken=90217ce7a23260d4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\UTF.Unknown.2.3.0\lib\net40\UtfUnknown.dll</HintPath>
|
||||
<HintPath>..\..\packages\UTF.Unknown.2.5.0\lib\net40\UtfUnknown.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
@@ -91,6 +91,7 @@
|
||||
<Content Include="Syntax\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Translations.config">
|
||||
<SubType>Designer</SubType>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user