Support .pdn in ThumbnailViewer #1708
Some checks failed
MSBuild / build (push) Has been cancelled
MSBuild / publish (push) Has been cancelled

Implementation still under adjustment.
This commit is contained in:
ema
2025-08-02 02:31:05 +08:00
parent 9fe37520d3
commit 5cedcff912
4 changed files with 113 additions and 104 deletions

View File

@@ -21,6 +21,7 @@ using PureSharpCompress.Readers;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows;
@@ -30,8 +31,18 @@ namespace QuickLook.Plugin.ThumbnailViewer;
internal static class Handler
{
// List<Pair<formats, type>>
public static List<KeyValuePair<string[], Type>> Providers = [];
public static void Prepare(string path, ContextObject context)
{
// Temporary codes
if (path.EndsWith(".pdn", StringComparison.OrdinalIgnoreCase))
{
new PdnProvider().Prepare(path, context);
return;
}
try
{
using Stream imageData = ViewImage(path);
@@ -47,6 +58,12 @@ internal static class Handler
public static Stream ViewImage(string path)
{
// Temporary codes
if (path.EndsWith(".pdn", StringComparison.OrdinalIgnoreCase))
{
return new PdnProvider().ViewImage(path);
}
try
{
using ZipArchive archive = ZipArchive.Open(path, new());