mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-14 12:19:08 +00:00
Add Sketch file support to ThumbnailViewer plugin
This commit is contained in:
@@ -74,6 +74,20 @@ internal static class Handler
|
|||||||
context.PreferredSize = new Size { Width = 100, Height = 100 };
|
context.PreferredSize = new Size { Width = 100, Height = 100 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (path.EndsWith(".sketch", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using Stream imageData = ViewImage(path);
|
||||||
|
BitmapImage bitmap = imageData.ReadAsBitmapImage();
|
||||||
|
context.SetPreferredSizeFit(new Size(bitmap.PixelWidth, bitmap.PixelHeight), 0.8d);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_ = e;
|
||||||
|
context.PreferredSize = new Size { Width = 100, Height = 100 };
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (path.EndsWith(".xmind", StringComparison.OrdinalIgnoreCase))
|
else if (path.EndsWith(".xmind", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -195,6 +209,22 @@ internal static class Handler
|
|||||||
StreamResourceInfo info = Application.GetResourceStream(new Uri("pack://application:,,,/QuickLook.Plugin.ThumbnailViewer;component/Resources/broken.png"));
|
StreamResourceInfo info = Application.GetResourceStream(new Uri("pack://application:,,,/QuickLook.Plugin.ThumbnailViewer;component/Resources/broken.png"));
|
||||||
return info?.Stream;
|
return info?.Stream;
|
||||||
}
|
}
|
||||||
|
else if (path.EndsWith(".sketch", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
using ZipArchive archive = ZipArchive.Open(path, new());
|
||||||
|
using IReader reader = archive.ExtractAllEntries();
|
||||||
|
|
||||||
|
while (reader.MoveToNextEntry())
|
||||||
|
{
|
||||||
|
if (reader.Entry.Key!.EndsWith("previews/preview.png", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
MemoryStream ms = new();
|
||||||
|
using EntryStream stream = reader.OpenEntryStream();
|
||||||
|
stream.CopyTo(ms);
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (path.EndsWith(".xmind", StringComparison.OrdinalIgnoreCase))
|
else if (path.EndsWith(".xmind", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
using ZipArchive archive = ZipArchive.Open(path, new());
|
using ZipArchive archive = ZipArchive.Open(path, new());
|
||||||
|
@@ -34,6 +34,7 @@ public class Plugin : IViewer
|
|||||||
".fig", // Figma
|
".fig", // Figma
|
||||||
".kra", // Krita
|
".kra", // Krita
|
||||||
".pip", ".pix", // Pixso
|
".pip", ".pix", // Pixso
|
||||||
|
".sketch", // Sketch
|
||||||
".xd", // AdobeXD
|
".xd", // AdobeXD
|
||||||
".xmind", // XMind
|
".xmind", // XMind
|
||||||
]);
|
]);
|
||||||
|
Reference in New Issue
Block a user