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