diff --git a/TShockLauncher/Program.cs b/TShockLauncher/Program.cs index 4a139370..84ddedc1 100644 --- a/TShockLauncher/Program.cs +++ b/TShockLauncher/Program.cs @@ -27,22 +27,12 @@ along with this program. If not, see . */ using System.Reflection; -using TShockPluginManager; - -if (args.Length > 0 && args[0].ToLower() == "plugins") -{ - var items = args.ToList(); - items.RemoveAt(0); - await NugetCLI.Main(items); - return; -} - Dictionary _cache = new Dictionary(); System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += Default_Resolving; -Start(); +await StartAsync(); /// /// Resolves a module from the ./bin folder, either with a .dll by preference or .exe @@ -53,6 +43,7 @@ Assembly? Default_Resolving(System.Runtime.Loader.AssemblyLoadContext arg1, Asse if (_cache.TryGetValue(arg2.Name, out Assembly? asm) && asm is not null) return asm; var loc = Path.Combine(AppContext.BaseDirectory, "bin", arg2.Name + ".dll"); + if (File.Exists(loc)) asm = arg1.LoadFromAssemblyPath(loc); @@ -70,7 +61,15 @@ Assembly? Default_Resolving(System.Runtime.Loader.AssemblyLoadContext arg1, Asse /// Initiates the TSAPI server. /// /// This method exists so that the resolver can attach before TSAPI needs its dependencies. -void Start() +async Task StartAsync() { + if (args.Length > 0 && args[0].ToLower() == "plugins") + { + var items = args.ToList(); + items.RemoveAt(0); + await TShockPluginManager.NugetCLI.Main(items); + return; + } + TerrariaApi.Server.Program.Main(args); } diff --git a/TShockLauncher/TShockLauncher.csproj b/TShockLauncher/TShockLauncher.csproj index 80cd8bd5..0e1c5b76 100644 --- a/TShockLauncher/TShockLauncher.csproj +++ b/TShockLauncher/TShockLauncher.csproj @@ -91,7 +91,13 @@ - + + + + + + +