@@ -16,13 +16,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
16
You should have received a copy of the GNU General Public License
17
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
*/
19
+ using Mono . Cecil ;
20
+ using Mono . Cecil . Cil ;
19
21
using System ;
20
22
using System . Collections . Generic ;
21
23
using System . IO ;
22
24
using System . Linq ;
23
25
using System . Runtime . InteropServices ;
24
- using Mono . Cecil ;
25
- using Mono . Cecil . Cil ;
26
26
27
27
namespace OTAPI . Patcher . Targets ;
28
28
@@ -47,7 +47,7 @@ public static IPatchTarget DeterminePatchTarget()
47
47
if ( ! String . IsNullOrWhiteSpace ( cli ) && _targets . TryGetValue ( cli [ 0 ] , out IPatchTarget ? match ) )
48
48
return match ;
49
49
50
- if ( Console . IsInputRedirected )
50
+ if ( Console . IsInputRedirected )
51
51
return new PCServerTarget ( ) ;
52
52
53
53
int attempts = 5 ;
@@ -82,7 +82,8 @@ public static IPatchTarget DeterminePatchTarget()
82
82
/// </summary>
83
83
public static void PatchMonoMod ( )
84
84
{
85
- var bin = File . ReadAllBytes ( "MonoMod.dll" ) ;
85
+ var dllPath = Path . Combine ( AppContext . BaseDirectory , "MonoMod.dll" ) ;
86
+ var bin = File . ReadAllBytes ( dllPath ) ;
86
87
using MemoryStream ms = new ( bin ) ;
87
88
var asm = AssemblyDefinition . ReadAssembly ( ms ) ;
88
89
var modder = asm . MainModule . Types . Single ( x => x . FullName == "MonoMod.MonoModder" ) ;
@@ -114,7 +115,7 @@ public static void PatchMonoMod()
114
115
OpCodes . Ldc_I4 , RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? 37 : 0
115
116
) ) ;
116
117
117
- asm . Write ( "MonoMod.dll" ) ;
118
+ asm . Write ( dllPath ) ;
118
119
}
119
120
}
120
121
}
0 commit comments