mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-13 02:49:06 +00:00
Use own Pdf viewer implementation. wip on universal InfoPanel
This commit is contained in:
@@ -11,18 +11,27 @@ namespace QuickLook
|
||||
{
|
||||
private static PluginManager _instance;
|
||||
|
||||
internal PluginManager()
|
||||
private PluginManager()
|
||||
{
|
||||
LoadPlugins();
|
||||
}
|
||||
|
||||
internal List<IViewer> LoadedPlugins { get; } = new List<IViewer>();
|
||||
internal List<IViewer> LoadedPlugins { get; private set; } = new List<IViewer>();
|
||||
|
||||
internal static PluginManager GetInstance()
|
||||
{
|
||||
return _instance ?? (_instance = new PluginManager());
|
||||
}
|
||||
|
||||
internal static IViewer FindMatch(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return null;
|
||||
|
||||
return GetInstance()
|
||||
.LoadedPlugins.FirstOrDefault(plugin => plugin.CanHandle(path));
|
||||
}
|
||||
|
||||
private void LoadPlugins()
|
||||
{
|
||||
Directory.GetFiles(Path.Combine(App.AppPath, "Plugins\\"), "QuickLook.Plugin.*.dll",
|
||||
@@ -37,6 +46,8 @@ namespace QuickLook
|
||||
select t).ToList()
|
||||
.ForEach(type => LoadedPlugins.Add((IViewer) Activator.CreateInstance(type)));
|
||||
});
|
||||
|
||||
LoadedPlugins = LoadedPlugins.OrderByDescending(i => i.Priority).ToList();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user