Merge InvokePluginPreview from emako/QuickLook

This commit is contained in:
ema
2024-12-13 15:35:15 +08:00
parent a82a93d2d9
commit 302aad41ea

View File

@@ -140,6 +140,30 @@ internal class ViewWindowManager : IDisposable
BeginShowNewWindow(path, matchedPlugin);
}
public void InvokePluginPreview(string plugin, string path = null)
{
if (string.IsNullOrEmpty(path))
path = _invokedPath;
if (string.IsNullOrEmpty(path))
return;
if (!Directory.Exists(path) && !File.Exists(path))
return;
RunFocusMonitor();
var matchedPlugin = PluginManager.GetInstance().LoadedPlugins.Find(p =>
{
return p.GetType().Assembly.GetName().Name == plugin;
});
if (matchedPlugin != null)
{
BeginShowNewWindow(path, matchedPlugin);
}
}
private void BeginShowNewWindow(string path, IViewer matchedPlugin)
{
_viewerWindow.UnloadPlugin();