mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 10:19:07 +00:00
Allow plugin initialization when application starts
This commit is contained in:
@@ -11,6 +11,10 @@ namespace QuickLook.Plugin.ArchiveViewer
|
||||
public int Priority => 0;
|
||||
public bool AllowsTransparency => true;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -12,6 +12,11 @@ namespace QuickLook.Plugin.HtmlViewer
|
||||
public int Priority => int.MaxValue;
|
||||
public bool AllowsTransparency => false;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
Helper.SetBrowserFeatureControl();
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -14,8 +14,6 @@ namespace QuickLook.Plugin.HtmlViewer
|
||||
public WebpagePanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Helper.SetBrowserFeatureControl();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@@ -11,6 +11,10 @@ namespace QuickLook.Plugin.IPreviewHandlers
|
||||
public int Priority => int.MaxValue;
|
||||
public bool AllowsTransparency => false;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using ImageMagick;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer
|
||||
{
|
||||
@@ -23,6 +24,11 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
public int Priority => int.MaxValue;
|
||||
public bool AllowsTransparency => true;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
new MagickImage().Dispose();
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -13,6 +13,10 @@ namespace QuickLook.Plugin.MarkdownViewer
|
||||
public int Priority => int.MaxValue;
|
||||
public bool AllowsTransparency => false;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -12,6 +12,10 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
public int Priority => int.MaxValue;
|
||||
public bool AllowsTransparency => true;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -11,6 +11,10 @@ namespace QuickLook.Plugin.TextViewer
|
||||
public int Priority => 0;
|
||||
public bool AllowsTransparency => true;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -13,6 +13,11 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
public int Priority => int.MaxValue;
|
||||
public bool AllowsTransparency => true;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
MediaElement.FFmpegPaths.RegisterFFmpeg();
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
|
@@ -16,6 +16,11 @@
|
||||
/// </summary>
|
||||
bool AllowsTransparency { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Do ont-time job when application starts. You may extract nessessary resource here.
|
||||
/// </summary>
|
||||
void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether this plugin can open this file. Please also check the file header, if applicable.
|
||||
/// </summary>
|
||||
|
@@ -9,6 +9,10 @@ namespace QuickLook.Plugin.InfoPanel
|
||||
public int Priority => int.MinValue;
|
||||
public bool AllowsTransparency => true;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public bool CanHandle(string sample)
|
||||
{
|
||||
return true;
|
||||
|
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using QuickLook.ExtensionMethods;
|
||||
using QuickLook.Plugin;
|
||||
using QuickLook.Plugin.InfoPanel;
|
||||
@@ -66,6 +68,18 @@ namespace QuickLook
|
||||
});
|
||||
|
||||
LoadedPlugins = LoadedPlugins.OrderByDescending(i => i.Priority).ToList();
|
||||
|
||||
LoadedPlugins.ForEach(i =>
|
||||
{
|
||||
try
|
||||
{
|
||||
i.Init();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user