mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
## Bug fixes - Addresses the issue where WindowsSettings plugin results appear higher than other results #1020 - Fixed an issue where full screen mode does not disable hotkey when enabled #1037 - Fixed some potential issues when loading plugins that use shared assembly #1036 - Sorted out a race condition issue causing image loading on some results to fail #1040 - Revised ttf/otf support #935 - Resolved the issue where WebSearch plugin would crash if not connected to internet #977 - Fixed incorrect text for "New Tab" and "New Window" buttons under Settings' default browser section #951 - Fixed typos in plugin title and WindowsSettings name inside the context menu #1056
47 lines
No EOL
1.8 KiB
C#
47 lines
No EOL
1.8 KiB
C#
using Flow.Launcher.Infrastructure;
|
|
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Runtime.Loader;
|
|
|
|
namespace Flow.Launcher.Core.Plugin
|
|
{
|
|
internal class PluginAssemblyLoader : AssemblyLoadContext
|
|
{
|
|
private readonly AssemblyDependencyResolver dependencyResolver;
|
|
|
|
private readonly AssemblyName assemblyName;
|
|
|
|
internal PluginAssemblyLoader(string assemblyFilePath)
|
|
{
|
|
dependencyResolver = new AssemblyDependencyResolver(assemblyFilePath);
|
|
assemblyName = new AssemblyName(Path.GetFileNameWithoutExtension(assemblyFilePath));
|
|
}
|
|
|
|
internal Assembly LoadAssemblyAndDependencies()
|
|
{
|
|
return LoadFromAssemblyName(assemblyName);
|
|
}
|
|
|
|
protected override Assembly Load(AssemblyName assemblyName)
|
|
{
|
|
string assemblyPath = dependencyResolver.ResolveAssemblyToPath(assemblyName);
|
|
|
|
// When resolving dependencies, ignore assembly depenedencies that already exits with Flow.Launcher
|
|
// Otherwise duplicate assembly will be loaded and some weird behavior will occur, such as WinRT.Runtime.dll
|
|
// will fail due to loading multiple versions in process, each with their own static instance of registration state
|
|
var existAssembly = Default.Assemblies.FirstOrDefault(x => x.FullName == assemblyName.FullName);
|
|
|
|
return existAssembly ?? (assemblyPath == null ? null : LoadFromAssemblyPath(assemblyPath));
|
|
}
|
|
|
|
internal Type FromAssemblyGetTypeOfInterface(Assembly assembly, Type type)
|
|
{
|
|
var allTypes = assembly.ExportedTypes;
|
|
return allTypes.First(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Any(t => t == type));
|
|
}
|
|
}
|
|
} |