From 6f535ec09571e363990e3a049c3b524d5b50fbad Mon Sep 17 00:00:00 2001 From: Stefanos A Date: Sat, 30 Nov 2013 02:32:10 +0100 Subject: [PATCH] Load system types from referenced mscorlib --- Source/OpenTK.Rewrite/Program.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/OpenTK.Rewrite/Program.cs b/Source/OpenTK.Rewrite/Program.cs index d4d7b7eb..0b5b8cbe 100644 --- a/Source/OpenTK.Rewrite/Program.cs +++ b/Source/OpenTK.Rewrite/Program.cs @@ -142,7 +142,7 @@ namespace OpenTK.Rewrite var rewritten_constructor = type.GetConstructors().First(); var rewritten = new CustomAttribute(rewritten_constructor); rewritten.ConstructorArguments.Add(new CustomAttributeArgument( - type.Module.Import(typeof(bool)), true)); + type.Module.Import(mscorlib.MainModule.GetType("System.Boolean")), true)); type.Module.Assembly.CustomAttributes.Add(rewritten); } } @@ -266,7 +266,7 @@ namespace OpenTK.Rewrite // String return-type wrapper // return new string((sbyte*)((void*)GetString())); - var intptr_to_voidpointer = wrapper.Module.Import(typeof(IntPtr).GetMethods() + var intptr_to_voidpointer = wrapper.Module.Import(mscorlib.MainModule.GetType("System.IntPtr").GetMethods() .First(m => { return @@ -274,11 +274,11 @@ namespace OpenTK.Rewrite m.ReturnType.Name == "Void*"; })); - var string_constructor = wrapper.Module.Import(typeof(string).GetConstructors() + var string_constructor = wrapper.Module.Import(mscorlib.MainModule.GetType("System.String").GetConstructors() .First(m => { - var p = m.GetParameters(); - return p.Length > 0 && p[0].ParameterType.Name == "SByte*"; + var p = m.Parameters; + return p.Count > 0 && p[0].ParameterType.Name == "SByte*"; })); il.Emit(OpCodes.Call, intptr_to_voidpointer);