Skip to content

Commit

Permalink
Merge InvokePluginPreview from emako/QuickLook
Browse files Browse the repository at this point in the history
  • Loading branch information
emako committed Dec 13, 2024
1 parent a82a93d commit 302aad4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions QuickLook/ViewWindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,30 @@ public void InvokePreview(string path = null)
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();
Expand Down

0 comments on commit 302aad4

Please sign in to comment.