Files
se-launcher/CringePlugins/Loader/LocalLoadContext.cs
pas2704 60b8a94ab2
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (NuGet) (push) Successful in 4m35s
Build / Build Nuget package (SharedCringe) (push) Successful in 4m44s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 4m51s
Build / Build Nuget package (CringePlugins) (push) Successful in 5m11s
Build / Build Launcher (push) Successful in 6m16s
Support reloading local plugins
Added drag and drop functionality to sources
2025-06-07 11:54:12 -04:00

17 lines
682 B
C#

using CringeBootstrap.Abstractions;
using System.Reflection;
namespace CringePlugins.Loader;
internal class LocalLoadContext(ICoreLoadContext parentContext, string entrypointPath) : PluginAssemblyLoadContext(parentContext, entrypointPath)
{
//use MemoryStream so the file can be written over, and check for .pdb
protected override Assembly LoadAssemblyFile(string path)
{
var pdbFile = Path.ChangeExtension(path, ".pdb");
return File.Exists(pdbFile)
? LoadFromStream(new MemoryStream(File.ReadAllBytes(path)), new MemoryStream(File.ReadAllBytes(pdbFile)))
: LoadFromStream(new MemoryStream(File.ReadAllBytes(path)));
}
}