From 0a3d62a27b6161c1ac52d30fb3ff5c99da7200ae Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Mon, 3 Sep 2018 17:11:25 -0500 Subject: [PATCH] Shrunk distrobution more by not needing Cecil in the root directory --- IPA/IPA.csproj | 2 +- IPA/Program.cs | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/IPA/IPA.csproj b/IPA/IPA.csproj index 8bdc6b60..61f5536f 100644 --- a/IPA/IPA.csproj +++ b/IPA/IPA.csproj @@ -118,7 +118,7 @@ - + diff --git a/IPA/Program.cs b/IPA/Program.cs index b6ae36a2..9a7befc1 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -60,7 +60,23 @@ namespace IPA catch (Exception) { } } - PatchContext context; + PatchContext context = null; + + Assembly AssemblyLibLoader(object source, ResolveEventArgs e) + { + var libsDir = context.LibsPathSrc; + + var asmName = new AssemblyName(e.Name); + var testFilen = Path.Combine(libsDir, $"{asmName.Name}.{asmName.Version}.dll"); + + if (File.Exists(testFilen)) + return Assembly.LoadFile(testFilen); + + Console.WriteLine($"Could not load library {asmName}"); + + return null; + } + AppDomain.CurrentDomain.AssemblyResolve += AssemblyLibLoader; var argExeName = Arguments.CmdLine.PositionalArgs.FirstOrDefault(s => s.EndsWith(".exe")); if (argExeName == null)