36 lines
967 B
C#
36 lines
967 B
C#
using System.Diagnostics;
|
|
using System.Reflection;
|
|
using System.Runtime.Loader;
|
|
using CringeBootstrap;
|
|
using CringeBootstrap.Abstractions;
|
|
using Velopack;
|
|
|
|
#if DEBUG
|
|
while (!Debugger.IsAttached)
|
|
Thread.Sleep(100);
|
|
#endif
|
|
|
|
VelopackApp.Build().Run();
|
|
|
|
#if DEBUG
|
|
AssemblyLoadContext.Default.Resolving += (loadContext, name) =>
|
|
{
|
|
Debug.WriteLine($"resolving {name} in {loadContext}");
|
|
return null;
|
|
};
|
|
#endif
|
|
|
|
var dir = Path.GetDirectoryName(args[0])!;
|
|
var context = new GameDirectoryAssemblyLoadContext(dir);
|
|
|
|
// a list of assemblies which are not in the game binaries but reference them
|
|
context.AddDependencyOverride("CringeLauncher");
|
|
context.AddDependencyOverride("PluginLoader");
|
|
context.AddDependencyOverride("CringePlugins");
|
|
|
|
var launcher = context.LoadFromAssemblyName(new AssemblyName("CringeLauncher"));
|
|
|
|
using var corePlugin = (ICorePlugin) launcher.CreateInstance("CringeLauncher.Launcher")!;
|
|
|
|
corePlugin.Initialize(args);
|
|
corePlugin.Run(); |