@@ -16,13 +16,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1616You should have received a copy of the GNU General Public License
1717along with this program. If not, see <http://www.gnu.org/licenses/>.
1818*/
19+ using Mono . Cecil ;
20+ using Mono . Cecil . Cil ;
1921using System ;
2022using System . Collections . Generic ;
2123using System . IO ;
2224using System . Linq ;
2325using System . Runtime . InteropServices ;
24- using Mono . Cecil ;
25- using Mono . Cecil . Cil ;
2626
2727namespace OTAPI . Patcher . Targets ;
2828
@@ -47,7 +47,7 @@ public static IPatchTarget DeterminePatchTarget()
4747 if ( ! String . IsNullOrWhiteSpace ( cli ) && _targets . TryGetValue ( cli [ 0 ] , out IPatchTarget ? match ) )
4848 return match ;
4949
50- if ( Console . IsInputRedirected )
50+ if ( Console . IsInputRedirected )
5151 return new PCServerTarget ( ) ;
5252
5353 int attempts = 5 ;
@@ -82,7 +82,8 @@ public static IPatchTarget DeterminePatchTarget()
8282 /// </summary>
8383 public static void PatchMonoMod ( )
8484 {
85- var bin = File . ReadAllBytes ( "MonoMod.dll" ) ;
85+ var dllPath = Path . Combine ( AppContext . BaseDirectory , "MonoMod.dll" ) ;
86+ var bin = File . ReadAllBytes ( dllPath ) ;
8687 using MemoryStream ms = new ( bin ) ;
8788 var asm = AssemblyDefinition . ReadAssembly ( ms ) ;
8889 var modder = asm . MainModule . Types . Single ( x => x . FullName == "MonoMod.MonoModder" ) ;
@@ -114,7 +115,7 @@ public static void PatchMonoMod()
114115 OpCodes . Ldc_I4 , RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? 37 : 0
115116 ) ) ;
116117
117- asm . Write ( "MonoMod.dll" ) ;
118+ asm . Write ( dllPath ) ;
118119 }
119120 }
120121}
0 commit comments