From 0e6d22d40a12aff2bdb3a10aca8b2ecf0e9b1682 Mon Sep 17 00:00:00 2001 From: DarkLotus Date: Sat, 20 Apr 2019 15:41:16 +1000 Subject: [PATCH] Fix build --- CEasyUO.csproj | 41 ++++++++++++++++++++++++++++++++++------- Engine.cs | 19 ++++++++++++++++++- 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/CEasyUO.csproj b/CEasyUO.csproj index 9c0c1c0..38b009c 100644 --- a/CEasyUO.csproj +++ b/CEasyUO.csproj @@ -42,9 +42,6 @@ False .\cuoapi.dll - - C:\Users\James\Documents\Visual Studio 2017\Projects\EasyLoA\EasyAntlr\bin\Debug\EasyAntlr.exe - @@ -56,10 +53,6 @@ - - False - .\Ultima.dll - @@ -70,6 +63,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component diff --git a/Engine.cs b/Engine.cs index 2f822a7..798ef31 100644 --- a/Engine.cs +++ b/Engine.cs @@ -31,7 +31,7 @@ public Engine() public static bool UsePostKRPackets => ClientVersion >= ClientVersions.CV_6017; private static string _rootPath = null; - public static string RootPath => _rootPath ?? ( _rootPath = Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location ) ); + public static string RootPath => _rootPath ?? ( _rootPath = Path.GetDirectoryName( Assembly.GetAssembly( typeof( Engine ) ).Location ) ); public static string UOFilePath { get; internal set; } public static bool IsInstalled { get; internal set; } public static CEasyUOMainForm m_MainForm; @@ -39,6 +39,23 @@ public Engine() public static unsafe void Install( PluginHeader* header ) { Console.WriteLine( "Install Invoked CEasyUO" ); + AppDomain.CurrentDomain.AssemblyResolve += ( sender, e ) => + { + string[] fields = e.Name.Split( ',' ); + string name = fields[0]; + string culture = fields[2]; + + if ( name.EndsWith( ".resources" ) && !culture.EndsWith( "neutral" ) ) + { + return null; + } + AssemblyName askedassembly = new AssemblyName( e.Name ); + + bool isdll = File.Exists( Path.Combine( RootPath, askedassembly.Name + ".dll" ) ); + + return Assembly.LoadFile( Path.Combine( RootPath, askedassembly.Name + ( isdll ? ".dll" : ".exe" ) ) ); + + }; try { ClientVersion = (ClientVersions)header->ClientVersion;