Przeglądaj źródła

删除ILRuntime

tanghai 6 lat temu
rodzic
commit
c22b38ee68
100 zmienionych plików z 11 dodań i 10549 usunięć
  1. 0 9
      Server/App/Properties/launchSettings.json
  2. 4 0
      Server/App/Server.App.csproj
  3. 0 5
      Unity/Assets/Editor/ComponentViewEditor/ComponentViewEditor.cs
  4. 4 18
      Unity/Assets/Hotfix/Base/Helper/JsonHelper.cs
  5. 3 19
      Unity/Assets/Model/Base/Helper/JsonHelper.cs
  6. 0 9
      Unity/Assets/Model/Base/IL.meta
  7. 0 69
      Unity/Assets/Model/Base/IL/Adapt_IMessage.cs
  8. 0 11
      Unity/Assets/Model/Base/IL/Adapt_IMessage.cs.meta
  9. 0 94
      Unity/Assets/Model/Base/IL/IAsyncStateMachineAdaptor.cs
  10. 0 12
      Unity/Assets/Model/Base/IL/IAsyncStateMachineAdaptor.cs.meta
  11. 0 82
      Unity/Assets/Model/Base/IL/IDisposableAdaptor.cs
  12. 0 12
      Unity/Assets/Model/Base/IL/IDisposableAdaptor.cs.meta
  13. 0 9
      Unity/Assets/Model/Base/IL/ILAdapterAttribute.cs
  14. 0 12
      Unity/Assets/Model/Base/IL/ILAdapterAttribute.cs.meta
  15. 0 9
      Unity/Assets/Model/Base/IL/ILBindingAttribute.cs
  16. 0 12
      Unity/Assets/Model/Base/IL/ILBindingAttribute.cs.meta
  17. 0 55
      Unity/Assets/Model/Helper/ILHelper.cs
  18. 0 3
      Unity/Assets/Model/Helper/ILHelper.cs.meta
  19. 0 8
      Unity/Assets/Model/ILBinding.meta
  20. 0 26
      Unity/Assets/Model/ILBinding/CLRBindings.cs
  21. 0 12
      Unity/Assets/Model/ILBinding/CLRBindings.cs.meta
  22. 0 44
      Unity/Assets/Model/Other/ILStaticMethod.cs
  23. 0 11
      Unity/Assets/Model/Other/ILStaticMethod.cs.meta
  24. BIN
      Unity/Assets/Res/Code/Hotfix.dll.bytes
  25. BIN
      Unity/Assets/Res/Code/Hotfix.pdb.bytes
  26. 0 74
      Unity/Assets/ThirdParty/Google.Protobuf/AdaptHelper.cs
  27. 0 11
      Unity/Assets/ThirdParty/Google.Protobuf/AdaptHelper.cs.meta
  28. 0 9
      Unity/Assets/ThirdParty/ILRuntime.meta
  29. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime.meta
  30. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR.meta
  31. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method.meta
  32. 0 415
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/CLRMethod.cs
  33. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/CLRMethod.cs.meta
  34. 0 26
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ExceptionHandler.cs
  35. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ExceptionHandler.cs.meta
  36. 0 680
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ILMethod.cs
  37. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ILMethod.cs.meta
  38. 0 33
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/IMethod.cs
  39. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/IMethod.cs.meta
  40. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem.meta
  41. 0 889
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/CLRType.cs
  42. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/CLRType.cs.meta
  43. 0 217
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILGenericParameterType.cs
  44. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILGenericParameterType.cs.meta
  45. 0 1236
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILType.cs
  46. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILType.cs.meta
  47. 0 90
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/IType.cs
  48. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/IType.cs.meta
  49. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Utils.meta
  50. 0 306
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Utils/Extensions.cs
  51. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Utils/Extensions.cs.meta
  52. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other.meta
  53. 0 18
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ByReferenceKeyComparer.cs
  54. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ByReferenceKeyComparer.cs.meta
  55. 0 9
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/DelegateExportAttribute.cs
  56. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/DelegateExportAttribute.cs.meta
  57. 0 10
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/NeedAdaptorAttribute.cs
  58. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/NeedAdaptorAttribute.cs.meta
  59. 0 132
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ThreadSafeDictionary.cs
  60. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ThreadSafeDictionary.cs.meta
  61. 0 999
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/UncheckedList.cs
  62. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/UncheckedList.cs.meta
  63. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection.meta
  64. 0 79
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/Extensions.cs
  65. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/Extensions.cs.meta
  66. 0 108
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeConstructorInfo.cs
  67. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeConstructorInfo.cs.meta
  68. 0 228
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeFieldInfo.cs
  69. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeFieldInfo.cs.meta
  70. 0 173
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeMethodInfo.cs
  71. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeMethodInfo.cs.meta
  72. 0 34
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeParameterInfo.cs
  73. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeParameterInfo.cs.meta
  74. 0 257
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimePropertyInfo.cs
  75. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimePropertyInfo.cs.meta
  76. 0 586
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeType.cs
  77. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeType.cs.meta
  78. 0 285
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeWrapperType.cs
  79. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeWrapperType.cs.meta
  80. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime.meta
  81. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Adaptors.meta
  82. 0 73
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Adaptors/CLRCrossBindingAdaptors.cs
  83. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Adaptors/CLRCrossBindingAdaptors.cs.meta
  84. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding.meta
  85. 0 801
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs
  86. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs.meta
  87. 0 416
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs
  88. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs.meta
  89. 0 186
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/CommonBindingGenerator.cs
  90. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/CommonBindingGenerator.cs.meta
  91. 0 348
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ConstructorBindingGenerator.cs
  92. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ConstructorBindingGenerator.cs.meta
  93. 0 114
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/FieldBindingGenerator.cs
  94. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/FieldBindingGenerator.cs.meta
  95. 0 649
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/MethodBindingGenerator.cs
  96. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/MethodBindingGenerator.cs.meta
  97. 0 38
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ValueTypeBindingGenerator.cs
  98. 0 11
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ValueTypeBindingGenerator.cs.meta
  99. 0 8
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Debugger.meta
  100. 0 61
      Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Debugger/BreakPointContext.cs

+ 0 - 9
Server/App/Properties/launchSettings.json

@@ -1,9 +0,0 @@
-{
-  "profiles": {
-    "Server.App": {
-      "commandName": "Project",
-      "commandLineArgs": "--appId=1 --appType=AllServer --config=../Config/StartConfig/LocalAllServer.txt",
-      "workingDirectory": "../../Bin"
-    }
-  }
-}

+ 4 - 0
Server/App/Server.App.csproj

@@ -36,4 +36,8 @@
     </None>
   </ItemGroup>
 
+  <ItemGroup>
+    <Folder Include="Properties" />
+  </ItemGroup>
+
 </Project>

+ 0 - 5
Unity/Assets/Editor/ComponentViewEditor/ComponentViewEditor.cs

@@ -2,7 +2,6 @@ using System;
 using System.Collections.Generic;
 using System.Reflection;
 using ETModel;
-using ILRuntime.Runtime.Intepreter;
 using UnityEditor;
 using UnityEngine;
 
@@ -15,10 +14,6 @@ namespace ETEditor
         {
             ComponentView componentView = (ComponentView) target;
             object component = componentView.Component;
-            if (component.GetType() == typeof (ILTypeInstance))
-            {
-                return;
-            }
             ComponentViewHelper.Draw(component);
         }
     }

+ 4 - 18
Unity/Assets/Hotfix/Base/Helper/JsonHelper.cs

@@ -1,5 +1,5 @@
 using System;
-using LitJson;
+using ETModel;
 
 namespace ETHotfix
 {
@@ -7,31 +7,17 @@ namespace ETHotfix
 	{
 		public static string ToJson(object obj)
 		{
-			return JsonMapper.ToJson(obj);
+			return MongoHelper.ToJson(obj);
 		}
 
 		public static T FromJson<T>(string str)
 		{
-			T t = JsonMapper.ToObject<T>(str);
-			ISupportInitialize iSupportInitialize = t as ISupportInitialize;
-			if (iSupportInitialize == null)
-			{
-				return t;
-			}
-			iSupportInitialize.EndInit();
-			return t;
+			return MongoHelper.FromJson<T>(str);
 		}
 
 		public static object FromJson(Type type, string str)
 		{
-			object t = JsonMapper.ToObject(type, str);
-			ISupportInitialize iSupportInitialize = t as ISupportInitialize;
-			if (iSupportInitialize == null)
-			{
-				return t;
-			}
-			iSupportInitialize.EndInit();
-			return t;
+			return MongoHelper.FromJson(type, str);
 		}
 
 		public static T Clone<T>(T t)

+ 3 - 19
Unity/Assets/Model/Base/Helper/JsonHelper.cs

@@ -1,6 +1,4 @@
 using System;
-using System.ComponentModel;
-using LitJson;
 
 namespace ETModel
 {
@@ -8,31 +6,17 @@ namespace ETModel
 	{
 		public static string ToJson(object obj)
 		{
-			return JsonMapper.ToJson(obj);
+			return MongoHelper.ToJson(obj);
 		}
 
 		public static T FromJson<T>(string str)
 		{
-			T t = JsonMapper.ToObject<T>(str);
-			ISupportInitialize iSupportInitialize = t as ISupportInitialize;
-			if (iSupportInitialize == null)
-			{
-				return t;
-			}
-			iSupportInitialize.EndInit();
-			return t;
+			return MongoHelper.FromJson<T>(str);
 		}
 
 		public static object FromJson(Type type, string str)
 		{
-			object t = JsonMapper.ToObject(type, str);
-			ISupportInitialize iSupportInitialize = t as ISupportInitialize;
-			if (iSupportInitialize == null)
-			{
-				return t;
-			}
-			iSupportInitialize.EndInit();
-			return t;
+			return MongoHelper.FromJson(type, str);
 		}
 
 		public static T Clone<T>(T t)

+ 0 - 9
Unity/Assets/Model/Base/IL.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: 17c7275f24d0ae049999adaf12e27f2c
-folderAsset: yes
-timeCreated: 1486629341
-licenseType: Pro
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 69
Unity/Assets/Model/Base/IL/Adapt_IMessage.cs

@@ -1,69 +0,0 @@
-using System;
-using ETModel;
-using Google.Protobuf;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-using AppDomain = ILRuntime.Runtime.Enviorment.AppDomain;
-using IMessage = Google.Protobuf.IMessage;
-
-namespace Google.Protobuf
-{
-
-    [ILAdapter]
-    public class Adapt_IMessage: CrossBindingAdaptor
-    {
-        public override Type BaseCLRType
-        {
-            get
-            {
-                return typeof (IMessage);
-            }
-        }
-
-        public override Type AdaptorType
-        {
-            get
-            {
-                return typeof (Adaptor);
-            }
-        }
-
-        public override object CreateCLRInstance(AppDomain appdomain, ILTypeInstance instance)
-        {
-            return new Adaptor(appdomain, instance);
-        }
-
-        public class Adaptor: MyAdaptor, IMessage
-        {
-            public Adaptor(AppDomain appdomain, ILTypeInstance instance): base(appdomain, instance)
-            {
-            }
-
-            protected override AdaptHelper.AdaptMethod[] GetAdaptMethods()
-            {
-                AdaptHelper.AdaptMethod[] methods =
-                {
-                    new AdaptHelper.AdaptMethod { Name = "MergeFrom", ParamCount = 1 },
-                    new AdaptHelper.AdaptMethod { Name = "WriteTo", ParamCount = 1 },
-                    new AdaptHelper.AdaptMethod { Name = "CalculateSize", ParamCount = 0 },
-                };
-                return methods;
-            }
-
-            public void MergeFrom(CodedInputStream input)
-            {
-                Invoke(0, input);
-            }
-
-            public void WriteTo(CodedOutputStream output)
-            {
-                Invoke(1, output);
-            }
-
-            public int CalculateSize()
-            {
-                return (int) Invoke(2);
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/Model/Base/IL/Adapt_IMessage.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 8bfd3530b6af9ca4f92d438cd1f7b2ba
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 94
Unity/Assets/Model/Base/IL/IAsyncStateMachineAdaptor.cs

@@ -1,94 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-
-namespace ETModel
-{
-	/// <summary>
-	/// 用于async await适配
-	/// </summary>
-	[ILAdapter]
-	public class IAsyncStateMachineClassInheritanceAdaptor : CrossBindingAdaptor
-	{
-		public override Type BaseCLRType
-		{
-			get
-			{
-				return typeof (IAsyncStateMachine);
-			}
-		}
-
-		public override Type AdaptorType
-		{
-			get
-			{
-				return typeof (IAsyncStateMachineAdaptor);
-			}
-		}
-
-		public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance)
-		{
-			return new IAsyncStateMachineAdaptor(appdomain, instance);
-		}
-		
-		public class IAsyncStateMachineAdaptor: IAsyncStateMachine, CrossBindingAdaptorType
-		{
-			private ILTypeInstance instance;
-			private ILRuntime.Runtime.Enviorment.AppDomain appDomain;
-
-			private IMethod mMoveNext;
-			private IMethod mSetStateMachine;
-			private readonly object[] param1 = new object[1];
-
-			public IAsyncStateMachineAdaptor()
-			{
-			}
-
-			public IAsyncStateMachineAdaptor(ILRuntime.Runtime.Enviorment.AppDomain appDomain, ILTypeInstance instance)
-			{
-				this.appDomain = appDomain;
-				this.instance = instance;
-			}
-
-			public ILTypeInstance ILInstance
-			{
-				get
-				{
-					return instance;
-				}
-			}
-
-			public void MoveNext()
-			{
-				if (this.mMoveNext == null)
-				{
-					mMoveNext = instance.Type.GetMethod("MoveNext", 0);
-				}
-				this.appDomain.Invoke(mMoveNext, instance, null);
-			}
-
-			public void SetStateMachine(IAsyncStateMachine stateMachine)
-			{
-				if (this.mSetStateMachine == null)
-				{
-					mSetStateMachine = instance.Type.GetMethod("SetStateMachine");
-				}
-				this.appDomain.Invoke(mSetStateMachine, instance, stateMachine);
-			}
-
-			public override string ToString()
-			{
-				IMethod m = this.appDomain.ObjectType.GetMethod("ToString", 0);
-				m = instance.Type.GetVirtualMethod(m);
-				if (m == null || m is ILMethod)
-				{
-					return instance.ToString();
-				}
-
-				return instance.Type.FullName;
-			}
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Model/Base/IL/IAsyncStateMachineAdaptor.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 38e596d85bc79674996c1fb6a5944581
-timeCreated: 1486629341
-licenseType: Pro
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 82
Unity/Assets/Model/Base/IL/IDisposableAdaptor.cs

@@ -1,82 +0,0 @@
-using System;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-
-namespace ETModel
-{
-	[ILAdapter]
-	public class IDisposableClassInheritanceAdaptor : CrossBindingAdaptor
-	{
-		public override Type BaseCLRType
-		{
-			get
-			{
-				return typeof (IDisposable);
-			}
-		}
-
-		public override Type AdaptorType
-		{
-			get
-			{
-				return typeof (IDisposableAdaptor);
-			}
-		}
-
-		public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance)
-		{
-			return new IDisposableAdaptor(appdomain, instance);
-		}
-		
-		public class IDisposableAdaptor: IDisposable, CrossBindingAdaptorType
-		{
-			private ILTypeInstance instance;
-			private ILRuntime.Runtime.Enviorment.AppDomain appDomain;
-			
-			private IMethod iDisposable;
-			private readonly object[] param0 = new object[0];
-
-			public IDisposableAdaptor()
-			{
-			}
-
-			public IDisposableAdaptor(ILRuntime.Runtime.Enviorment.AppDomain appDomain, ILTypeInstance instance)
-			{
-				this.appDomain = appDomain;
-				this.instance = instance;
-			}
-
-			public ILTypeInstance ILInstance
-			{
-				get
-				{
-					return instance;
-				}
-			}
-
-			public void Dispose()
-			{
-				if (this.iDisposable == null)
-				{
-					this.iDisposable = instance.Type.GetMethod("Dispose");
-				}
-				this.appDomain.Invoke(this.iDisposable, instance, this.param0);
-			}
-
-			public override string ToString()
-			{
-				IMethod m = this.appDomain.ObjectType.GetMethod("ToString", 0);
-				m = instance.Type.GetVirtualMethod(m);
-				if (m == null || m is ILMethod)
-				{
-					return instance.ToString();
-				}
-
-				return instance.Type.FullName;
-			}
-
-
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Model/Base/IL/IDisposableAdaptor.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: c13973d21d0078e41939a9b62ed7efce
-timeCreated: 1495165694
-licenseType: Pro
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 9
Unity/Assets/Model/Base/IL/ILAdapterAttribute.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace ETModel
-{
-	[AttributeUsage(AttributeTargets.Class)]
-	public class ILAdapterAttribute : Attribute
-	{
-	}
-}

+ 0 - 12
Unity/Assets/Model/Base/IL/ILAdapterAttribute.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: dfe25f88b146b3642a3c5dc24d5ddaf2
-timeCreated: 1495185208
-licenseType: Pro
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 9
Unity/Assets/Model/Base/IL/ILBindingAttribute.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace ETModel
-{
-	[AttributeUsage(AttributeTargets.Class, Inherited = false)]
-	public class ILBindingAttribute : Attribute
-	{
-	}
-}

+ 0 - 12
Unity/Assets/Model/Base/IL/ILBindingAttribute.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 5bc968db5a1250942b8587dd7d739972
-timeCreated: 1498116020
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 55
Unity/Assets/Model/Helper/ILHelper.cs

@@ -1,55 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Generated;
-using ILRuntime.Runtime.Intepreter;
-using UnityEngine;
-
-namespace ETModel
-{
-	public static class ILHelper
-	{
-		public static void InitILRuntime(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
-		{
-			// 注册重定向函数
-
-			// 注册委托
-			appdomain.DelegateManager.RegisterMethodDelegate<List<object>>();
-			appdomain.DelegateManager.RegisterMethodDelegate<AChannel, System.Net.Sockets.SocketError>();
-			appdomain.DelegateManager.RegisterMethodDelegate<byte[], int, int>();
-			appdomain.DelegateManager.RegisterMethodDelegate<IResponse>();
-			appdomain.DelegateManager.RegisterMethodDelegate<Session, object>();
-			appdomain.DelegateManager.RegisterMethodDelegate<Session, ushort, MemoryStream>();
-			appdomain.DelegateManager.RegisterMethodDelegate<Session>();
-			appdomain.DelegateManager.RegisterMethodDelegate<ILTypeInstance>();
-			appdomain.DelegateManager.RegisterFunctionDelegate<Google.Protobuf.Adapt_IMessage.Adaptor>();
-			appdomain.DelegateManager.RegisterMethodDelegate<Google.Protobuf.Adapt_IMessage.Adaptor>();
-
-			CLRBindings.Initialize(appdomain);
-
-			// 注册适配器
-			Assembly assembly = typeof(Init).Assembly;
-			foreach (Type type in assembly.GetTypes())
-			{
-				object[] attrs = type.GetCustomAttributes(typeof(ILAdapterAttribute), false);
-				if (attrs.Length == 0)
-				{
-					continue;
-				}
-				object obj = Activator.CreateInstance(type);
-				CrossBindingAdaptor adaptor = obj as CrossBindingAdaptor;
-				if (adaptor == null)
-				{
-					continue;
-				}
-				appdomain.RegisterCrossBindingAdaptor(adaptor);
-			}
-
-			LitJson.JsonMapper.RegisterILRuntimeCLRRedirection(appdomain);
-		}
-	}
-}

+ 0 - 3
Unity/Assets/Model/Helper/ILHelper.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: db76e26ce70b40d1823db1466a26fc83
-timeCreated: 1504164125

+ 0 - 8
Unity/Assets/Model/ILBinding.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 4b6cb67e0636d0b4ba21c0a44f5ed308
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 26
Unity/Assets/Model/ILBinding/CLRBindings.cs

@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace ILRuntime.Runtime.Generated
-{
-    class CLRBindings
-    {
-
-
-        /// <summary>
-        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
-        /// </summary>
-        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {
-            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
-        }
-
-        /// <summary>
-        /// Release the CLR binding, please invoke this BEFORE ILRuntime Appdomain destroy
-        /// </summary>
-        public static void Shutdown(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {
-        }
-    }
-}

+ 0 - 12
Unity/Assets/Model/ILBinding/CLRBindings.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 777defee4c58efe4ab78f0c6a1914a33
-timeCreated: 1520319207
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 44
Unity/Assets/Model/Other/ILStaticMethod.cs

@@ -1,44 +0,0 @@
-using ILRuntime.CLR.Method;
-
-namespace ETModel
-{
-	public class ILStaticMethod : IStaticMethod
-	{
-		private readonly ILRuntime.Runtime.Enviorment.AppDomain appDomain;
-		private readonly IMethod method;
-		private readonly object[] param;
-
-		public ILStaticMethod(ILRuntime.Runtime.Enviorment.AppDomain appDomain, string typeName, string methodName, int paramsCount)
-		{
-			this.appDomain = appDomain;
-			this.method = appDomain.GetType(typeName).GetMethod(methodName, paramsCount);
-			this.param = new object[paramsCount];
-		}
-
-		public override void Run()
-		{
-			this.appDomain.Invoke(this.method, null, this.param);
-		}
-
-		public override void Run(object a)
-		{
-			this.param[0] = a;
-			this.appDomain.Invoke(this.method, null, param);
-		}
-
-		public override void Run(object a, object b)
-		{
-			this.param[0] = a;
-			this.param[1] = b;
-			this.appDomain.Invoke(this.method, null, param);
-		}
-
-		public override void Run(object a, object b, object c)
-		{
-			this.param[0] = a;
-			this.param[1] = b;
-			this.param[2] = c;
-			this.appDomain.Invoke(this.method, null, param);
-		}
-	}
-}

+ 0 - 11
Unity/Assets/Model/Other/ILStaticMethod.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: cdca8cda6f7298043af0e5b0f248e425
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

BIN
Unity/Assets/Res/Code/Hotfix.dll.bytes


BIN
Unity/Assets/Res/Code/Hotfix.pdb.bytes


+ 0 - 74
Unity/Assets/ThirdParty/Google.Protobuf/AdaptHelper.cs

@@ -1,74 +0,0 @@
-
-using System;
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-using AppDomain = ILRuntime.Runtime.Enviorment.AppDomain;
-
-public static class AdaptHelper
-{
-    public class AdaptMethod
-    {
-        public string Name;
-        public int ParamCount;
-        public IMethod Method;
-    }
-
-
-    public static IMethod GetMethod(this ILType type, AdaptMethod m)
-    {
-        if (m.Method != null)
-            return m.Method;
-
-        m.Method = type.GetMethod(m.Name, m.ParamCount);
-        if (m.Method == null)
-        {
-            string baseClass = "";
-            if (type.FirstCLRBaseType != null)
-            {
-                baseClass = type.FirstCLRBaseType.FullName;
-            }
-            else if (type.FirstCLRInterface != null)
-            {
-                baseClass = type.FirstCLRInterface.FullName;
-            }
-
-            throw new Exception(string.Format("can't find the method: {0}.{1}:{2}, paramCount={3}", type.FullName, m.Name, baseClass, m.ParamCount));
-        }
-
-        return m.Method;
-    }
-}
-
-public abstract class MyAdaptor : CrossBindingAdaptorType
-{
-    protected AppDomain AppDomain { get; set; }
-    protected ILTypeInstance _instance;
-    private AdaptHelper.AdaptMethod[] _methods;
-
-    protected abstract AdaptHelper.AdaptMethod[] GetAdaptMethods();
-
-    public ILTypeInstance ILInstance
-    {
-        get { return _instance; }
-        set { _instance = value; }
-    }
-
-    protected object Invoke(int index, params object[] p)
-    {
-        if (_methods == null)
-            _methods = GetAdaptMethods();
-
-        var m = _instance.Type.GetMethod(_methods[index]);
-        return AppDomain.Invoke(m, _instance, p);
-    }
-
-    protected MyAdaptor(AppDomain appdomain, ILTypeInstance instance)
-    {
-        AppDomain = appdomain;
-        _instance = instance;
-    }
-
-}
-

+ 0 - 11
Unity/Assets/ThirdParty/Google.Protobuf/AdaptHelper.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 4640c013447589b43af10bf9115f6a1e
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 9
Unity/Assets/ThirdParty/ILRuntime.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: c7f6e299339884644accd7ca650313b1
-folderAsset: yes
-timeCreated: 1486603921
-licenseType: Pro
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 87596c56637b1f840a506371ff9e9e6a
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d542c719c306ebf42bcded60a947e102
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: b0743254a9a39824a996c5fcc817b513
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 415
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/CLRMethod.cs

@@ -1,415 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-
-using Mono.Cecil;
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.Runtime.Stack;
-using ILRuntime.CLR.Utils;
-namespace ILRuntime.CLR.Method
-{
-    public class CLRMethod : IMethod
-    {
-        MethodInfo def;
-        ConstructorInfo cDef;
-        List<IType> parameters;
-        ParameterInfo[] parametersCLR;
-        ILRuntime.Runtime.Enviorment.AppDomain appdomain;
-        CLRType declaringType;
-        ParameterInfo[] param;
-        bool isConstructor;
-        CLRRedirectionDelegate redirect;
-        IType[] genericArguments;
-        Type[] genericArgumentsCLR;
-        object[] invocationParam;
-        bool isDelegateInvoke;
-        int hashCode = -1;
-        static int instance_id = 0x20000000;
-
-        public IType DeclearingType
-        {
-            get
-            {
-                return declaringType;
-            }
-        }
-        public string Name
-        {
-            get
-            {
-                return def.Name;
-            }
-        }
-        public bool HasThis
-        {
-            get
-            {
-                return isConstructor ? !cDef.IsStatic : !def.IsStatic;
-            }
-        }
-        public int GenericParameterCount
-        {
-            get
-            {
-                if (def.ContainsGenericParameters && def.IsGenericMethodDefinition)
-                {
-                    return def.GetGenericArguments().Length;
-                }
-                return 0;
-            }
-        }
-        public bool IsGenericInstance
-        {
-            get
-            {
-                return genericArguments != null;
-            }
-        }
-
-        public bool IsDelegateInvoke
-        {
-            get
-            {
-                return isDelegateInvoke;
-            }
-        }
-
-        public bool IsStatic
-        {
-            get
-            {
-                if (cDef != null)
-                    return cDef.IsStatic;
-                else
-                    return def.IsStatic;
-            }
-        }
-
-        public CLRRedirectionDelegate Redirection { get { return redirect; } }
-
-        public MethodInfo MethodInfo { get { return def; } }
-
-        public ConstructorInfo ConstructorInfo { get { return cDef; } }
-
-        public IType[] GenericArguments { get { return genericArguments; } }
-
-        public Type[] GenericArgumentsCLR
-        {
-            get
-            {
-                if(genericArgumentsCLR == null)
-                {
-                    if (cDef != null)
-                        genericArgumentsCLR = cDef.GetGenericArguments();
-                    else
-                        genericArgumentsCLR = def.GetGenericArguments();
-                }
-                return genericArgumentsCLR;
-            }
-        }
-
-        internal CLRMethod(MethodInfo def, CLRType type, ILRuntime.Runtime.Enviorment.AppDomain domain)
-        {
-            this.def = def;
-            declaringType = type;
-            this.appdomain = domain;
-            param = def.GetParameters();
-            if (!def.ContainsGenericParameters)
-            {
-                ReturnType = domain.GetType(def.ReturnType.FullName);
-                if (ReturnType == null)
-                {
-                    ReturnType = domain.GetType(def.ReturnType.AssemblyQualifiedName);
-                }
-            }
-            if (type.IsDelegate && def.Name == "Invoke")
-                isDelegateInvoke = true;
-            isConstructor = false;
-
-            if (def != null)
-            {
-                if (def.IsGenericMethod && !def.IsGenericMethodDefinition)
-                {
-                    //Redirection of Generic method Definition will be prioritized
-                    if(!appdomain.RedirectMap.TryGetValue(def.GetGenericMethodDefinition(), out redirect))
-                        appdomain.RedirectMap.TryGetValue(def, out redirect);
-                }
-                else
-                    appdomain.RedirectMap.TryGetValue(def, out redirect);
-            }
-        }
-        internal CLRMethod(ConstructorInfo def, CLRType type, ILRuntime.Runtime.Enviorment.AppDomain domain)
-        {
-            this.cDef = def;
-            declaringType = type;
-            this.appdomain = domain;
-            param = def.GetParameters();
-            if (!def.ContainsGenericParameters)
-            {
-                ReturnType = type;
-            }
-            isConstructor = true;
-
-            if (def != null)
-            {
-                appdomain.RedirectMap.TryGetValue(cDef, out redirect);
-            }
-        }
-
-        public int ParameterCount
-        {
-            get
-            {
-                return param != null ? param.Length : 0;
-            }
-        }
-
-
-        public List<IType> Parameters
-        {
-            get
-            {
-                if (parameters == null)
-                {
-                    InitParameters();
-                }
-                return parameters;
-            }
-        }
-
-        public ParameterInfo[] ParametersCLR
-        {
-            get
-            {
-                if(parametersCLR == null)
-                {
-                    if (cDef != null)
-                        parametersCLR = cDef.GetParameters();
-                    else
-                        parametersCLR = def.GetParameters();
-                }
-                return parametersCLR;
-            }
-        }
-
-        public IType ReturnType
-        {
-            get;
-            private set;
-        }
-
-        public bool IsConstructor
-        {
-            get
-            {
-                return cDef != null;
-            }
-        }
-
-        void InitParameters()
-        {
-            parameters = new List<IType>();
-            foreach (var i in param)
-            {
-                IType type = appdomain.GetType(i.ParameterType.FullName);
-                if (type == null)
-                    type = appdomain.GetType(i.ParameterType.AssemblyQualifiedName);
-                if (i.ParameterType.IsGenericTypeDefinition)
-                {
-                    if (type == null)
-                        type = appdomain.GetType(i.ParameterType.GetGenericTypeDefinition().FullName);
-                    if (type == null)
-                        type = appdomain.GetType(i.ParameterType.GetGenericTypeDefinition().AssemblyQualifiedName);
-                }
-                if (i.ParameterType.ContainsGenericParameters)
-                {
-                    var t = i.ParameterType;
-                    if (t.HasElementType)
-                        t = i.ParameterType.GetElementType();
-                    else if (t.GetGenericArguments().Length > 0)
-                    {
-                        t = t.GetGenericArguments()[0];
-                    }
-                    type = new ILGenericParameterType(t.Name);
-                }
-                if (type == null)
-                    throw new TypeLoadException();
-                parameters.Add(type);
-            }
-        }
-
-        unsafe StackObject* Minus(StackObject* a, int b)
-        {
-            return (StackObject*)((long)a - sizeof(StackObject) * b);
-        }
-
-        public unsafe object Invoke(Runtime.Intepreter.ILIntepreter intepreter, StackObject* esp, IList<object> mStack, bool isNewObj = false)
-        {
-            if (parameters == null)
-            {
-                InitParameters();
-            }
-            int paramCount = ParameterCount;
-            if (invocationParam == null)
-                invocationParam = new object[paramCount];
-            object[] param = invocationParam;
-            for (int i = paramCount; i >= 1; i--)
-            {
-                var p = Minus(esp, i);
-                var pt = this.param[paramCount - i].ParameterType;
-                var obj = pt.CheckCLRTypes(StackObject.ToObject(p, appdomain, mStack));
-                obj = ILIntepreter.CheckAndCloneValueType(obj, appdomain);
-                param[paramCount - i] = obj;
-            }
-
-            if (isConstructor)
-            {
-                if (!isNewObj)
-                {
-                    if (!cDef.IsStatic)
-                    {
-                        object instance = declaringType.TypeForCLR.CheckCLRTypes(StackObject.ToObject((Minus(esp, paramCount + 1)), appdomain, mStack));
-                        if (instance == null)
-                            throw new NullReferenceException();
-                        if (instance is CrossBindingAdaptorType && paramCount == 0)//It makes no sense to call the Adaptor's default constructor
-                            return null;
-                        cDef.Invoke(instance, param);
-                        return null;
-                    }
-                    else
-                    {
-                        throw new NotImplementedException();
-                    }
-                }
-                else
-                {
-                    var res = cDef.Invoke(param);
-
-                    FixReference(paramCount, esp, param, mStack, null, false);
-                    return res;
-                }
-
-            }
-            else
-            {
-                object instance = null;
-
-                if (!def.IsStatic)
-                {
-                    instance = StackObject.ToObject((Minus(esp, paramCount + 1)), appdomain, mStack);
-                    if (!(instance is Reflection.ILRuntimeWrapperType))
-                        instance = declaringType.TypeForCLR.CheckCLRTypes(instance);
-                    if (declaringType.IsValueType)
-                        instance = ILIntepreter.CheckAndCloneValueType(instance, appdomain);
-                    if (instance == null)
-                        throw new NullReferenceException();
-                }
-                object res = null;
-                /*if (redirect != null)
-                    res = redirect(new ILContext(appdomain, intepreter, esp, mStack, this), instance, param, genericArguments);
-                else*/
-                {
-                    res = def.Invoke(instance, param);
-                }
-
-                FixReference(paramCount, esp, param, mStack, instance, !def.IsStatic);
-                return res;
-            }
-        }
-
-        unsafe void FixReference(int paramCount, StackObject* esp, object[] param, IList<object> mStack,object instance, bool hasThis)
-        {
-            var cnt = hasThis ? paramCount + 1 : paramCount;
-            for (int i = cnt; i >= 1; i--)
-            {
-                var p = Minus(esp, i);
-                var val = i <= paramCount ? param[paramCount - i] : instance;
-                switch (p->ObjectType)
-                {
-                    case ObjectTypes.StackObjectReference:
-                        {
-                            var addr = *(long*)&p->Value;
-                            var dst = (StackObject*)addr;
-                            if (dst->ObjectType >= ObjectTypes.Object)
-                            {
-                                var obj = val;
-                                if (obj is CrossBindingAdaptorType)
-                                    obj = ((CrossBindingAdaptorType)obj).ILInstance;
-                                mStack[dst->Value] = obj;
-                            }
-                            else
-                            {
-                                ILIntepreter.UnboxObject(dst, val, mStack, appdomain);
-                            }
-                        }
-                        break;
-                    case ObjectTypes.FieldReference:
-                        {
-                            var obj = mStack[p->Value];
-                            if(obj is ILTypeInstance)
-                            {
-                                ((ILTypeInstance)obj)[p->ValueLow] = val;
-                            }
-                            else
-                            {
-                                var t = appdomain.GetType(obj.GetType()) as CLRType;
-                                t.GetField(p->ValueLow).SetValue(obj, val);
-                            }
-                        }
-                        break;
-                    case ObjectTypes.StaticFieldReference:
-                        {
-                            var t = appdomain.GetType(p->Value);
-                            if(t is ILType)
-                            {
-                                ((ILType)t).StaticInstance[p->ValueLow] = val;
-                            }
-                            else
-                            {
-                                ((CLRType)t).SetStaticFieldValue(p->ValueLow, val);
-                            }
-                        }
-                        break;
-                    case ObjectTypes.ArrayReference:
-                        {
-                            var arr = mStack[p->Value] as Array;
-                            arr.SetValue(val, p->ValueLow);
-                        }
-                        break;
-                }
-            }
-        }
-
-        public IMethod MakeGenericMethod(IType[] genericArguments)
-        {
-            Type[] p = new Type[genericArguments.Length];
-            for (int i = 0; i < genericArguments.Length; i++)
-            {
-                p[i] = genericArguments[i].TypeForCLR;
-            }
-            var t = def.MakeGenericMethod(p);
-            var res = new CLRMethod(t, declaringType, appdomain);
-            res.genericArguments = genericArguments;
-            return res;
-        }
-
-        public override string ToString()
-        {
-            if (def != null)
-                return def.ToString();
-            else
-                return cDef.ToString();
-        }
-
-        public override int GetHashCode()
-        {
-            if (hashCode == -1)
-                hashCode = System.Threading.Interlocked.Add(ref instance_id, 1);
-            return hashCode;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/CLRMethod.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e3a93984f12c9da43b98d43930dd8c49
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 26
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ExceptionHandler.cs

@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using ILRuntime.CLR.TypeSystem;
-
-namespace ILRuntime.CLR.Method
-{
-    enum ExceptionHandlerType
-    {
-        Catch,
-        Finally,
-        Fault,
-    }
-    class ExceptionHandler
-    {
-        public ExceptionHandlerType HandlerType { get; set; }
-
-        public int TryStart { get; set; }
-        public int TryEnd { get; set; }
-        public int HandlerStart { get; set; }
-        public int HandlerEnd { get; set; }
-        public IType CatchType { get; set; }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ExceptionHandler.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 99ef6f3b1f4f7894ebd5e1878c08fcb5
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 680
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ILMethod.cs

@@ -1,680 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-
-using Mono.Cecil;
-using ILRuntime.Runtime.Intepreter.OpCodes;
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Runtime.Debugger;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.Reflection;
-namespace ILRuntime.CLR.Method
-{
-    public class ILMethod : IMethod
-    {
-        OpCode[] body;
-        MethodDefinition def;
-        List<IType> parameters;
-        ILRuntime.Runtime.Enviorment.AppDomain appdomain;
-        ILType declaringType;
-        ExceptionHandler[] exceptionHandler;
-        KeyValuePair<string, IType>[] genericParameters;
-        IType[] genericArguments;
-        Dictionary<int, int[]> jumptables;
-        bool isDelegateInvoke;
-        ILRuntimeMethodInfo refletionMethodInfo;
-        ILRuntimeConstructorInfo reflectionCtorInfo;
-        int paramCnt, localVarCnt;
-        Mono.Collections.Generic.Collection<Mono.Cecil.Cil.VariableDefinition> variables;
-        int hashCode = -1;
-        static int instance_id = 0x10000000;
-
-        public MethodDefinition Definition { get { return def; } }
-
-        public Dictionary<int, int[]> JumpTables { get { return jumptables; } }
-
-        internal IDelegateAdapter DelegateAdapter { get; set; }
-
-        internal int StartLine { get; set; }
-
-        internal int EndLine { get; set; }
-
-        public MethodInfo ReflectionMethodInfo
-        {
-            get
-            {
-                if (IsConstructor)
-                    throw new NotSupportedException();
-                if (refletionMethodInfo == null)
-                    refletionMethodInfo = new ILRuntimeMethodInfo(this);
-                return refletionMethodInfo;
-            }
-        }
-
-        public ConstructorInfo ReflectionConstructorInfo
-        {
-            get
-            {
-                if (!IsConstructor)
-                    throw new NotSupportedException();
-                if (reflectionCtorInfo == null)
-                    reflectionCtorInfo = new ILRuntimeConstructorInfo(this);
-                return reflectionCtorInfo;
-            }
-        }
-
-        internal ExceptionHandler[] ExceptionHandler
-        {
-            get
-            {
-                if (body == null)
-                    InitCodeBody();
-                return exceptionHandler;
-            }
-        }
-
-        public string Name
-        {
-            get
-            {
-                return def.Name;
-            }
-        }
-
-        public IType DeclearingType
-        {
-            get
-            {
-                return declaringType;
-            }
-        }
-
-        public bool HasThis
-        {
-            get
-            {
-                return def.HasThis;
-            }
-        }
-        public int GenericParameterCount
-        {
-            get
-            {
-                if (IsGenericInstance)
-                    return 0;
-                return def.GenericParameters.Count;
-            }
-        }
-        public bool IsGenericInstance
-        {
-            get
-            {
-                return genericParameters != null;
-            }
-        }
-        public Mono.Collections.Generic.Collection<Mono.Cecil.Cil.VariableDefinition> Variables
-        {
-            get
-            {
-                return variables;
-            }
-        }
-
-        public KeyValuePair<string, IType>[] GenericArguments { get { return genericParameters; } }
-
-        public IType[] GenericArugmentsArray { get { return genericArguments; } }
-        public ILMethod(MethodDefinition def, ILType type, ILRuntime.Runtime.Enviorment.AppDomain domain)
-        {
-            this.def = def;
-            declaringType = type;
-            if (def.ReturnType.IsGenericParameter)
-            {
-                ReturnType = FindGenericArgument(def.ReturnType.Name);
-            }
-            else
-                ReturnType = domain.GetType(def.ReturnType, type, this);
-            if (type.IsDelegate && def.Name == "Invoke")
-                isDelegateInvoke = true;
-            this.appdomain = domain;
-            paramCnt = def.HasParameters ? def.Parameters.Count : 0;
-#if DEBUG && !DISABLE_ILRUNTIME_DEBUG
-            if (def.HasBody)
-            {
-                var sp = GetValidSequence(0, 1);
-                if (sp != null)
-                {
-                    StartLine = sp.StartLine;
-                    sp = GetValidSequence(def.Body.Instructions.Count - 1, -1);
-                    if (sp != null)
-                    {
-                        EndLine = sp.EndLine;
-                    }
-                }
-            }
-#endif
-        }
-
-        Mono.Cecil.Cil.SequencePoint GetValidSequence(int startIdx, int dir)
-        {
-            var seqMapping = def.DebugInformation.GetSequencePointMapping();
-            var cur = DebugService.FindSequencePoint(def.Body.Instructions[startIdx], seqMapping);
-            while (cur != null && cur.StartLine == 0x0feefee)
-            {
-                startIdx += dir;
-                if (startIdx >= 0 && startIdx < def.Body.Instructions.Count)
-                {
-                    cur = DebugService.FindSequencePoint(def.Body.Instructions[startIdx], seqMapping);
-                }
-                else
-                    break;
-            }
-
-            return cur;
-        }
-
-        public IType FindGenericArgument(string name)
-        {
-            IType res = declaringType.FindGenericArgument(name);
-            if (res == null && genericParameters != null)
-            {
-                foreach (var i in genericParameters)
-                {
-                    if (i.Key == name)
-                        return i.Value;
-                }
-            }
-            else
-                return res;
-            return null;
-        }
-
-        internal OpCode[] Body
-        {
-            get
-            {
-                if (body == null)
-                    InitCodeBody();
-                return body;
-            }
-        }
-
-        public bool HasBody
-        {
-            get
-            {
-                return body != null;
-            }
-        }
-
-        public int LocalVariableCount
-        {
-            get
-            {
-                return localVarCnt;
-            }
-        }
-
-        public bool IsConstructor
-        {
-            get
-            {
-                return def.IsConstructor;
-            }
-        }
-
-        public bool IsDelegateInvoke
-        {
-            get
-            {
-                return isDelegateInvoke;
-            }
-        }
-
-        public bool IsStatic
-        {
-            get { return def.IsStatic; }
-        }
-
-        public int ParameterCount
-        {
-            get
-            {
-                return paramCnt;
-            }
-        }
-
-
-        public List<IType> Parameters
-        {
-            get
-            {
-                if (def.HasParameters && parameters == null)
-                {
-                    InitParameters();
-                }
-                return parameters;
-            }
-        }
-
-        public IType ReturnType
-        {
-            get;
-            private set;
-        }
-
-        public void Prewarm()
-        {
-            if (body == null)
-                InitCodeBody();
-        }
-
-        void InitCodeBody()
-        {
-            if (def.HasBody)
-            {
-                localVarCnt = def.Body.Variables.Count;
-                body = new OpCode[def.Body.Instructions.Count];
-                Dictionary<Mono.Cecil.Cil.Instruction, int> addr = new Dictionary<Mono.Cecil.Cil.Instruction, int>();
-                for (int i = 0; i < body.Length; i++)
-                {
-                    var c = def.Body.Instructions[i];
-                    OpCode code = new OpCode();
-                    code.Code = (OpCodeEnum)c.OpCode.Code;
-                    addr[c] = i;
-                    body[i] = code;
-                }
-                for (int i = 0; i < body.Length; i++)
-                {
-                    var c = def.Body.Instructions[i];
-                    InitToken(ref body[i], c.Operand, addr);
-                    if (i > 0 && c.OpCode.Code == Mono.Cecil.Cil.Code.Callvirt && def.Body.Instructions[i - 1].OpCode.Code == Mono.Cecil.Cil.Code.Constrained)
-                    {
-                        body[i - 1].TokenLong = body[i].TokenInteger;
-                    }
-                }
-
-                for (int i = 0; i < def.Body.ExceptionHandlers.Count; i++)
-                {
-                    var eh = def.Body.ExceptionHandlers[i];
-                    if (exceptionHandler == null)
-                        exceptionHandler = new Method.ExceptionHandler[def.Body.ExceptionHandlers.Count];
-                    ExceptionHandler e = new ExceptionHandler();
-                    e.HandlerStart = addr[eh.HandlerStart];
-                    e.HandlerEnd = addr[eh.HandlerEnd] - 1;
-                    e.TryStart = addr[eh.TryStart];
-                    e.TryEnd = addr[eh.TryEnd] - 1;
-                    switch (eh.HandlerType)
-                    {
-                        case Mono.Cecil.Cil.ExceptionHandlerType.Catch:
-                            e.CatchType = appdomain.GetType(eh.CatchType, declaringType, this);
-                            e.HandlerType = ExceptionHandlerType.Catch;
-                            break;
-                        case Mono.Cecil.Cil.ExceptionHandlerType.Finally:
-                            e.HandlerType = ExceptionHandlerType.Finally;
-                            break;
-                        case Mono.Cecil.Cil.ExceptionHandlerType.Fault:
-                            e.HandlerType = ExceptionHandlerType.Fault;
-                            break;
-                        default:
-                            throw new NotImplementedException();
-                    }
-                    exceptionHandler[i] = e;
-                    //Mono.Cecil.Cil.ExceptionHandlerType.
-                }
-                //Release Method body to save memory
-                variables = def.Body.Variables;
-                def.Body = null;
-            }
-            else
-                body = new OpCode[0];
-        }
-
-        unsafe void InitToken(ref OpCode code, object token, Dictionary<Mono.Cecil.Cil.Instruction, int> addr)
-        {
-            switch (code.Code)
-            {
-                case OpCodeEnum.Leave:
-                case OpCodeEnum.Leave_S:
-                case OpCodeEnum.Br:
-                case OpCodeEnum.Br_S:
-                case OpCodeEnum.Brtrue:
-                case OpCodeEnum.Brtrue_S:
-                case OpCodeEnum.Brfalse:
-                case OpCodeEnum.Brfalse_S:
-                //比较流程控制
-                case OpCodeEnum.Beq:
-                case OpCodeEnum.Beq_S:
-                case OpCodeEnum.Bne_Un:
-                case OpCodeEnum.Bne_Un_S:
-                case OpCodeEnum.Bge:
-                case OpCodeEnum.Bge_S:
-                case OpCodeEnum.Bge_Un:
-                case OpCodeEnum.Bge_Un_S:
-                case OpCodeEnum.Bgt:
-                case OpCodeEnum.Bgt_S:
-                case OpCodeEnum.Bgt_Un:
-                case OpCodeEnum.Bgt_Un_S:
-                case OpCodeEnum.Ble:
-                case OpCodeEnum.Ble_S:
-                case OpCodeEnum.Ble_Un:
-                case OpCodeEnum.Ble_Un_S:
-                case OpCodeEnum.Blt:
-                case OpCodeEnum.Blt_S:
-                case OpCodeEnum.Blt_Un:
-                case OpCodeEnum.Blt_Un_S:
-                    code.TokenInteger = addr[(Mono.Cecil.Cil.Instruction)token];
-                    break;
-                case OpCodeEnum.Ldc_I4:
-                    code.TokenInteger = (int)token;
-                    break;
-                case OpCodeEnum.Ldc_I4_S:
-                    code.TokenInteger = (sbyte)token;
-                    break;
-                case OpCodeEnum.Ldc_I8:
-                    code.TokenLong = (long)token;
-                    break;
-                case OpCodeEnum.Ldc_R4:
-                    {
-                        float val = (float)token;
-                        code.TokenInteger = *(int*)&val;
-                    }
-                    break;
-                case OpCodeEnum.Ldc_R8:
-                    {
-                        double val = (double)token;
-                        code.TokenLong = *(long*)&val;
-                    }
-                    break;
-                case OpCodeEnum.Stloc:
-                case OpCodeEnum.Stloc_S:
-                case OpCodeEnum.Ldloc:
-                case OpCodeEnum.Ldloc_S:
-                case OpCodeEnum.Ldloca:
-                case OpCodeEnum.Ldloca_S:
-                    {
-                        Mono.Cecil.Cil.VariableDefinition vd = (Mono.Cecil.Cil.VariableDefinition)token;
-                        code.TokenInteger = vd.Index;
-                    }
-                    break;
-                case OpCodeEnum.Ldarg_S:
-                case OpCodeEnum.Ldarg:
-                case OpCodeEnum.Ldarga:
-                case OpCodeEnum.Ldarga_S:
-                case OpCodeEnum.Starg:
-                case OpCodeEnum.Starg_S:
-                    {
-                        Mono.Cecil.ParameterDefinition vd = (Mono.Cecil.ParameterDefinition)token;
-                        code.TokenInteger = vd.Index;
-                        if (HasThis)
-                            code.TokenInteger++;
-                    }
-                    break;
-                case OpCodeEnum.Call:
-                case OpCodeEnum.Newobj:
-                case OpCodeEnum.Ldftn:
-                case OpCodeEnum.Ldvirtftn:
-                case OpCodeEnum.Callvirt:
-                    {
-                        bool invalidToken;
-                        var m = appdomain.GetMethod(token, declaringType, this, out invalidToken);
-                        if (m != null)
-                        {
-                            if (invalidToken)
-                                code.TokenInteger = m.GetHashCode();
-                            else
-                                code.TokenInteger = token.GetHashCode();
-                        }
-                        else
-                        {
-                            //Cannot find method or the method is dummy
-                            MethodReference _ref = (MethodReference)token;
-                            int paramCnt = _ref.HasParameters ? _ref.Parameters.Count : 0;
-                            if (_ref.HasThis)
-                                paramCnt++;
-                            code.TokenLong = paramCnt;
-                        }
-                    }
-                    break;
-                case OpCodeEnum.Constrained:
-                case OpCodeEnum.Box:
-                case OpCodeEnum.Unbox_Any:
-                case OpCodeEnum.Unbox:
-                case OpCodeEnum.Initobj:
-                case OpCodeEnum.Isinst:
-                case OpCodeEnum.Newarr:
-                case OpCodeEnum.Stobj:
-                case OpCodeEnum.Ldobj:
-                    {
-                        code.TokenInteger = GetTypeTokenHashCode(token);
-                    }
-                    break;
-                case OpCodeEnum.Stfld:
-                case OpCodeEnum.Ldfld:
-                case OpCodeEnum.Ldflda:
-                    {
-                        code.TokenLong = appdomain.GetStaticFieldIndex(token, declaringType, this);
-                    }
-                    break;
-
-                case OpCodeEnum.Stsfld:
-                case OpCodeEnum.Ldsfld:
-                case OpCodeEnum.Ldsflda:
-                    {
-                        code.TokenLong = appdomain.GetStaticFieldIndex(token, declaringType, this);
-                    }
-                    break;
-                case OpCodeEnum.Ldstr:
-                    {
-                        long hashCode = appdomain.CacheString(token);
-                        code.TokenLong = hashCode;
-                    }
-                    break;
-                case OpCodeEnum.Ldtoken:
-                    {
-                        if (token is FieldReference)
-                        {
-                            code.TokenInteger = 0;
-                            code.TokenLong = appdomain.GetStaticFieldIndex(token, declaringType, this);
-                        }
-                        else if (token is TypeReference)
-                        {
-                            code.TokenInteger = 1;
-                            code.TokenLong = GetTypeTokenHashCode(token);
-                        }
-                        else
-                            throw new NotImplementedException();
-                    }
-                    break;
-                case OpCodeEnum.Switch:
-                    {
-                        PrepareJumpTable(token, addr);
-                        code.TokenInteger = token.GetHashCode();
-                    }
-                    break;
-            }
-        }
-
-        int GetTypeTokenHashCode(object token)
-        {
-            var t = appdomain.GetType(token, declaringType, this);
-            bool isGenericParameter = CheckHasGenericParamter(token);
-            if (t == null && isGenericParameter)
-            {
-                t = FindGenericArgument(((TypeReference)token).Name);
-            }
-            if (t != null)
-            {
-                if (t is ILType)
-                {
-                    if (((ILType)t).TypeReference.HasGenericParameters)
-                        return t.GetHashCode();
-                    else
-                        return ((ILType)t).TypeReference.GetHashCode();
-                }
-                else if (isGenericParameter)
-                {
-                    return t.GetHashCode();
-                }
-                else
-                    return token.GetHashCode();
-            }
-            return 0;
-        }
-
-        bool CheckHasGenericParamter(object token)
-        {
-            if (token is TypeReference)
-            {
-                TypeReference _ref = ((TypeReference)token);
-                if (_ref.IsArray)
-                    return CheckHasGenericParamter(((ArrayType)_ref).ElementType);
-                if (_ref.IsGenericParameter)
-                    return true;
-                if (_ref.IsGenericInstance)
-                {
-                    GenericInstanceType gi = (GenericInstanceType)_ref;
-                    foreach(var i in gi.GenericArguments)
-                    {
-                        if (CheckHasGenericParamter(i))
-                            return true;
-                    }
-                    return false;
-                }
-                else
-                    return false;
-            }
-            else
-                return false;
-        }
-
-        void PrepareJumpTable(object token, Dictionary<Mono.Cecil.Cil.Instruction, int> addr)
-        {
-            int hashCode = token.GetHashCode();
-
-            if (jumptables == null)
-                jumptables = new Dictionary<int, int[]>();
-            if (jumptables.ContainsKey(hashCode))
-                return;
-            Mono.Cecil.Cil.Instruction[] e = token as Mono.Cecil.Cil.Instruction[];
-            int[] addrs = new int[e.Length];
-            for (int i = 0; i < e.Length; i++)
-            {
-                addrs[i] = addr[e[i]];
-            }
-
-            jumptables[hashCode] = addrs;
-        }
-
-        void InitParameters()
-        {
-            parameters = new List<IType>();
-            foreach (var i in def.Parameters)
-            {
-                IType type = null;
-                bool isByRef = false;
-                bool isArray = false;
-                int rank = 1;
-                TypeReference pt = i.ParameterType;
-                if (pt.IsByReference)
-                {
-                    isByRef = true;
-                    pt = ((ByReferenceType)pt).ElementType;
-                }
-                if (pt.IsArray)
-                {
-                    isArray = true;
-                    rank = ((ArrayType)pt).Rank;
-                    pt = ((ArrayType)pt).ElementType;
-                }
-                if (pt.IsGenericParameter)
-                {
-                    type = FindGenericArgument(pt.Name);
-                    if (type == null && def.HasGenericParameters)
-                    {
-                        bool found = false;
-                        foreach (var j in def.GenericParameters)
-                        {
-                            if (j.Name == pt.Name)
-                            {
-                                found = true;
-                                break;
-                            }
-                        }
-                        if (found)
-                        {
-                            type = new ILGenericParameterType(pt.Name);
-                        }
-                        else
-                            throw new NotSupportedException("Cannot find Generic Parameter " + pt.Name + " in " + def.FullName);
-                    }
-                }
-                else
-                    type = appdomain.GetType(pt, declaringType, this);
-
-                if (isByRef)
-                    type = type.MakeByRefType();
-                if (isArray)
-                    type = type.MakeArrayType(rank);
-                parameters.Add(type);
-            }
-        }
-
-        public IMethod MakeGenericMethod(IType[] genericArguments)
-        {
-            KeyValuePair<string, IType>[] genericParameters = new KeyValuePair<string, IType>[genericArguments.Length];
-            for (int i = 0; i < genericArguments.Length; i++)
-            {
-                string name = def.GenericParameters[i].Name;
-                IType val = genericArguments[i];
-                genericParameters[i] = new KeyValuePair<string, IType>(name, val);
-            }
-
-            ILMethod m = new ILMethod(def, declaringType, appdomain);
-            m.genericParameters = genericParameters;
-            m.genericArguments = genericArguments;
-            if (m.def.ReturnType.IsGenericParameter)
-            {
-                m.ReturnType = m.FindGenericArgument(m.def.ReturnType.Name);
-            }
-            return m;
-        }
-
-        string cachedName;
-        public override string ToString()
-        {
-            if (cachedName == null)
-            {
-                StringBuilder sb = new StringBuilder();
-                sb.Append(declaringType.FullName);
-                sb.Append('.');
-                sb.Append(Name);
-                sb.Append('(');
-                bool isFirst = true;
-                if (parameters == null)
-                    InitParameters();
-                for (int i = 0; i < parameters.Count; i++)
-                {
-                    if (isFirst)
-                        isFirst = false;
-                    else
-                        sb.Append(", ");
-                    sb.Append(parameters[i].Name);
-                    sb.Append(' ');
-                    sb.Append(def.Parameters[i].Name);
-                }
-                sb.Append(')');
-                cachedName = sb.ToString();
-            }
-            return cachedName;
-        }
-
-        public override int GetHashCode()
-        {
-            if (hashCode == -1)
-                hashCode = System.Threading.Interlocked.Add(ref instance_id, 1);
-            return hashCode;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/ILMethod.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 4d61dbf18ea786940ad2dda2466cde64
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 33
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/IMethod.cs

@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using ILRuntime.CLR.TypeSystem;
-namespace ILRuntime.CLR.Method
-{
-    public interface IMethod
-    {
-        string Name { get; }
-        int ParameterCount { get; }
-
-        bool HasThis { get; }
-
-        IType DeclearingType { get; }
-
-        IType ReturnType { get; }
-        List<IType> Parameters { get; }
-
-        int GenericParameterCount { get; }
-
-        bool IsGenericInstance { get; }
-
-        bool IsConstructor { get; }
-
-        bool IsDelegateInvoke { get; }
-
-        bool IsStatic { get; }
-
-        IMethod MakeGenericMethod(IType[] genericArguments);
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Method/IMethod.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 3ee73b411c3d8c34cbcc5578441c854a
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: dc9d077bf71a98747bf2b50f52bd9063
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 889
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/CLRType.cs

@@ -1,889 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-
-using Mono.Cecil;
-using ILRuntime.CLR.Method;
-using ILRuntime.Reflection;
-using ILRuntime.Runtime.Enviorment;
-
-namespace ILRuntime.CLR.TypeSystem
-{
-    public class CLRType : IType
-    {
-        Type clrType;
-        bool isPrimitive, isValueType, isEnum;
-        Dictionary<string, List<CLRMethod>> methods;
-        ILRuntime.Runtime.Enviorment.AppDomain appdomain;
-        List<CLRMethod> constructors;
-        KeyValuePair<string, IType>[] genericArguments;
-        List<CLRType> genericInstances;
-        Dictionary<string, int> fieldMapping;
-        Dictionary<int, FieldInfo> fieldInfoCache;
-        Dictionary<int, CLRFieldGetterDelegate> fieldGetterCache;
-        Dictionary<int, CLRFieldSetterDelegate> fieldSetterCache;
-        Dictionary<int, int> fieldIdxMapping;
-        IType[] orderedFieldTypes;
-
-        CLRMemberwiseCloneDelegate memberwiseCloneDelegate;
-        CLRCreateDefaultInstanceDelegate createDefaultInstanceDelegate;
-        CLRCreateArrayInstanceDelegate createArrayInstanceDelegate;
-        Dictionary<int, int> fieldTokenMapping;
-        IType byRefType, elementType;
-        Dictionary<int, IType> arrayTypes;
-        IType[] interfaces;
-        bool isDelegate;
-        IType baseType;
-        bool isBaseTypeInitialized = false, interfaceInitialized = false, valueTypeBinderGot = false;
-        ILRuntimeWrapperType wraperType;
-        ValueTypeBinder valueTypeBinder;
-
-        int hashCode = -1;
-        static int instance_id = 0x20000000;
-
-        public Dictionary<int, FieldInfo> Fields
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields();
-                return fieldInfoCache;
-            }
-        }
-
-        public Dictionary<int, int> FieldIndexMapping
-        {
-            get { return fieldIdxMapping; }
-        }
-
-        public IType[] OrderedFieldTypes
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields();
-                return orderedFieldTypes;
-            }
-        }
-
-        public int TotalFieldCount
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields();
-
-                if (fieldIdxMapping != null)
-                    return fieldIdxMapping.Count;
-                else
-                    throw new NotSupportedException("Cannot find ValueTypeBinder for type:" + clrType.FullName);
-            }
-        }
-
-        public ILRuntime.Runtime.Enviorment.AppDomain AppDomain
-        {
-            get
-            {
-                return appdomain;
-            }
-        }
-
-        public CLRType(Type clrType, Runtime.Enviorment.AppDomain appdomain)
-        {
-            this.clrType = clrType;
-            this.appdomain = appdomain;
-            isPrimitive = clrType.IsPrimitive;
-            isEnum = clrType.IsEnum;
-            isValueType = clrType.IsValueType;
-            isDelegate = clrType.BaseType == typeof(MulticastDelegate);
-        }
-
-        public bool IsGenericInstance
-        {
-            get
-            {
-                return genericArguments != null;
-            }
-        }
-
-        public KeyValuePair<string, IType>[] GenericArguments
-        {
-            get
-            {
-                return genericArguments;
-            }
-        }
-
-        public IType ElementType { get { return elementType; } }
-
-        public bool HasGenericParameter
-        {
-            get
-            {
-                if (genericArguments != null)
-                {
-                    foreach(var i in genericArguments)
-                    {
-                        if(i.Value is ILType && i.Value.HasGenericParameter)
-                        {
-                            return true;
-                        }
-                    }
-                }
-                return clrType.ContainsGenericParameters;
-            }
-        }
-
-        public bool IsGenericParameter
-        {
-            get
-            {
-                return clrType.IsGenericParameter;
-            }
-        }
-
-        public bool IsInterface
-        {
-            get { return clrType.IsInterface; }
-        }
-
-        public Type TypeForCLR
-        {
-            get
-            {
-                return clrType;
-            }
-        }
-
-        public Type ReflectionType
-        {
-            get
-            {
-                if (wraperType == null)
-                    wraperType = new ILRuntimeWrapperType(this);
-                return wraperType;
-            }
-        }
-        public IType ByRefType
-        {
-            get
-            {
-                return byRefType;
-            }
-        }
-        public IType ArrayType
-        {
-            get
-            {
-                return arrayTypes != null ? arrayTypes[1] : null;
-            }
-        }
-
-        public bool IsArray
-        {
-            get;private set;
-        }
-
-        public int ArrayRank
-        {
-            get;private set;
-        }
-
-        public bool IsValueType
-        {
-            get
-            {
-                return isValueType;
-            }
-        }
-
-        public bool IsByRef
-        {
-            get
-            {
-                return clrType.IsByRef;
-            }
-        }
-
-        public bool IsDelegate
-        {
-            get
-            {
-                return isDelegate;
-            }
-        }
-
-        public bool IsPrimitive
-        {
-            get
-            {
-                return isPrimitive;
-            }
-        }
-
-        public bool IsEnum
-        {
-            get
-            {
-                return isEnum;
-            }
-        }
-        public string FullName
-        {
-            get
-            {
-                return clrType.FullName;
-            }
-        }
-        public string Name
-        {
-            get
-            {
-                return clrType.Name;
-            }
-        }
-
-        public IType BaseType
-        {
-            get
-            {
-                if (!isBaseTypeInitialized)
-                    InitializeBaseType();
-                return baseType;
-            }
-        }
-
-        public IType[] Implements
-        {
-            get
-            {
-                if (!interfaceInitialized)
-                    InitializeInterfaces();
-                return interfaces;
-            }
-        }
-
-        public ValueTypeBinder ValueTypeBinder
-        {
-            get
-            {
-                if (clrType.IsValueType)
-                {
-                    if (!valueTypeBinderGot)
-                    {
-                        valueTypeBinderGot = true;
-                        appdomain.ValueTypeBinders.TryGetValue(clrType, out valueTypeBinder);
-                    }
-                    return valueTypeBinder;
-                }
-                else
-                    return null;
-            }
-        }
-
-        public object PerformMemberwiseClone(object target)
-        {
-            if (memberwiseCloneDelegate == null)
-            {
-                if (!AppDomain.MemberwiseCloneMap.TryGetValue(this.clrType, out memberwiseCloneDelegate))
-                {
-                    var memberwiseClone = clrType.GetMethod("MemberwiseClone", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
-
-                    if (memberwiseClone != null)
-                    {
-                        memberwiseCloneDelegate = (ref object t) => memberwiseClone.Invoke(t, null);
-                    }
-                    else
-                    {
-                        throw new InvalidOperationException("Memberwise clone method not found for " + clrType.FullName);
-                    }
-                }
-            }
-
-            return memberwiseCloneDelegate(ref target);
-        }
-
-        void InitializeBaseType()
-        {
-            baseType = appdomain.GetType(clrType.BaseType);
-            if (baseType.TypeForCLR == typeof(Enum) || baseType.TypeForCLR == typeof(object) || baseType.TypeForCLR == typeof(ValueType) || baseType.TypeForCLR == typeof(System.Enum))
-            {//都是这样,无所谓
-                baseType = null;
-            }
-            isBaseTypeInitialized = true;
-        }
-
-        void InitializeInterfaces()
-        {
-            interfaceInitialized = true;
-            var arr = clrType.GetInterfaces();
-            if (arr.Length >0)
-            {
-                interfaces = new IType[arr.Length];
-                for (int i = 0; i < interfaces.Length; i++)
-                {
-                    interfaces[i] = appdomain.GetType(arr[i]);
-                }
-            }
-        }
-
-        public object GetFieldValue(int hash, object target)
-        {
-            if (fieldMapping == null)
-                InitializeFields();
-
-            var getter = GetFieldGetter(hash);
-            if (getter != null)
-            {
-                return getter(ref target);
-            }
-
-            var fieldinfo = GetField(hash);
-            if (fieldinfo != null)
-            {
-                return fieldinfo.GetValue(target);
-            }
-
-            return null;
-        }
-
-        public void SetStaticFieldValue(int hash, object value)
-        {
-            if (fieldMapping == null)
-                InitializeFields();
-
-            var setter = GetFieldSetter(hash);
-            object target = null;
-            if (setter != null)
-            {
-                setter(ref target, value);
-                return;
-            }
-
-            var fieldInfo = GetField(hash);
-            if (fieldInfo != null)
-            {
-                fieldInfo.SetValue(null, value);
-            }
-        }
-
-        public unsafe void SetFieldValue(int hash, ref object target, object value)
-        {
-            if (fieldMapping == null)
-                InitializeFields();
-
-            var setter = GetFieldSetter(hash);
-            if (setter != null)
-            {
-                setter(ref target, value);
-                return;
-            }
-
-            var fieldInfo = GetField(hash);
-            if (fieldInfo != null)
-            {
-                fieldInfo.SetValue(target, value);
-            }
-        }
-
-        private CLRFieldGetterDelegate GetFieldGetter(int hash)
-        {
-            var dic = fieldGetterCache;
-            CLRFieldGetterDelegate res;
-            if (dic != null && dic.TryGetValue(hash, out res))
-                return res;
-            else if (BaseType != null)
-                return ((CLRType)BaseType).GetFieldGetter(hash);
-            else
-                return null;
-        }
-
-        private CLRFieldSetterDelegate GetFieldSetter(int hash)
-        {
-            var dic = fieldSetterCache;
-            CLRFieldSetterDelegate res;
-            if (dic != null && dic.TryGetValue(hash, out res))
-                return res;
-            else if (BaseType != null)
-                return ((CLRType)BaseType).GetFieldSetter(hash);
-            else
-                return null;
-        }
-
-        public FieldInfo GetField(int hash)
-        {
-            var dic = Fields;
-            FieldInfo res;
-            if (dic.TryGetValue(hash, out res))
-                return res;
-            else if (BaseType != null)
-                return ((CLRType)BaseType).GetField(hash);
-            else
-                return null;
-        }
-
-        void InitializeMethods()
-        {
-            methods = new Dictionary<string, List<CLRMethod>>();
-            constructors = new List<CLRMethod>();
-            foreach (var i in clrType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
-            {
-                if (i.IsPrivate)
-                    continue;
-                List<CLRMethod> lst;
-                if (!methods.TryGetValue(i.Name, out lst))
-                {
-                    lst = new List<CLRMethod>();
-                    methods[i.Name] = lst;
-                }
-                lst.Add(new CLRMethod(i, this, appdomain));
-            }
-            foreach (var i in clrType.GetConstructors())
-            {
-                constructors.Add(new CLRMethod(i, this, appdomain));
-            }
-        }
-        public List<IMethod> GetMethods()
-        {
-            if (methods == null)
-                InitializeMethods();
-            List<IMethod> res = new List<IMethod>();
-            foreach (var i in methods)
-            {
-                foreach (var j in i.Value)
-                    res.Add(j);
-            }
-
-            return res;
-        }
-
-        public IMethod GetVirtualMethod(IMethod method)
-        {
-            var m = GetMethod(method.Name, method.Parameters, null, method.ReturnType);
-            if (m == null)
-            {
-                return method;
-            }
-            else
-                return m;
-        }
-
-        void InitializeFields()
-        {
-            fieldMapping = new Dictionary<string, int>();
-            fieldInfoCache = new Dictionary<int, FieldInfo>();
-
-            var fields = clrType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
-            int idx = 0;
-            bool hasValueTypeBinder = ValueTypeBinder != null;
-            if (hasValueTypeBinder)
-            {
-                fieldIdxMapping = new Dictionary<int, int>();
-                orderedFieldTypes = new IType[fields.Length];
-            }
-            foreach (var i in fields)
-            {
-                int hashCode = i.GetHashCode();
-
-                if (i.IsPublic || i.IsFamily || hasValueTypeBinder)
-                {
-                    fieldMapping[i.Name] = hashCode;
-                    fieldInfoCache[hashCode] = i;
-                }
-                if (hasValueTypeBinder && !i.IsStatic)
-                {
-                    orderedFieldTypes[idx] = appdomain.GetType(i.FieldType);
-                    fieldIdxMapping[hashCode] = idx++;
-                }
-
-                CLRFieldGetterDelegate getter;
-                if (AppDomain.FieldGetterMap.TryGetValue(i, out getter))
-                {
-                    if (fieldGetterCache == null) fieldGetterCache = new Dictionary<int, CLRFieldGetterDelegate>();
-                    fieldGetterCache[hashCode] = getter;
-                }
-
-                CLRFieldSetterDelegate setter;
-                if (AppDomain.FieldSetterMap.TryGetValue(i, out setter))
-                {
-                    if (fieldSetterCache == null) fieldSetterCache = new Dictionary<int, CLRFieldSetterDelegate>();
-                    fieldSetterCache[hashCode] = setter;
-                }
-            }
-        }
-        public int GetFieldIndex(object token)
-        {
-            if (fieldMapping == null)
-                InitializeFields();
-            int idx;
-            int hashCode = token.GetHashCode();
-            if (fieldTokenMapping == null)
-                fieldTokenMapping = new Dictionary<int, int>();
-            if (fieldTokenMapping.TryGetValue(hashCode, out idx))
-                return idx;
-            FieldReference f = token as FieldReference;
-            if (fieldMapping.TryGetValue(f.Name, out idx))
-            {
-                fieldTokenMapping[hashCode] = idx;
-                return idx;
-            }
-
-            return -1;
-        }
-        public IType FindGenericArgument(string key)
-        {
-            if (genericArguments != null)
-            {
-                foreach (var i in genericArguments)
-                {
-                    if (i.Key == key)
-                        return i.Value;
-                }
-            }
-            return null;
-        }
-        public IMethod GetMethod(string name, int paramCount, bool declaredOnly = false)
-        {
-            if (methods == null)
-                InitializeMethods();
-            List<CLRMethod> lst;
-            if (methods.TryGetValue(name, out lst))
-            {
-                foreach (var i in lst)
-                {
-                    if (i.ParameterCount == paramCount)
-                        return i;
-                }
-            }
-            return null;
-        }
-
-        bool MatchGenericParameters(Type[] args, Type type, Type q, IType[] genericArguments)
-        {
-            if (type.IsGenericParameter)
-            {
-                for (int i = 0; i < args.Length; i++)
-                {
-                    if (args[i] == type)
-                    {
-                        return q == genericArguments[i].TypeForCLR;
-                    }
-                }
-                throw new NotSupportedException();
-            }
-            else
-            {
-                if (type.IsArray)
-                {
-                    if (q.IsArray)
-                    {
-                        return MatchGenericParameters(args, type.GetElementType(), q.GetElementType(), genericArguments);
-                    }
-                    else
-                        return false;
-                }
-                else if (type.IsByRef)
-                {
-                    if (q.IsByRef)
-                    {
-                        return MatchGenericParameters(args, type.GetElementType(), q.GetElementType(), genericArguments);
-                    }
-                    else
-                        return false;
-                }
-                else if (type.IsGenericType)
-                {
-                    if (q.IsGenericType)
-                    {
-                        var t1 = type.GetGenericTypeDefinition();
-                        var t2 = type.GetGenericTypeDefinition();
-                        if (t1 == t2)
-                        {
-                            var argA = type.GetGenericArguments();
-                            var argB = q.GetGenericArguments();
-                            if (argA.Length == argB.Length)
-                            {
-                                for (int i = 0; i < argA.Length; i++)
-                                {
-                                    if (!MatchGenericParameters(args, argA[i], argB[i], genericArguments))
-                                        return false;
-                                }
-                                return true;
-                            }
-                            else
-                                return false;
-                        }
-                        else
-                            return false;
-                    }
-                    else
-                        return false;
-                }
-                else
-                    return type == q;
-            }
-        }
-
-        public IMethod GetMethod(string name, List<IType> param, IType[] genericArguments, IType returnType = null, bool declaredOnly = false)
-        {
-            if (methods == null)
-                InitializeMethods();
-            List<CLRMethod> lst;
-            IMethod genericMethod = null;
-            if (methods.TryGetValue(name, out lst))
-            {
-                foreach (var i in lst)
-                {
-                    if (i.ParameterCount == param.Count)
-                    {
-                        bool match = true;
-                        if (genericArguments != null && i.GenericParameterCount == genericArguments.Length)
-                        {
-                            for (int j = 0; j < param.Count; j++)
-                            {
-                                var p = i.Parameters[j].TypeForCLR;
-                                var q = param[j].TypeForCLR;
-
-                                if (i.Parameters[j].HasGenericParameter)
-                                {
-                                    //TODO should match the generic parameters;
-                                    if (!MatchGenericParameters(i.GenericArgumentsCLR, i.ParametersCLR[j].ParameterType, q, genericArguments))
-                                    {
-                                        match = false;
-                                        break;
-                                    }
-                                    else
-                                        continue;
-                                }
-                                if (q != p)
-                                {
-                                    match = false;
-                                    break;
-                                }
-                            }
-                            if (match && genericMethod == null)
-                            {
-                                genericMethod = i;
-                            }
-                        }
-                        else
-                        {
-                            if (genericArguments == null)
-                                match = i.GenericArguments == null;
-                            else
-                            {
-                                if (i.GenericArguments == null)
-                                    match = false;
-                                else
-                                    match = i.GenericArguments.Length == genericArguments.Length;
-                            }
-                            if (!match)
-                                continue;
-                            for (int j = 0; j < param.Count; j++)
-                            {
-                                var typeA = param[j].TypeForCLR.IsByRef ? param[j].TypeForCLR.GetElementType() : param[j].TypeForCLR;
-                                var typeB = i.Parameters[j].TypeForCLR.IsByRef ? i.Parameters[j].TypeForCLR.GetElementType() : i.Parameters[j].TypeForCLR;
-
-                                if (typeA != typeB)
-                                {
-                                    match = false;
-                                    break;
-                                }
-                            }
-                            if (match)
-                            {
-                                try
-                                {
-                                    match = returnType == null || (i.ReturnType != null && i.ReturnType.TypeForCLR == returnType.TypeForCLR);
-                                }
-                                catch
-                                {
-
-                                }
-                            }
-                            if (match)
-                            {
-
-                                if (i.IsGenericInstance)
-                                {
-                                    if (i.GenericArguments.Length == genericArguments.Length)
-                                    {
-                                        for (int j = 0; j < genericArguments.Length; j++)
-                                        {
-                                            if (i.GenericArguments[j] != genericArguments[j])
-                                            {
-                                                match = false;
-                                                break;
-                                            }
-                                        }
-                                        if (match)
-                                            return i;
-                                    }
-                                }
-                                else
-                                    return i;
-                            }
-                        }
-                    }
-                }
-            }
-            if (genericArguments != null && genericMethod != null)
-            {
-                var m = genericMethod.MakeGenericMethod(genericArguments);
-                lst.Add((CLRMethod)m);
-                return m;
-            }
-            return null;
-        }
-        public bool CanAssignTo(IType type)
-        {
-            if (this == type)
-            {
-                return true;
-            }
-            else
-            {
-                if (type is ILType)
-                    return false;
-                Type cT = type != null ? type.TypeForCLR : typeof(object);
-                return TypeForCLR.IsAssignableFrom(cT);
-            }
-        }
-
-        public IMethod GetConstructor(List<IType> param)
-        {
-            if (constructors == null)
-                InitializeMethods();
-            foreach (var i in constructors)
-            {
-                if (i.ParameterCount == param.Count)
-                {
-                    bool match = true;
-
-                    for (int j = 0; j < param.Count; j++)
-                    {
-                        if (param[j].TypeForCLR != i.Parameters[j].TypeForCLR)
-                        {
-                            match = false;
-                            break;
-                        }
-                    }
-                    if (match)
-                    {
-                        return i;
-                    }
-                }
-            }
-
-            return null;
-        }
-
-        public IType MakeGenericInstance(KeyValuePair<string, IType>[] genericArguments)
-        {
-            lock (this)
-            {
-                if (genericInstances == null)
-                    genericInstances = new List<CLRType>();
-                foreach (var i in genericInstances)
-                {
-                    bool match = true;
-                    for (int j = 0; j < genericArguments.Length; j++)
-                    {
-                        if (i.genericArguments[j].Value != genericArguments[j].Value)
-                        {
-                            match = false;
-                            break;
-                        }
-                    }
-                    if (match)
-                        return i;
-                }
-                Type[] args = new Type[genericArguments.Length];
-                for (int i = 0; i < genericArguments.Length; i++)
-                {
-                    args[i] = genericArguments[i].Value.TypeForCLR;
-                }
-                Type newType = clrType.MakeGenericType(args);
-                var res = new CLRType(newType, appdomain);
-                res.genericArguments = genericArguments;
-
-                genericInstances.Add(res);
-                return res;
-            }
-        }
-
-        public object CreateDefaultInstance()
-        {
-            if (createDefaultInstanceDelegate == null)
-            {
-                if (!AppDomain.CreateDefaultInstanceMap.TryGetValue(clrType, out createDefaultInstanceDelegate))
-                {
-                    createDefaultInstanceDelegate = () => Activator.CreateInstance(TypeForCLR);
-                }
-            }
-
-            return createDefaultInstanceDelegate();
-        }
-
-        public object CreateArrayInstance(int size)
-        {
-            if (createArrayInstanceDelegate == null)
-            {
-                if (!AppDomain.CreateArrayInstanceMap.TryGetValue(clrType, out createArrayInstanceDelegate))
-                {
-                    createArrayInstanceDelegate = s => Array.CreateInstance(TypeForCLR, s);
-                }
-            }
-
-            return createArrayInstanceDelegate(size);
-        }
-
-        public IType MakeByRefType()
-        {
-            if (byRefType == null)
-            {
-                Type t = clrType.MakeByRefType();
-                byRefType = new CLRType(t, appdomain);
-                ((CLRType)byRefType).elementType = this;
-            }
-            return byRefType;
-        }
-        public IType MakeArrayType(int rank)
-        {
-            if (arrayTypes == null)
-            {
-                arrayTypes = new Dictionary<int, IType>();
-            }
-            IType atype;
-            if (!arrayTypes.TryGetValue(rank, out atype))
-            {
-                Type t = rank > 1 ? clrType.MakeArrayType(rank) : clrType.MakeArrayType();
-                atype = new CLRType(t, appdomain);
-                ((CLRType)atype).elementType = this;
-                ((CLRType)atype).IsArray = true;
-                ((CLRType)atype).ArrayRank = rank;
-                arrayTypes[rank] = atype;
-            }
-            return atype;
-        }
-
-        public IType ResolveGenericType(IType contextType)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override int GetHashCode()
-        {
-            if (hashCode == -1)
-                hashCode = System.Threading.Interlocked.Add(ref instance_id, 1);
-            return hashCode;
-        }
-
-        public override string ToString()
-        {
-            return clrType.ToString();
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/CLRType.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 77e1f51e465e9e24ba3a42bb88b7ad34
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 217
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILGenericParameterType.cs

@@ -1,217 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace ILRuntime.CLR.TypeSystem
-{
-    class ILGenericParameterType : IType
-    {
-        string name;
-        ILGenericParameterType arrayType;
-        public ILGenericParameterType(string name)
-        {
-            this.name = name;
-        }
-        public bool IsGenericInstance
-        {
-            get { return false; }
-        }
-
-        public KeyValuePair<string, IType>[] GenericArguments
-        {
-            get { return null; }
-        }
-        public bool HasGenericParameter
-        {
-            get
-            {
-                return true;
-            }
-        }
-
-        public bool IsGenericParameter
-        {
-            get
-            {
-                return true;
-            }
-        }
-
-        public Type TypeForCLR
-        {
-            get { return typeof(ILGenericParameterType); }
-        }
-
-        public string FullName
-        {
-            get { return name; }
-        }
-
-        public Runtime.Enviorment.AppDomain AppDomain
-        {
-            get { return null; }
-        }
-
-        public Method.IMethod GetMethod(string name, int paramCount, bool declaredOnly = false)
-        {
-            return null;
-        }
-
-        public Method.IMethod GetMethod(string name, List<IType> param, IType[] genericArguments, IType returnType = null, bool declaredOnly = false)
-        {
-            return null;
-        }
-
-        public List<Method.IMethod> GetMethods()
-        {
-            return null;
-        }
-
-        public Method.IMethod GetConstructor(List<IType> param)
-        {
-            return null;
-        }
-
-        public bool CanAssignTo(IType type)
-        {
-            return false;
-        }
-
-        public IType MakeGenericInstance(KeyValuePair<string, IType>[] genericArguments)
-        {
-            return null;
-        }
-
-        public IType ResolveGenericType(IType contextType)
-        {
-            throw new NotImplementedException();
-        }
-
-
-        public int GetFieldIndex(object token)
-        {
-            return -1;
-        }
-
-
-        public IType FindGenericArgument(string key)
-        {
-            return null;
-        }
-
-
-        public IType ByRefType
-        {
-            get { throw new NotImplementedException(); }
-        }
-
-        public IType MakeByRefType()
-        {
-            return this;
-        }
-
-
-        public IType ArrayType
-        {
-            get { return arrayType; }
-        }
-
-        public IType MakeArrayType(int rank)
-        {
-            if (arrayType == null)
-                arrayType = new ILGenericParameterType(name + "[]");
-            return arrayType;
-        }
-
-
-        public bool IsValueType
-        {
-            get { throw new NotImplementedException(); }
-        }
-
-        public bool IsPrimitive
-        {
-            get { return false; }
-        }
-        public bool IsEnum
-        {
-            get { return false; }
-        }
-        public bool IsInterface
-        {
-            get { return false; }
-        }
-
-        public string Name
-        {
-            get
-            {
-                return name;
-            }
-        }
-
-        public bool IsDelegate
-        {
-            get
-            {
-                return false;
-            }
-        }
-
-        public Type ReflectionType
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public IType BaseType
-        {
-            get
-            {
-                return null;
-            }
-        }
-
-        public Method.IMethod GetVirtualMethod(Method.IMethod method)
-        {
-            return method;
-        }
-
-        public bool IsArray
-        {
-            get { return false; }
-        }
-
-        public bool IsByRef
-        {
-            get
-            {
-                return false;
-            }
-        }
-
-        public IType ElementType
-        {
-            get
-            {
-                return null;
-            }
-        }
-
-        public int ArrayRank
-        {
-            get { return 1; }
-        }
-
-        public IType[] Implements
-        {
-            get
-            {
-                return null;
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILGenericParameterType.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: ea169e3908d84da4088fc6eae41d3c41
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 1236
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILType.cs

@@ -1,1236 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using Mono.Cecil;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Reflection;
-
-namespace ILRuntime.CLR.TypeSystem
-{
-    public class ILType : IType
-    {
-        Dictionary<string, List<ILMethod>> methods;
-        TypeReference typeRef;
-        TypeDefinition definition;
-        ILRuntime.Runtime.Enviorment.AppDomain appdomain;
-        ILMethod staticConstructor;
-        List<ILMethod> constructors;
-        IType[] fieldTypes;
-        FieldDefinition[] fieldDefinitions;
-        IType[] staticFieldTypes;
-        FieldDefinition[] staticFieldDefinitions;
-        Dictionary<string, int> fieldMapping;
-        Dictionary<string, int> staticFieldMapping;
-        ILTypeStaticInstance staticInstance;
-        Dictionary<int, int> fieldTokenMapping = new Dictionary<int, int>();
-        int fieldStartIdx = -1;
-        int totalFieldCnt = -1;
-        KeyValuePair<string, IType>[] genericArguments;
-        IType baseType, byRefType, enumType, elementType;
-        Dictionary<int, IType> arrayTypes;
-        Type arrayCLRType, byRefCLRType;
-        IType[] interfaces;
-        bool baseTypeInitialized = false;
-        bool interfaceInitialized = false;
-        List<ILType> genericInstances;
-        bool isDelegate;
-        ILRuntimeType reflectionType;
-        ILType genericDefinition;
-        IType firstCLRBaseType, firstCLRInterface;
-        int hashCode = -1;
-        static int instance_id = 0x10000000;
-        public TypeDefinition TypeDefinition { get { return definition; } }
-        bool mToStringGot, mEqualsGot, mGetHashCodeGot;
-        IMethod mToString, mEquals, mGetHashCode;
-
-        public IMethod ToStringMethod
-        {
-            get
-            {
-                if (!mToStringGot)
-                {
-                    IMethod m = appdomain.ObjectType.GetMethod("ToString", 0, true);
-                    mToString = GetVirtualMethod(m);
-                    mToStringGot = true;
-                }
-                return mToString;
-            }
-        }
-
-        public IMethod EqualsMethod
-        {
-            get
-            {
-                if (!mEqualsGot)
-                {
-                    IMethod m = appdomain.ObjectType.GetMethod("Equals", 1, true);
-                    mEquals = GetVirtualMethod(m);
-                    mEqualsGot = true;
-                }
-                return mEquals;
-            }
-        }
-
-        public IMethod GetHashCodeMethod
-        {
-            get
-            {
-                if (!mGetHashCodeGot)
-                {
-                    IMethod m = appdomain.ObjectType.GetMethod("GetHashCode", 0, true);
-                    mGetHashCode = GetVirtualMethod(m);
-                    mGetHashCodeGot = true;
-                }
-                return mGetHashCode;
-            }
-        }
-
-        public TypeReference TypeReference
-        {
-            get { return typeRef; }
-            set
-            {
-                typeRef = value;
-                RetriveDefinitino(value);
-            }
-        }
-
-        public IType BaseType
-        {
-            get
-            {
-                if (!baseTypeInitialized)
-                    InitializeBaseType();
-                return baseType;
-            }
-        }
-
-        public IType[] Implements
-        {
-            get
-            {
-                if (!interfaceInitialized)
-                    InitializeInterfaces();
-                return interfaces;
-            }
-        }
-
-        public ILTypeStaticInstance StaticInstance
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields();
-                if (methods == null)
-                    InitializeMethods();
-                return staticInstance;
-            }
-        }
-
-        public IType[] FieldTypes
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields();
-                return fieldTypes;
-            }
-        }
-
-        public IType[] StaticFieldTypes
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields();
-                return staticFieldTypes;
-            }
-        }
-
-        public FieldDefinition[] StaticFieldDefinitions
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields();
-                return staticFieldDefinitions;
-            }
-        }
-
-        public Dictionary<string, int> FieldMapping
-        {
-            get
-            {
-                if (fieldMapping == null)
-                    InitializeFields(); return fieldMapping;
-            }
-        }
-
-        public IType FirstCLRBaseType
-        {
-            get
-            {
-                if (!baseTypeInitialized)
-                    InitializeBaseType();
-                return firstCLRBaseType;
-            }
-        }
-
-        public IType FirstCLRInterface
-        {
-            get
-            {
-                if (!interfaceInitialized)
-                    InitializeInterfaces();
-                return firstCLRInterface;
-            }
-        }
-        public bool HasGenericParameter
-        {
-            get
-            {
-                return  typeRef.HasGenericParameters && genericArguments == null;
-            }
-        }
-
-        public bool IsGenericParameter
-        {
-            get
-            {
-                return typeRef.IsGenericParameter && genericArguments == null;
-            }
-        }
-
-        public Dictionary<string, int> StaticFieldMapping { get { return staticFieldMapping; } }
-        public ILRuntime.Runtime.Enviorment.AppDomain AppDomain
-        {
-            get
-            {
-                return appdomain;
-            }
-        }
-
-        internal int FieldStartIndex
-        {
-            get
-            {
-                if (fieldStartIdx < 0)
-                {
-                    if (BaseType != null)
-                    {
-                        if (BaseType is ILType)
-                        {
-                            fieldStartIdx = ((ILType)BaseType).TotalFieldCount;
-                        }
-                        else
-                            fieldStartIdx = 0;
-                    }
-                    else
-                        fieldStartIdx = 0;
-                }
-                return fieldStartIdx;
-            }
-        }
-
-        public int TotalFieldCount
-        {
-            get
-            {
-                if (totalFieldCnt < 0)
-                {
-                    if (fieldMapping == null)
-                        InitializeFields();
-                    if (BaseType != null)
-                    {
-                        if (BaseType is ILType)
-                        {
-                            totalFieldCnt = ((ILType)BaseType).TotalFieldCount + fieldTypes.Length;
-                        }
-                        else
-                            totalFieldCnt = fieldTypes.Length;
-                    }
-                    else
-                        totalFieldCnt = fieldTypes.Length;
-                }
-                return totalFieldCnt;
-            }
-        }
-
-        /// <summary>
-        /// 初始化IL类型
-        /// </summary>
-        /// <param name="def">MONO返回的类型定义</param>
-        /// <param name="domain">ILdomain</param>
-        public ILType(TypeReference def, Runtime.Enviorment.AppDomain domain)
-        {
-            this.typeRef = def;
-            RetriveDefinitino(def);
-            appdomain = domain;
-        }
-
-        /// <summary>
-        /// 加载类型
-        /// </summary>
-        /// <param name="def"></param>
-        void RetriveDefinitino(TypeReference def)
-        {
-            if (!def.IsGenericParameter)
-            {
-                if (def is TypeSpecification)
-                {
-                    if (def.IsByReference || def is ArrayType)
-                    {
-                        definition = null;
-                    }
-                    else
-                        RetriveDefinitino(((TypeSpecification)def).ElementType);
-                }
-                else
-                    definition = def as TypeDefinition;
-            }
-        }
-
-        public bool IsGenericInstance
-        {
-            get
-            {
-                return genericArguments != null;
-            }
-        }
-
-        public ILType GetGenericDefinition()
-        {
-            return genericDefinition;
-        }
-        public KeyValuePair<string, IType>[] GenericArguments
-        {
-            get
-            {
-                return genericArguments;
-            }
-        }
-
-        public IType ElementType { get { return elementType; } }
-
-        public bool IsArray
-        {
-            get; private set;
-        }
-
-        public int ArrayRank
-        {
-            get; private set;
-        }
-
-        public bool IsByRef
-        {
-            get
-            {
-                return typeRef.IsByReference;
-            }
-        }
-
-        private bool? isValueType;
-
-        public bool IsValueType
-        {
-            get
-            {
-                if (IsArray)
-                    return false;
-                if (isValueType == null)
-                    isValueType = definition.IsValueType;
-
-                return isValueType.Value;
-            }
-        }
-
-        public bool IsDelegate
-        {
-            get
-            {
-                if (!baseTypeInitialized)
-                    InitializeBaseType();
-                return isDelegate;
-            }
-        }
-
-        public bool IsPrimitive
-        {
-            get { return false; }
-        }
-
-        public bool IsInterface
-        {
-            get
-            {
-                return TypeDefinition.IsInterface;
-            }
-        }
-
-        public Type TypeForCLR
-        {
-            get
-            {
-                if (!baseTypeInitialized)
-                    InitializeBaseType();
-                if (typeRef is ArrayType)
-                {
-                    return arrayCLRType;
-                }
-                else if (typeRef is ByReferenceType)
-                {
-                    return byRefCLRType;
-                }
-                else if (definition.IsEnum)
-                {
-                    if (enumType == null)
-                        InitializeFields();
-                    return enumType.TypeForCLR;
-                }
-                else if (FirstCLRBaseType != null && FirstCLRBaseType is CrossBindingAdaptor)
-                {
-                    return ((CrossBindingAdaptor)FirstCLRBaseType).RuntimeType.TypeForCLR;
-                }
-                else if (FirstCLRInterface != null && FirstCLRInterface is CrossBindingAdaptor)
-                {
-                    return ((CrossBindingAdaptor)FirstCLRInterface).RuntimeType.TypeForCLR;
-                }
-                else
-                    return typeof(ILTypeInstance);
-            }
-        }
-
-        public Type ReflectionType
-        {
-            get
-            {
-                if (reflectionType == null)
-                    reflectionType = new ILRuntimeType(this);
-                return reflectionType;
-            }
-        }
-
-        public IType ByRefType
-        {
-            get
-            {
-                return byRefType;
-            }
-        }
-        public IType ArrayType
-        {
-            get
-            {
-                return arrayTypes != null ? arrayTypes[1] : null;
-            }
-        }
-
-        public bool IsEnum
-        {
-            get
-            {
-                return definition != null ? definition.IsEnum : false;
-            }
-        }
-
-        string fullName;
-        public string FullName
-        {
-            get
-            {
-                if (string.IsNullOrEmpty(fullName))
-                {
-                    if (typeRef.HasGenericParameters && genericArguments != null)
-                    {
-                        StringBuilder sb = new StringBuilder();
-                        sb.Append(typeRef.FullName);
-                        sb.Append('<');
-                        bool first = true;
-                        foreach (var i in genericArguments)
-                        {
-                            if (first)
-                                first = false;
-                            else
-                                sb.Append(", ");
-                            sb.Append(i.Value.FullName);
-                        }
-                        sb.Append('>');
-                        fullName = sb.ToString();
-                    }
-                    else
-                        fullName = typeRef.FullName;
-                }
-                return fullName;
-            }
-        }
-        public string Name
-        {
-            get
-            {
-                return typeRef.Name;
-            }
-        }
-        public List<IMethod> GetMethods()
-        {
-            if (methods == null)
-                InitializeMethods();
-            List<IMethod> res = new List<IMethod>();
-            foreach (var i in methods)
-            {
-                foreach (var j in i.Value)
-                    res.Add(j);
-            }
-
-            return res;
-        }
-        void InitializeInterfaces()
-        {
-            interfaceInitialized = true;
-            if (definition != null && definition.HasInterfaces)
-            {
-                interfaces = new IType[definition.Interfaces.Count];
-                for (int i = 0; i < interfaces.Length; i++)
-                {
-                    interfaces[i] = appdomain.GetType(definition.Interfaces[i].InterfaceType, this, null);
-                    //only one clrInterface is valid
-                    if (interfaces[i] is CLRType && firstCLRInterface == null)
-                    {
-                        CrossBindingAdaptor adaptor;
-                        if (appdomain.CrossBindingAdaptors.TryGetValue(interfaces[i].TypeForCLR, out adaptor))
-                        {
-                            interfaces[i] = adaptor;
-                            firstCLRInterface = adaptor;
-                        }
-                        else
-                            throw new TypeLoadException("Cannot find Adaptor for:" + interfaces[i].TypeForCLR.ToString());
-                    }
-                }
-            }
-            if (firstCLRInterface == null && BaseType != null && BaseType is ILType)
-                firstCLRInterface = ((ILType)BaseType).FirstCLRInterface;
-        }
-        void InitializeBaseType()
-        {
-            if (definition != null && definition.BaseType != null)
-            {
-                bool specialProcess = false;
-                List<int> spIdx = null;
-                if (definition.BaseType.IsGenericInstance)
-                {
-                    GenericInstanceType git = definition.BaseType as GenericInstanceType;
-                    var elementType = appdomain.GetType(git.ElementType, this, null);
-                    if (elementType is CLRType)
-                    {
-                        for (int i = 0; i < git.GenericArguments.Count; i++)
-                        {
-                            var ga = git.GenericArguments[i];
-                            if (ga == typeRef)
-                            {
-                                specialProcess = true;
-                                if (spIdx == null)
-                                    spIdx = new List<int>();
-                                spIdx.Add(i);
-                            }
-                        }
-                    }
-                }
-                if (specialProcess)
-                {
-                    //如果泛型参数是自身,则必须要特殊处理,否则会StackOverflow
-                    var elementType = appdomain.GetType(((GenericInstanceType)definition.BaseType).ElementType, this, null);
-                    foreach (var i in appdomain.CrossBindingAdaptors)
-                    {
-                        if (i.Key.IsGenericType && !i.Key.IsGenericTypeDefinition)
-                        {
-                            var gd = i.Key.GetGenericTypeDefinition();
-                            if (gd == elementType.TypeForCLR)
-                            {
-                                var ga = i.Key.GetGenericArguments();
-                                bool match = true;
-                                foreach (var j in spIdx)
-                                {
-                                    if (ga[j] != i.Value.AdaptorType)
-                                    {
-                                        match = false;
-                                        break;
-                                    }
-                                }
-                                if (match)
-                                {
-                                    baseType = i.Value;
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                    if (baseType == null)
-                    {
-                        throw new TypeLoadException("Cannot find Adaptor for:" + definition.BaseType.FullName);
-                    }
-                }
-                else
-                {
-                    baseType = appdomain.GetType(definition.BaseType, this, null);
-                    if (baseType is CLRType)
-                    {
-                        if (baseType.TypeForCLR == typeof(Enum) || baseType.TypeForCLR == typeof(object) || baseType.TypeForCLR == typeof(ValueType) || baseType.TypeForCLR == typeof(System.Enum))
-                        {//都是这样,无所谓
-                            baseType = null;
-                        }
-                        else if (baseType.TypeForCLR == typeof(MulticastDelegate))
-                        {
-                            baseType = null;
-                            isDelegate = true;
-                        }
-                        else
-                        {
-                            CrossBindingAdaptor adaptor;
-                            if (appdomain.CrossBindingAdaptors.TryGetValue(baseType.TypeForCLR, out adaptor))
-                            {
-                                baseType = adaptor;
-                            }
-                            else
-                                throw new TypeLoadException("Cannot find Adaptor for:" + baseType.TypeForCLR.ToString());
-                            //继承了其他系统类型
-                            //env.logger.Log_Error("ScriptType:" + Name + " Based On a SystemType:" + BaseType.Name);
-                            //HasSysBase = true;
-                            //throw new Exception("不得继承系统类型,脚本类型系统和脚本类型系统是隔离的");
-                        }
-                    }
-                }
-            }
-            var curBase = baseType;
-            while (curBase is ILType)
-            {
-                curBase = curBase.BaseType;
-            }
-            firstCLRBaseType = curBase;
-            baseTypeInitialized = true;
-        }
-
-        public IMethod GetMethod(string name)
-        {
-            if (methods == null)
-                InitializeMethods();
-            List<ILMethod> lst;
-            if (methods.TryGetValue(name, out lst))
-            {
-                return lst[0];
-            }
-            return null;
-        }
-
-        public IMethod GetMethod(string name, int paramCount, bool declaredOnly = false)
-        {
-            if (methods == null)
-                InitializeMethods();
-            List<ILMethod> lst;
-            if (methods.TryGetValue(name, out lst))
-            {
-                foreach (var i in lst)
-                {
-                    if (i.ParameterCount == paramCount)
-                        return i;
-                }
-            }
-            if (declaredOnly)
-                return null;
-            else
-            {
-                //skip clr base type, this doesn't make any sense
-                if (BaseType != null && !(BaseType is CrossBindingAdaptor))
-                    return BaseType.GetMethod(name, paramCount, false);
-                else
-                    return null;
-            }
-        }
-
-        void InitializeMethods()
-        {
-            methods = new Dictionary<string, List<ILMethod>>();
-            constructors = new List<ILMethod>();
-            if (definition == null)
-                return;
-            foreach (var i in definition.Methods)
-            {
-                if (i.IsConstructor)
-                {
-                    if (i.IsStatic)
-                        staticConstructor = new ILMethod(i, this, appdomain);
-                    else
-                        constructors.Add(new ILMethod(i, this, appdomain));
-                }
-                else
-                {
-                    List<ILMethod> lst;
-                    if (!methods.TryGetValue(i.Name, out lst))
-                    {
-                        lst = new List<ILMethod>();
-                        methods[i.Name] = lst;
-                    }
-                    var m = new ILMethod(i, this, appdomain);
-                    lst.Add(m);
-                }
-            }
-
-            if (staticConstructor != null && (!TypeReference.HasGenericParameters || IsGenericInstance))
-            {
-                appdomain.Invoke(staticConstructor, null, null);
-            }
-        }
-
-        public IMethod GetVirtualMethod(IMethod method)
-        {
-            IType[] genericArguments = null;
-            if (method.IsGenericInstance)
-            {
-                if (method is ILMethod)
-                {
-                    genericArguments = ((ILMethod)method).GenericArugmentsArray;
-                }
-                else
-                {
-                    genericArguments = ((CLRMethod)method).GenericArguments;
-                }
-            }
-
-            var m = GetMethod(method.Name, method.Parameters, genericArguments, method.ReturnType, true);
-            if (m == null && method.DeclearingType.IsInterface)
-            {
-                m = GetMethod(string.Format("{0}.{1}", method.DeclearingType.FullName, method.Name), method.Parameters, genericArguments, method.ReturnType, true);
-            }
-
-            if (m == null)
-            {
-                if (BaseType != null)
-                {
-                    return BaseType.GetVirtualMethod(method);
-                }
-                else
-                    return null;//BaseType == null means base type is Object or Enum
-            }
-            else if (m.IsGenericInstance == method.IsGenericInstance)
-                return m;
-            else
-                return method;
-        }
-
-        public IMethod GetMethod(string name, List<IType> param, IType[] genericArguments, IType returnType = null, bool declaredOnly = false)
-        {
-            if (methods == null)
-                InitializeMethods();
-            List<ILMethod> lst;
-            IMethod genericMethod = null;
-            if (methods.TryGetValue(name, out lst))
-            {
-                for (var idx = 0; idx < lst.Count; idx++)
-                {
-                    var i = lst[idx];
-                    int pCnt = param != null ? param.Count : 0;
-                    if (i.ParameterCount == pCnt)
-                    {
-                        bool match = true;
-                        if (genericArguments != null && i.GenericParameterCount == genericArguments.Length && genericMethod == null)
-                        {
-                            genericMethod = CheckGenericParams(i, param, ref match);
-                        }
-                        else
-                        {
-                            match = CheckGenericArguments(i, genericArguments);
-                            if (!match)
-                                continue;
-                            for (int j = 0; j < pCnt; j++)
-                            {
-                                if (param[j] != i.Parameters[j])
-                                {
-                                    match = false;
-                                    break;
-                                }
-                            }
-                            if (match)
-                            {
-                                match = returnType == null || i.ReturnType == returnType;
-                            }
-                            if (match)
-                                return i;
-                        }
-                    }
-                }
-            }
-            if (genericArguments != null && genericMethod != null)
-            {
-                var m = genericMethod.MakeGenericMethod(genericArguments);
-                lst.Add((ILMethod)m);
-                return m;
-            }
-            if (declaredOnly)
-                return null;
-            else
-            {
-                if (BaseType != null)
-                    return BaseType.GetMethod(name, param, genericArguments, returnType, false);
-                else
-                    return null;
-            }
-        }
-
-        bool CheckGenericArguments(ILMethod i, IType[] genericArguments)
-        {
-            if (genericArguments == null)
-            {
-                return i.GenericArguments == null;
-            }
-            else
-            {
-                if (i.GenericArguments == null)
-                    return false;
-                else if (i.GenericArguments.Length != genericArguments.Length)
-                    return false;
-                if (i.GenericArguments.Length == genericArguments.Length)
-                {
-                    for (int j = 0; j < genericArguments.Length; j++)
-                    {
-                        if (i.GenericArguments[j].Value != genericArguments[j])
-                            return false;
-                    }
-                    return true;
-                }
-                else
-                    return false;
-            }
-        }
-
-        ILMethod CheckGenericParams(ILMethod i, List<IType> param, ref bool match)
-        {
-            ILMethod genericMethod = null;
-            if (param != null)
-            {
-                for (int j = 0; j < param.Count; j++)
-                {
-                    var p = i.Parameters[j];
-                    if (p.IsByRef)
-                        p = p.ElementType;
-
-                    if (p.IsGenericParameter)
-                        continue;
-
-                    var p2 = param[j];
-                    if (p2.IsByRef)
-                        p2 = p2.ElementType;
-                    if (p.HasGenericParameter)
-                    {
-                        if(p.Name != p2.Name)
-                        {
-                            match = false;
-                            break;
-                        }
-                        //TODO should match the generic parameters;
-                        continue;
-                    }
-
-
-                    if (p2 != p)
-                    {
-                        match = false;
-                        break;
-                    }
-                }
-            }
-            if (match)
-            {
-                genericMethod = i;
-            }
-            return genericMethod;
-        }
-
-        public List<ILMethod> GetConstructors()
-        {
-            if (constructors == null)
-                InitializeMethods();
-            return constructors;
-        }
-
-        public IMethod GetStaticConstroctor()
-        {
-            if (constructors == null)
-                InitializeMethods();
-            return staticConstructor;
-        }
-
-        public IMethod GetConstructor(int paramCnt)
-        {
-            if (constructors == null)
-                InitializeMethods();
-            foreach (var i in constructors)
-            {
-                if (i.ParameterCount == paramCnt)
-                {
-                    return i;
-                }
-            }
-            return null;
-        }
-
-        public IMethod GetConstructor(List<IType> param)
-        {
-            if (constructors == null)
-                InitializeMethods();
-            foreach (var i in constructors)
-            {
-                if (i.ParameterCount == param.Count)
-                {
-                    bool match = true;
-
-                    for (int j = 0; j < param.Count; j++)
-                    {
-                        if (param[j] != i.Parameters[j])
-                        {
-                            match = false;
-                            break;
-                        }
-                    }
-
-                    if (match)
-                        return i;
-                }
-            }
-            return null;
-        }
-
-        public int GetFieldIndex(object token)
-        {
-            if (fieldMapping == null)
-                InitializeFields();
-            int idx;
-            int hashCode = token.GetHashCode();
-            if (fieldTokenMapping.TryGetValue(hashCode, out idx))
-                return idx;
-            FieldReference f = token as FieldReference;
-            if (staticFieldMapping != null && staticFieldMapping.TryGetValue(f.Name, out idx))
-            {
-                fieldTokenMapping[hashCode] = idx;
-                return idx;
-            }
-            if (fieldMapping.TryGetValue(f.Name, out idx))
-            {
-                fieldTokenMapping[hashCode] = idx;
-                return idx;
-            }
-
-            return -1;
-        }
-
-        public IType GetField(string name, out int fieldIdx)
-        {
-            if (fieldMapping == null)
-                InitializeFields();
-            if (fieldMapping.TryGetValue(name, out fieldIdx))
-            {
-                return fieldTypes[fieldIdx - FieldStartIndex];
-            }
-            else if (BaseType != null && BaseType is ILType)
-            {
-                return ((ILType)BaseType).GetField(name, out fieldIdx);
-            }
-            else
-                return null;
-        }
-
-        public IType GetField(int fieldIdx, out FieldDefinition fd)
-        {
-            if (fieldMapping == null)
-                InitializeFields();
-            if (fieldIdx < FieldStartIndex)
-                return ((ILType)BaseType).GetField(fieldIdx, out fd);
-            else
-            {
-                fd = fieldDefinitions[fieldIdx - FieldStartIndex];
-                return fieldTypes[fieldIdx - FieldStartIndex];
-            }
-        }
-
-        void InitializeFields()
-        {
-            fieldMapping = new Dictionary<string, int>();
-            if(definition == null)
-            {
-                fieldTypes = new IType[0];
-                fieldDefinitions = new FieldDefinition[0];
-            }
-            fieldTypes = new IType[definition.Fields.Count];
-            fieldDefinitions = new FieldDefinition[definition.Fields.Count];
-            var fields = definition.Fields;
-            int idx = FieldStartIndex;
-            int idxStatic = 0;
-            for (int i = 0; i < fields.Count; i++)
-            {
-                var field = fields[i];
-                if (field.IsStatic)
-                {
-                    //It makes no sence to initialize
-                    if (!TypeReference.HasGenericParameters || IsGenericInstance)
-                    {
-                        if (staticFieldTypes == null)
-                        {
-                            staticFieldTypes = new IType[definition.Fields.Count];
-                            staticFieldDefinitions = new FieldDefinition[definition.Fields.Count];
-                            staticFieldMapping = new Dictionary<string, int>();
-                        }
-                        staticFieldMapping[field.Name] = idxStatic;
-                        staticFieldDefinitions[idxStatic] = field;
-                        if (field.FieldType.IsGenericParameter)
-                        {
-                            staticFieldTypes[idxStatic] = FindGenericArgument(field.FieldType.Name);
-                        }
-                        else
-                            staticFieldTypes[idxStatic] = appdomain.GetType(field.FieldType, this, null);
-                        idxStatic++;
-                    }
-                }
-                else
-                {
-                    fieldMapping[field.Name] = idx;
-                    fieldDefinitions[idx - FieldStartIndex] = field;
-                    if (field.FieldType.IsGenericParameter)
-                    {
-                        fieldTypes[idx - FieldStartIndex] = FindGenericArgument(field.FieldType.Name);
-                    }
-                    else
-                        fieldTypes[idx - FieldStartIndex] = appdomain.GetType(field.FieldType, this, null);
-                    if (IsEnum)
-                    {
-                        enumType = fieldTypes[idx - FieldStartIndex];
-                    }
-                    idx++;
-                }
-            }
-            Array.Resize(ref fieldTypes, idx - FieldStartIndex);
-            Array.Resize(ref fieldDefinitions, idx - FieldStartIndex);
-
-            if (staticFieldTypes != null)
-            {
-                Array.Resize(ref staticFieldTypes, idxStatic);
-                Array.Resize(ref staticFieldDefinitions, idxStatic);
-                staticInstance = new ILTypeStaticInstance(this);
-            }
-        }
-
-        public IType FindGenericArgument(string key)
-        {
-            if (genericArguments != null)
-            {
-                foreach (var i in genericArguments)
-                {
-                    if (i.Key == key)
-                        return i.Value;
-                }
-            }
-            return null;
-        }
-
-        public bool CanAssignTo(IType type)
-        {
-            bool res = false;
-            if (this == type)
-            {
-                return true;
-            }
-
-            if (IsEnum)
-            {
-                if (type.TypeForCLR == typeof(Enum))
-                    return true;
-            }
-            if (BaseType != null)
-            {
-                res = BaseType.CanAssignTo(type);
-
-                if (res) return true;
-            }
-
-            if (Implements != null)
-            {
-                for (int i = 0; i < interfaces.Length; i++)
-                {
-                    var im = interfaces[i];
-                    res = im.CanAssignTo(type);
-                    if (res)
-                        return true;
-                }
-            }
-            return res;
-        }
-
-        public ILTypeInstance Instantiate(bool callDefaultConstructor = true)
-        {
-            var res = new ILTypeInstance(this);
-            if (callDefaultConstructor)
-            {
-                var m = GetConstructor(CLR.Utils.Extensions.EmptyParamList);
-                if (m != null)
-                {
-                    appdomain.Invoke(m, res, null);
-                }
-            }
-            return res;
-        }
-
-        public ILTypeInstance Instantiate(object[] args)
-        {
-            var res = new ILTypeInstance(this);
-            var argsTypes = new List<IType>(args.Length);
-            foreach (var o in args)
-            {
-                if (o is ILTypeInstance)
-                {
-                    argsTypes.Add(((ILTypeInstance)o).Type);
-                }
-                else
-                {
-                    argsTypes.Add(appdomain.GetType(o.GetType()));
-                }
-            }
-            var m = GetConstructor(argsTypes);
-            if (m != null)
-            {
-                appdomain.Invoke(m, res, args);
-            }
-
-            return res;
-        }
-
-        public IType MakeGenericInstance(KeyValuePair<string, IType>[] genericArguments)
-        {
-            if (genericInstances == null)
-                genericInstances = new List<ILType>();
-            foreach (var i in genericInstances)
-            {
-                bool match = true;
-                for (int j = 0; j < genericArguments.Length; j++)
-                {
-                    if (i.genericArguments[j].Value != genericArguments[j].Value)
-                    {
-                        match = false;
-                        break;
-                    }
-                }
-                if (match)
-                    return i;
-            }
-            var res = new ILType(definition, appdomain);
-            res.genericDefinition = this;
-            res.genericArguments = genericArguments;
-
-            genericInstances.Add(res);
-            return res;
-        }
-
-        public IType MakeByRefType()
-        {
-            if (byRefType == null)
-            {
-                var def = new ByReferenceType(typeRef);
-                byRefType = new ILType(def, appdomain);
-                ((ILType)byRefType).elementType = this;
-                ((ILType)byRefType).byRefCLRType = this.TypeForCLR.MakeByRefType();
-            }
-            return byRefType;
-        }
-
-        public IType MakeArrayType(int rank)
-        {
-            if (arrayTypes == null)
-                arrayTypes = new Dictionary<int, IType>();
-            IType atype;
-            if (!arrayTypes.TryGetValue(rank, out atype))
-            {
-                var def = new ArrayType(typeRef, rank);
-                atype = new ILType(def, appdomain);
-                ((ILType)atype).IsArray = true;
-                ((ILType)atype).elementType = this;
-                ((ILType)atype).arrayCLRType = rank > 1 ? this.TypeForCLR.MakeArrayType(rank) : this.TypeForCLR.MakeArrayType();
-                arrayTypes[rank] = atype;
-            }
-            return atype;
-        }
-
-        public IType ResolveGenericType(IType contextType)
-        {
-            var ga = contextType.GenericArguments;
-            if (definition == null)
-                return null;
-            IType[] kv = new IType[definition.GenericParameters.Count];
-            for (int i = 0; i < kv.Length; i++)
-            {
-                var gp = definition.GenericParameters[i];
-                string name = gp.Name;
-                foreach (var j in ga)
-                {
-                    if (j.Key == name)
-                    {
-                        kv[i] = j.Value;
-                        break;
-                    }
-                }
-            }
-
-            foreach (var i in genericInstances)
-            {
-                bool match = true;
-                for (int j = 0; j < kv.Length; j++)
-                {
-                    if (i.genericArguments[j].Value != kv[j])
-                    {
-                        match = false;
-                        break;
-                    }
-                }
-                if (match)
-                    return i;
-            }
-
-            return null;
-        }
-
-        public int GetStaticFieldSizeInMemory(HashSet<object> traversed)
-        {
-            return staticInstance != null ? staticInstance.GetSizeInMemory(traversed) : 0;
-        }
-
-        public unsafe int GetMethodBodySizeInMemory()
-        {
-            int size = 0;
-            if(methods != null)
-            {
-                foreach(var i in methods)
-                {
-                    foreach(var j in i.Value)
-                    {
-                        if (j.HasBody)
-                        {
-                            size += j.Body.Length * sizeof(Runtime.Intepreter.OpCodes.OpCode);
-                        }
-                    }
-                }
-            }
-            return size;
-        }
-
-        public override int GetHashCode()
-        {
-            if (hashCode == -1)
-                hashCode = System.Threading.Interlocked.Add(ref instance_id, 1);
-            return hashCode;
-        }
-
-        public override string ToString()
-        {
-            return FullName;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/ILType.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: a657d8c53554fdb498c23061939379d5
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 90
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/IType.cs

@@ -1,90 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using ILRuntime.CLR.Method;
-
-namespace ILRuntime.CLR.TypeSystem
-{
-    public interface IType
-    {
-        bool IsGenericInstance { get; }
-        KeyValuePair<string, IType>[] GenericArguments { get; }
-        Type TypeForCLR { get; }
-        Type ReflectionType { get; }
-
-        IType BaseType { get; }
-
-        IType[] Implements { get; }
-
-        IType ByRefType { get; }
-
-        IType ArrayType { get; }
-
-        string FullName { get; }
-
-        string Name { get; }
-
-        bool IsArray { get; }
-
-        int ArrayRank { get; }
-
-        bool IsValueType { get; }
-
-        bool IsDelegate { get; }
-
-        bool IsPrimitive { get; }
-
-        bool IsEnum { get; }
-
-        bool IsByRef { get; }
-
-        bool IsInterface { get; }
-
-        IType ElementType { get; }
-
-        bool HasGenericParameter { get; }
-
-        bool IsGenericParameter { get; }
-
-        ILRuntime.Runtime.Enviorment.AppDomain AppDomain { get; }
-
-        /// <summary>
-        /// Get a specified Method in this type
-        /// </summary>
-        /// <param name="name">Name of the Type</param>
-        /// <param name="paramCount">Parameter count</param>
-        /// <param name="declaredOnly">True to search the methods decleared in this type only, false to search base types.</param>
-        /// <returns></returns>
-        IMethod GetMethod(string name, int paramCount, bool declaredOnly = false);
-        /// <summary>
-        ///  Get a specified Method in this type
-        /// </summary>
-        /// <param name="name">Name of the Type</param>
-        /// <param name="param">List of parameter's types</param>
-        /// <param name="genericArguments">List of Generic Arguments</param>
-        /// <param name="returnType">Return Type</param>
-        /// <param name="declaredOnly">True to search the methods decleared in this type only, false to search base types.</param>
-        /// <returns></returns>
-        IMethod GetMethod(string name, List<IType> param, IType[] genericArguments, IType returnType = null, bool declaredOnly = false);
-        IMethod GetVirtualMethod(IMethod method);
-
-        List<IMethod> GetMethods();
-
-        int GetFieldIndex(object token);
-
-        IMethod GetConstructor(List<IType> param);
-
-        bool CanAssignTo(IType type);
-
-        IType MakeGenericInstance(KeyValuePair<string, IType>[] genericArguments);
-
-        IType MakeByRefType();
-
-        IType MakeArrayType(int rank);
-        IType FindGenericArgument(string key);
-
-        IType ResolveGenericType(IType contextType);
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/TypeSystem/IType.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 2d59f9c8b6bc1b542a95502fa20ddea8
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Utils.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 5f09998325ae1e74e82ad6cb5c0b6897
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 306
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Utils/Extensions.cs

@@ -1,306 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.CLR.Method;
-using ILRuntime.Other;
-using Mono.Cecil;
-using ILRuntime.Runtime.Intepreter;
-using System.Reflection;
-
-namespace ILRuntime.CLR.Utils
-{
-    public delegate TResult Func<T1, T2, T3, T4, T5, TResult>(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
-
-    public static class Extensions
-    {
-        public static List<IType> EmptyParamList = new List<IType>();
-        public static List<IType> GetParamList(this MethodReference def, ILRuntime.Runtime.Enviorment.AppDomain appdomain, IType contextType, IMethod contextMethod, IType[] genericArguments)
-        {
-            if (def.HasParameters)
-            {
-                List<IType> param = new List<IType>();
-                var dt = appdomain.GetType(def.DeclaringType, contextType, contextMethod);
-                foreach (var i in def.Parameters)
-                {
-                    IType t = null;
-                    t = appdomain.GetType(i.ParameterType, dt, null);
-                    if ((t == null && def.IsGenericInstance) || (t != null && t.HasGenericParameter))
-                    {
-                        GenericInstanceMethod gim = (GenericInstanceMethod)def;
-                        string name = i.ParameterType.IsByReference ? ((ByReferenceType)i.ParameterType).ElementType.FullName : i.ParameterType.FullName;
-                        
-                        for (int j = 0; j < gim.GenericArguments.Count; j++)
-                        {
-                            var gp = gim.ElementMethod.GenericParameters[j];
-                            var ga = gim.GenericArguments[j];
-                            if (name == gp.Name)
-                            {
-                                t = appdomain.GetType(ga, contextType, contextMethod);
-                                if (t == null && genericArguments != null)
-                                    t = genericArguments[j];
-                                break;
-                            }
-                            else if (name.Contains(gp.Name))
-                            {
-                                t = appdomain.GetType(ga, contextType, contextMethod);
-                                if (t == null && genericArguments != null)
-                                    t = genericArguments[j];
-                                if (name == gp.Name + "[]")
-                                {
-                                    name = t.FullName + "[]";
-                                }
-                                else
-                                {
-                                    /*name = name.Replace("<" + gp.Name + ">", "<" + ga.FullName + ">");
-                                    name = name.Replace("<" + gp.Name + "[", "<" + ga.FullName + "[");
-                                    name = name.Replace("<" + gp.Name + ",", "<" + ga.FullName + ",");
-                                    name = name.Replace("," + gp.Name + ">", "," + ga.FullName + ">");
-                                    name = name.Replace("," + gp.Name + "[", "," + ga.FullName + "[");
-                                    name = name.Replace("," + gp.Name + ",", "," + ga.FullName + ",");
-                                    name = name.Replace("," + gp.Name + "[", "," + ga.FullName + "[");*/
-                                    name = ReplaceGenericArgument(name, gp.Name, t.FullName);
-                                }
-                                t = null;
-                            }
-                        }
-                        if(dt.GenericArguments != null)
-                        {
-                            foreach(var gp in dt.GenericArguments)
-                            {
-                                if (name.Contains(gp.Key))
-                                {
-                                    name = ReplaceGenericArgument(name, gp.Key, gp.Value.FullName);
-                                }
-                            }
-                        }
-                        if (t == null)
-                            t = appdomain.GetType(name);
-                        if (t != null && i.ParameterType.IsByReference)
-                            t = t.MakeByRefType();
-                    }
-
-                    param.Add(t);
-                }
-                return param;
-            }
-            else
-                return EmptyParamList;
-        }
-
-        static string ReplaceGenericArgument(string typename, string argumentName, string argumentType, bool isGA = false)
-        {
-            string baseType;
-            StringBuilder sb = new StringBuilder();
-            List<string> ga;
-            bool isArray;
-            Runtime.Enviorment.AppDomain.ParseGenericType(typename, out baseType, out ga, out isArray);
-            bool hasGA = ga != null && ga.Count > 0;
-            if (baseType == argumentName)
-            {
-                bool isAssemblyQualified = argumentName.Contains('=');
-                if (isGA && isAssemblyQualified)
-                    sb.Append('[');
-                sb.Append(argumentType);
-                if (isGA && isAssemblyQualified)
-                    sb.Append(']');
-            }
-            else
-            {
-                bool isAssemblyQualified = baseType.Contains('=');
-                if (isGA && !hasGA && isAssemblyQualified)
-                    sb.Append('[');
-                sb.Append(baseType);
-                if (isGA && !hasGA && isAssemblyQualified)
-                    sb.Append(']');
-            }
-            if (hasGA)
-            {
-                sb.Append("[");
-                bool isFirst = true;
-                foreach (var i in ga)
-                {
-                    if (isFirst)
-                        isFirst = false;
-                    else
-                        sb.Append(",");
-                    sb.Append(ReplaceGenericArgument(i, argumentName, argumentType, true));
-                }
-                sb.Append("]");
-            }
-            if (isArray)
-                sb.Append("[]");
-            return sb.ToString();
-        }
-
-        [Flags]
-        public enum TypeFlags
-        {
-            Default = 0,
-            IsPrimitive = 0x1,
-            IsByRef = 0x2,
-            IsEnum = 0x4,
-            IsDelegate = 0x8,
-            IsValueType = 0x10,
-        }
-
-        private static readonly Dictionary<Type, TypeFlags> typeFlags = new Dictionary<Type, TypeFlags>(new ByReferenceKeyComparer<Type>());
-
-        public static bool FastIsEnum(this Type pt)
-        {
-            return (pt.GetTypeFlags() & TypeFlags.IsEnum) != 0;
-        }
-
-        public static bool FastIsByRef(this Type pt)
-        {
-            return (pt.GetTypeFlags() & TypeFlags.IsByRef) != 0;
-        }
-
-        public static bool FastIsPrimitive(this Type pt)
-        {
-            return (pt.GetTypeFlags() & TypeFlags.IsPrimitive) != 0;
-        }
-
-        public static bool FastIsValueType(this Type pt)
-        {
-            return (pt.GetTypeFlags() & TypeFlags.IsValueType) != 0;
-        }
-
-        public static TypeFlags GetTypeFlags(this Type pt)
-        {
-            var result = TypeFlags.Default;
-
-            if (!typeFlags.TryGetValue(pt, out result))
-            {
-                if (pt.IsPrimitive)
-                {
-                    result |= TypeFlags.IsPrimitive;
-                }
-
-                if (pt == typeof(Delegate) || pt.IsSubclassOf(typeof(Delegate)))
-                {
-                    result |= TypeFlags.IsDelegate;
-                }
-
-                if (pt.IsByRef)
-                {
-                    result |= TypeFlags.IsByRef;
-                }
-
-                if (pt.IsEnum)
-                {
-                    result |= TypeFlags.IsEnum;
-                }
-
-                if (pt.IsValueType)
-                {
-                    result |= TypeFlags.IsValueType;
-                }
-
-                typeFlags[pt] = result;
-            }
-
-            return result;
-        }
-
-        public static object CheckCLRTypes(this Type pt, object obj)
-        {
-            if (obj == null)
-                return null;
-
-            var typeFlags = GetTypeFlags(pt);
-
-            if ((typeFlags & TypeFlags.IsPrimitive) != 0 && pt != typeof(int))
-            {
-                if (pt == typeof(bool) && !(obj is bool))
-                {
-                    obj = (int)obj == 1;
-                }
-                else if (pt == typeof(byte) && !(obj is byte))
-                    obj = (byte)(int)obj;
-                else if (pt == typeof(short) && !(obj is short))
-                    obj = (short)(int)obj;
-                else if (pt == typeof(char) && !(obj is char))
-                    obj = (char)(int)obj;
-                else if (pt == typeof(ushort) && !(obj is ushort))
-                    obj = (ushort)(int)obj;
-                else if (pt == typeof(uint) && !(obj is uint))
-                    obj = (uint)(int)obj;
-                else if (pt == typeof(sbyte) && !(obj is sbyte))
-                    obj = (sbyte)(int)obj;
-                else if (pt == typeof(ulong) && !(obj is ulong))
-                {
-                    obj = (ulong)(long)obj;
-                }
-            }
-            else if (obj is ILRuntime.Reflection.ILRuntimeWrapperType)
-            {
-                obj = ((ILRuntime.Reflection.ILRuntimeWrapperType)obj).RealType;
-            }
-            else if ((typeFlags & TypeFlags.IsDelegate) != 0)
-            {
-                if (obj is Delegate)
-                    return obj;
-                if (pt == typeof(Delegate))
-                    return ((IDelegateAdapter)obj).Delegate;
-                return ((IDelegateAdapter)obj).GetConvertor(pt);
-            }
-            else if ((typeFlags & TypeFlags.IsByRef) != 0)
-            {
-                return CheckCLRTypes(pt.GetElementType(), obj);
-            }
-            else if ((typeFlags & TypeFlags.IsEnum) != 0)
-            {
-                return Enum.ToObject(pt, obj);
-            }
-            else if (obj is ILTypeInstance)
-            {
-                var adapter = obj as IDelegateAdapter;
-
-                if (adapter != null && pt != typeof(ILTypeInstance))
-                {
-                    return adapter.Delegate;
-                }
-
-                if (!(obj is ILEnumTypeInstance))
-                {
-                    var ins = (ILTypeInstance)obj;
-                    /*if (ins.IsValueType)
-                        ins = ins.Clone();*/
-                    return ins.CLRInstance;
-                }
-            }
-            return obj;
-        }
-
-        public static bool CheckMethodParams(this MethodInfo m, Type[] args)
-        {
-            var arr = m.GetParameters();
-            if (arr.Length != args.Length) return false;
-            for (var i = 0; i < args.Length; i++)
-            {
-                var t1 = arr[i].ParameterType;
-                var t2 = args[i];
-                if (t1 != t2 || t1.IsByRef != t2.IsByRef)
-                    return false;
-            }
-            return true;
-        }
-
-        public static bool CheckMethodParams(this MethodInfo m, ParameterInfo[] args)
-        {
-            var arr = m.GetParameters();
-            if (arr.Length != args.Length) return false;
-            for (var i = 0; i < args.Length; i++)
-            {
-                var t1 = arr[i].ParameterType;
-                var t2 = args[i].ParameterType;
-                if (t1 != t2 || t1.IsByRef != t2.IsByRef)
-                    return false;
-            }
-            return true;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/CLR/Utils/Extensions.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: ed1e47ba193179f4b9f21caedbc1b605
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: c3d9e18bda0f1f54bb1ec400743f78ee
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 18
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ByReferenceKeyComparer.cs

@@ -1,18 +0,0 @@
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-
-namespace ILRuntime.Other
-{
-    class ByReferenceKeyComparer<T> : IEqualityComparer<T>
-    {
-        public bool Equals(T x, T y)
-        {
-            return object.ReferenceEquals(x, y);
-        }
-
-        public int GetHashCode(T obj)
-        {
-            return RuntimeHelpers.GetHashCode(obj);
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ByReferenceKeyComparer.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 85b57f58903421241b65cd2ffbcac7bf
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 9
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/DelegateExportAttribute.cs

@@ -1,9 +0,0 @@
-namespace ILRuntime.Other
-{
-    /// <summary>
-    /// A Delegate Custom Attr, It tells the CodeGenerationTools : this delegate need to register a delegate convertor,when generate ILRuntimeHelper.cs file.
-    /// </summary>
-    public class DelegateExportAttribute : System.Attribute
-    {
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/DelegateExportAttribute.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: eb007a85cca9ce54ea6e3b32ab7ddceb
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 10
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/NeedAdaptorAttribute.cs

@@ -1,10 +0,0 @@
-namespace ILRuntime.Other
-{
-    /// <summary>
-    /// A Class Custom Attr, It tells the CodeGenerationTools :there is a class need to generate an adaptor for ILScript
-    /// </summary>
-    public class NeedAdaptorAttribute : System.Attribute
-    {
-
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/NeedAdaptorAttribute.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: fd1e000bd78872247b5ee948842785e9
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 132
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ThreadSafeDictionary.cs

@@ -1,132 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Runtime.Versioning;
-using System.Threading;
-
-namespace ILRuntime.Other
-{
-    /// <summary>
-    /// A thread safe dictionary for internal use
-    /// </summary>
-    /// <typeparam name="K"></typeparam>
-    /// <typeparam name="V"></typeparam>
-    class ThreadSafeDictionary<K, V> : IDictionary<K, V>
-    {
-        Dictionary<K, V> dic = new Dictionary<K, V>();
-
-        public Dictionary<K,V> InnerDictionary { get { return dic; } }
-        public V this[K key]
-        {
-            get
-            {
-                lock(dic)
-                    return dic[key];
-            }
-
-            set
-            {
-               lock(dic)
-                    dic[key] = value;
-            }
-        }
-
-        public int Count
-        {
-            get
-            {
-                lock(dic)
-                    return dic.Count;
-            }
-        }
-
-        public bool IsReadOnly
-        {
-            get
-            {
-                lock(dic)
-                    return IsReadOnly;
-            }
-        }
-
-        public ICollection<K> Keys
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public ICollection<V> Values
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public void Add(KeyValuePair<K, V> item)
-        {
-            lock (dic)
-                 dic.Add(item.Key, item.Value);
-        }
-
-        public void Add(K key, V value)
-        {
-            lock(dic)
-                dic.Add(key, value);
-        }
-
-        public void Clear()
-        {
-            lock(dic)
-                dic.Clear();
-        }
-
-        public bool Contains(KeyValuePair<K, V> item)
-        {
-           lock(dic)
-                return dic.ContainsKey(item.Key);
-        }
-
-        public bool ContainsKey(K key)
-        {
-            lock(dic)
-                return dic.ContainsKey(key);
-        }
-
-        public void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex)
-        {
-            throw new NotImplementedException();
-        }
-
-        public IEnumerator<KeyValuePair<K, V>> GetEnumerator()
-        {
-            throw new NotImplementedException();
-        }
-
-        public bool Remove(KeyValuePair<K, V> item)
-        {
-            throw new NotImplementedException();
-        }
-
-        public bool Remove(K key)
-        {
-            lock(dic)
-                return dic.Remove(key);
-        }
-
-        public bool TryGetValue(K key, out V value)
-        {
-             lock(dic)
-                return dic.TryGetValue(key, out value);
-        }
-
-        IEnumerator IEnumerable.GetEnumerator()
-        {
-            throw new NotImplementedException();
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/ThreadSafeDictionary.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e45123ef096e7a446a6ccd805feaf05e
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 999
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/UncheckedList.cs

@@ -1,999 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Runtime.Versioning;
-using System.Threading;
-
-namespace ILRuntime.Other
-{
-    /// <summary>
-    /// This is a copy of the latest .NET framework 4.5 List implementation, with all extraneous checking removed.
-    /// </summary>
-    /// <typeparam name="T"></typeparam>
-    [Serializable]
-    public class UncheckedList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList, ICollection
-    {
-
-       private const int _defaultCapacity = 4;
-
-        private T[] _items;
-        private int _size;
-        private int _version;
-        [NonSerialized]
-        private Object _syncRoot;
-
-        private static readonly T[] _emptyArray = new T[0];
-
-        // Constructs a UncheckedList. The list is initially empty and has a capacity
-        // of zero. Upon adding the first element to the list the capacity is
-        // increased to _defaultCapacity, and then increased in multiples of two
-        // as required.
-        public UncheckedList()
-        {
-            _items = _emptyArray;
-        }
-
-        // Constructs a UncheckedList with a given initial capacity. The list is
-        // initially empty, but will have room for the given number of elements
-        // before any reallocations are required.
-        // 
-        public UncheckedList(int capacity)
-        {
-            if (capacity == 0)
-                _items = _emptyArray;
-            else
-                _items = new T[capacity];
-        }
-
-        // Constructs a UncheckedList, copying the contents of the given collection. The
-        // size and capacity of the new list will both be equal to the size of the
-        // given collection.
-        // 
-        public UncheckedList(IEnumerable<T> collection)
-        {
-            ICollection<T> c = collection as ICollection<T>;
-            if (c != null)
-            {
-                int count = c.Count;
-                if (count == 0)
-                {
-                    _items = _emptyArray;
-                }
-                else
-                {
-                    _items = new T[count];
-                    c.CopyTo(_items, 0);
-                    _size = count;
-                }
-            }
-            else
-            {
-                _size = 0;
-                _items = _emptyArray;
-                AddEnumerable(collection);
-            }
-        }
-
-        // Gets and sets the capacity of this list.  The capacity is the size of
-        // the internal array used to hold items.  When set, the internal 
-        // array of the list is reallocated to the given capacity.
-        // 
-        public int Capacity
-        {
-            get
-            {
-                return _items.Length;
-            }
-            set
-            {
-                if (value != _items.Length)
-                {
-                    if (value > 0)
-                    {
-                        T[] newItems = new T[value];
-                        if (_size > 0)
-                        {
-                            Array.Copy(_items, 0, newItems, 0, _size);
-                        }
-                        _items = newItems;
-                    }
-                    else
-                    {
-                        _items = _emptyArray;
-                    }
-                }
-            }
-        }
-
-        // Read-only property describing how many elements are in the UncheckedList.
-        public int Count
-        {
-            get
-            {
-                return _size;
-            }
-        }
-
-        bool System.Collections.IList.IsFixedSize
-        {
-            get { return false; }
-        }
-
-
-        // Is this UncheckedList read-only?
-        bool ICollection<T>.IsReadOnly
-        {
-            get { return false; }
-        }
-
-        bool System.Collections.IList.IsReadOnly
-        {
-            get { return false; }
-        }
-
-        // Is this UncheckedList synchronized (thread-safe)?
-        bool System.Collections.ICollection.IsSynchronized
-        {
-            get { return false; }
-        }
-
-        // Synchronization root for this object.
-        Object System.Collections.ICollection.SyncRoot
-        {
-            get
-            {
-                if (_syncRoot == null)
-                {
-                    System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
-                }
-                return _syncRoot;
-            }
-        }
-        // Sets or Gets the element at the given index.
-        // 
-        public T this[int index]
-        {
-            get
-            {
-                return _items[index];
-            }
-
-            set
-            {
-                _items[index] = value;
-                _version++;
-            }
-        }
-
-        private static bool IsCompatibleObject(object value)
-        {
-            // Non-null values are fine.  Only accept nulls if T is a class or Nullable<U>.
-            // Note that default(T) is not equal to null for value types except when T is Nullable<U>. 
-            return ((value is T) || (value == null && default(T) == null));
-        }
-
-        Object System.Collections.IList.this[int index]
-        {
-            get
-            {
-                return this[index];
-            }
-            set
-            {
-                try
-                {
-                    this[index] = (T)value;
-                }
-                catch (InvalidCastException)
-                {
-                }
-            }
-        }
-
-        // Adds the given object to the end of this list. The size of the list is
-        // increased by one. If required, the capacity of the list is doubled
-        // before adding the new element.
-        public void Add(T item)
-        {
-            var array = _items;
-            var size = _size;
-            _version++;
-            if ((uint)size < (uint)array.Length)
-            {
-                _size = size + 1;
-                array[size] = item;
-            }
-            else
-            {
-                AddWithResize(item);
-            }
-        }
-
-        // Non-inline from UncheckedList.Add to improve its code quality as uncommon path
-        private void AddWithResize(T item)
-        {
-            var size = _size;
-            EnsureCapacity(size + 1);
-            _size = size + 1;
-            _items[size] = item;
-        }
-
-        int System.Collections.IList.Add(Object item)
-        {
-            try
-            {
-                Add((T)item);
-            }
-            catch (InvalidCastException)
-            {
-            }
-
-            return Count - 1;
-        }
-
-
-        // Adds the elements of the given collection to the end of this list. If
-        // required, the capacity of the list is increased to twice the previous
-        // capacity or the new size, whichever is larger.
-        //
-        public void AddRange(IEnumerable<T> collection)
-        {
-            InsertRange(_size, collection);
-        }
-
-        public ReadOnlyCollection<T> AsReadOnly()
-        {
-            return new ReadOnlyCollection<T>(this);
-        }
-
-        // Searches a section of the list for a given element using a binary search
-        // algorithm. Elements of the list are compared to the search value using
-        // the given IComparer interface. If comparer is null, elements of
-        // the list are compared to the search value using the IComparable
-        // interface, which in that case must be implemented by all elements of the
-        // list and the given search value. This method assumes that the given
-        // section of the list is already sorted; if this is not the case, the
-        // result will be incorrect.
-        //
-        // The method returns the index of the given value in the list. If the
-        // list does not contain the given value, the method returns a negative
-        // integer. The bitwise complement operator (~) can be applied to a
-        // negative result to produce the index of the first element (if any) that
-        // is larger than the given search value. This is also the index at which
-        // the search value should be inserted into the list in order for the list
-        // to remain sorted.
-        // 
-        // The method uses the Array.BinarySearch method to perform the
-        // search.
-        // 
-        public int BinarySearch(int index, int count, T item, IComparer<T> comparer)
-        {
-            if (index < 0) return -1;
-            return Array.BinarySearch<T>(_items, index, count, item, comparer);
-        }
-
-        public int BinarySearch(T item)
-        {
-            return BinarySearch(0, Count, item, null);
-        }
-
-        public int BinarySearch(T item, IComparer<T> comparer)
-        {
-            return BinarySearch(0, Count, item, comparer);
-        }
-
-
-        // Clears the contents of UncheckedList.
-        public void Clear()
-        {
-            if (!typeof(T).IsValueType)
-            {
-                int size = _size;
-                _size = 0;
-                _version++;
-                if (size > 0)
-                {
-                    Array.Clear(_items, 0, size); // Clear the elements so that the gc can reclaim the references.
-                }
-            }
-            else
-            {
-                _size = 0;
-                _version++;
-            }
-        }
-
-        // Contains returns true if the specified element is in the UncheckedList.
-        // It does a linear, O(n) search.  Equality is determined by calling
-        // EqualityComparer<T>.Default.Equals().
-
-        public bool Contains(T item)
-        {
-            // PERF: IndexOf calls Array.IndexOf, which internally
-            // calls EqualityComparer<T>.Default.IndexOf, which
-            // is specialized for different types. This
-            // boosts performance since instead of making a
-            // virtual method call each iteration of the loop,
-            // via EqualityComparer<T>.Default.Equals, we
-            // only make one virtual call to EqualityComparer.IndexOf.
-
-            return _size != 0 && IndexOf(item) != -1;
-        }
-
-        bool System.Collections.IList.Contains(Object item)
-        {
-            if (IsCompatibleObject(item))
-            {
-                return Contains((T)item);
-            }
-            return false;
-        }
-
-        public UncheckedList<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
-        {
-            UncheckedList<TOutput> list = new UncheckedList<TOutput>(_size);
-            for (int i = 0; i < _size; i++)
-            {
-                list._items[i] = converter(_items[i]);
-            }
-            list._size = _size;
-            return list;
-        }
-
-        // Copies this UncheckedList into array, which must be of a 
-        // compatible array type.  
-        //
-        public void CopyTo(T[] array)
-        {
-            CopyTo(array, 0);
-        }
-
-        // Copies this UncheckedList into array, which must be of a 
-        // compatible array type.  
-        //
-        void System.Collections.ICollection.CopyTo(Array array, int arrayIndex)
-        {
-            try
-            {
-                // Array.Copy will check for NULL.
-                Array.Copy(_items, 0, array, arrayIndex, _size);
-            }
-            catch (ArrayTypeMismatchException)
-            {
-            }
-        }
-
-        // Copies a section of this list to the given array at the given index.
-        // 
-        // The method uses the Array.Copy method to copy the elements.
-        // 
-        public void CopyTo(int index, T[] array, int arrayIndex, int count)
-        {
-            // Delegate rest of error checking to Array.Copy.
-            Array.Copy(_items, index, array, arrayIndex, count);
-        }
-
-        public void CopyTo(T[] array, int arrayIndex)
-        {
-            // Delegate rest of error checking to Array.Copy.
-            Array.Copy(_items, 0, array, arrayIndex, _size);
-        }
-
-        // Ensures that the capacity of this list is at least the given minimum
-        // value. If the current capacity of the list is less than min, the
-        // capacity is increased to twice the current capacity or to min,
-        // whichever is larger.
-        private void EnsureCapacity(int min)
-        {
-            if (_items.Length < min)
-            {
-                int newCapacity = _items.Length == 0 ? _defaultCapacity : _items.Length * 2;
-                // Allow the list to grow to maximum possible capacity (~2G elements) before encountering overflow.
-                // Note that this check works even when _items.Length overflowed thanks to the (uint) cast
-                if ((uint) newCapacity > Int32.MaxValue) newCapacity = Int32.MaxValue;
-                if (newCapacity < min) newCapacity = min;
-                Capacity = newCapacity;
-            }
-        }
-
-        public bool Exists(Predicate<T> match)
-        {
-            return FindIndex(match) != -1;
-        }
-
-        public T Find(Predicate<T> match)
-        {
-            for (int i = 0; i < _size; i++)
-            {
-                if (match(_items[i]))
-                {
-                    return _items[i];
-                }
-            }
-            return default(T);
-        }
-
-        public UncheckedList<T> FindAll(Predicate<T> match)
-        {
-            UncheckedList<T> list = new UncheckedList<T>();
-            for (int i = 0; i < _size; i++)
-            {
-                if (match(_items[i]))
-                {
-                    list.Add(_items[i]);
-                }
-            }
-            return list;
-        }
-
-        public int FindIndex(Predicate<T> match)
-        {
-            return FindIndex(0, _size, match);
-        }
-
-        public int FindIndex(int startIndex, Predicate<T> match)
-        {
-            return FindIndex(startIndex, _size - startIndex, match);
-        }
-
-        public int FindIndex(int startIndex, int count, Predicate<T> match)
-        {
-            int endIndex = startIndex + count;
-            for (int i = startIndex; i < endIndex; i++)
-            {
-                if (match(_items[i])) return i;
-            }
-            return -1;
-        }
-
-        public T FindLast(Predicate<T> match)
-        {
-            for (int i = _size - 1; i >= 0; i--)
-            {
-                if (match(_items[i]))
-                {
-                    return _items[i];
-                }
-            }
-            return default(T);
-        }
-
-        public int FindLastIndex(Predicate<T> match)
-        {
-            return FindLastIndex(_size - 1, _size, match);
-        }
-
-        public int FindLastIndex(int startIndex, Predicate<T> match)
-        {
-            return FindLastIndex(startIndex, startIndex + 1, match);
-        }
-
-        public int FindLastIndex(int startIndex, int count, Predicate<T> match)
-        {
-            int endIndex = startIndex - count;
-            for (int i = startIndex; i > endIndex; i--)
-            {
-                if (match(_items[i]))
-                {
-                    return i;
-                }
-            }
-            return -1;
-        }
-
-        public void ForEach(Action<T> action)
-        {
-            int version = _version;
-
-            for (int i = 0; i < _size; i++)
-            {
-                if (version != _version)
-                {
-                    break;
-                }
-                action(_items[i]);
-            }
-        }
-
-        // Returns an enumerator for this list with the given
-        // permission for removal of elements. If modifications made to the list 
-        // while an enumeration is in progress, the MoveNext and 
-        // GetObject methods of the enumerator will throw an exception.
-        //
-        public Enumerator GetEnumerator()
-        {
-            return new Enumerator(this);
-        }
-
-        IEnumerator<T> IEnumerable<T>.GetEnumerator()
-        {
-            return new Enumerator(this);
-        }
-
-        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
-        {
-            return new Enumerator(this);
-        }
-
-        public UncheckedList<T> GetRange(int index, int count)
-        {
-            UncheckedList<T> list = new UncheckedList<T>(count);
-            Array.Copy(_items, index, list._items, 0, count);
-            list._size = count;
-            return list;
-        }
-
-
-        // Returns the index of the first occurrence of a given value in a range of
-        // this list. The list is searched forwards from beginning to end.
-        // The elements of the list are compared to the given value using the
-        // Object.Equals method.
-        // 
-        // This method uses the Array.IndexOf method to perform the
-        // search.
-        // 
-        public int IndexOf(T item)
-        {
-            return Array.IndexOf(_items, item, 0, _size);
-        }
-
-        int System.Collections.IList.IndexOf(Object item)
-        {
-            if (IsCompatibleObject(item))
-            {
-                return IndexOf((T)item);
-            }
-            return -1;
-        }
-
-        // Returns the index of the first occurrence of a given value in a range of
-        // this list. The list is searched forwards, starting at index
-        // index and ending at count number of elements. The
-        // elements of the list are compared to the given value using the
-        // Object.Equals method.
-        // 
-        // This method uses the Array.IndexOf method to perform the
-        // search.
-        // 
-        public int IndexOf(T item, int index)
-        {
-            return Array.IndexOf(_items, item, index, _size - index);
-        }
-
-        // Returns the index of the first occurrence of a given value in a range of
-        // this list. The list is searched forwards, starting at index
-        // index and upto count number of elements. The
-        // elements of the list are compared to the given value using the
-        // Object.Equals method.
-        // 
-        // This method uses the Array.IndexOf method to perform the
-        // search.
-        // 
-        public int IndexOf(T item, int index, int count)
-        {
-            return Array.IndexOf(_items, item, index, count);
-        }
-
-        // Inserts an element into this list at a given index. The size of the list
-        // is increased by one. If required, the capacity of the list is doubled
-        // before inserting the new element.
-        // 
-        public void Insert(int index, T item)
-        {
-            if (_size == _items.Length) EnsureCapacity(_size + 1);
-            if (index < _size)
-            {
-                Array.Copy(_items, index, _items, index + 1, _size - index);
-            }
-            _items[index] = item;
-            _size++;
-            _version++;
-        }
-
-        void System.Collections.IList.Insert(int index, Object item)
-        {
-            try
-            {
-                Insert(index, (T)item);
-            }
-            catch (InvalidCastException)
-            {
-            }
-        }
-
-        // Inserts the elements of the given collection at a given index. If
-        // required, the capacity of the list is increased to twice the previous
-        // capacity or the new size, whichever is larger.  Ranges may be added
-        // to the end of the list by setting index to the UncheckedList's size.
-        //
-        public void InsertRange(int index, IEnumerable<T> collection)
-        {
-            ICollection<T> c = collection as ICollection<T>;
-            if (c != null)
-            {    // if collection is ICollection<T>
-                int count = c.Count;
-                if (count > 0)
-                {
-                    EnsureCapacity(_size + count);
-                    if (index < _size)
-                    {
-                        Array.Copy(_items, index, _items, index + count, _size - index);
-                    }
-
-                    // If we're inserting a UncheckedList into itself, we want to be able to deal with that.
-                    if (this == c)
-                    {
-                        // Copy first part of _items to insert location
-                        Array.Copy(_items, 0, _items, index, index);
-                        // Copy last part of _items back to inserted location
-                        Array.Copy(_items, index + count, _items, index * 2, _size - index);
-                    }
-                    else
-                    {
-                        c.CopyTo(_items, index);
-                    }
-                    _size += count;
-                }
-            }
-            else if (index < _size)
-            {
-                // We're inserting a lazy enumerable. Call Insert on each of the constituent items.
-                using (IEnumerator<T> en = collection.GetEnumerator())
-                {
-                    while (en.MoveNext())
-                    {
-                        Insert(index++, en.Current);
-                    }
-                }
-            }
-            else
-            {
-                // We're adding a lazy enumerable because the index is at the end of this list.
-                AddEnumerable(collection);
-            }
-            _version++;
-        }
-
-        // Returns the index of the last occurrence of a given value in a range of
-        // this list. The list is searched backwards, starting at the end 
-        // and ending at the first element in the list. The elements of the list 
-        // are compared to the given value using the Object.Equals method.
-        // 
-        // This method uses the Array.LastIndexOf method to perform the
-        // search.
-        // 
-        public int LastIndexOf(T item)
-        {
-            if (_size == 0)
-            {  // Special case for empty list
-                return -1;
-            }
-            else
-            {
-                return LastIndexOf(item, _size - 1, _size);
-            }
-        }
-
-        // Returns the index of the last occurrence of a given value in a range of
-        // this list. The list is searched backwards, starting at index
-        // index and ending at the first element in the list. The 
-        // elements of the list are compared to the given value using the 
-        // Object.Equals method.
-        // 
-        // This method uses the Array.LastIndexOf method to perform the
-        // search.
-        // 
-        public int LastIndexOf(T item, int index)
-        {
-            return LastIndexOf(item, index, index + 1);
-        }
-
-        // Returns the index of the last occurrence of a given value in a range of
-        // this list. The list is searched backwards, starting at index
-        // index and upto count elements. The elements of
-        // the list are compared to the given value using the Object.Equals
-        // method.
-        // 
-        // This method uses the Array.LastIndexOf method to perform the
-        // search.
-        // 
-        public int LastIndexOf(T item, int index, int count)
-        {
-            if (_size == 0)
-            {  // Special case for empty list
-                return -1;
-            }
-
-            return Array.LastIndexOf(_items, item, index, count);
-        }
-
-        // Removes the element at the given index. The size of the list is
-        // decreased by one.
-        // 
-        public bool Remove(T item)
-        {
-            int index = IndexOf(item);
-            if (index >= 0)
-            {
-                RemoveAt(index);
-                return true;
-            }
-
-            return false;
-        }
-
-        void System.Collections.IList.Remove(Object item)
-        {
-            if (IsCompatibleObject(item))
-            {
-                Remove((T)item);
-            }
-        }
-
-        // This method removes all items which matches the predicate.
-        // The complexity is O(n).   
-        public int RemoveAll(Predicate<T> match)
-        {
-            int freeIndex = 0;   // the first free slot in items array
-
-            // Find the first item which needs to be removed.
-            while (freeIndex < _size && !match(_items[freeIndex])) freeIndex++;
-            if (freeIndex >= _size) return 0;
-
-            int current = freeIndex + 1;
-            while (current < _size)
-            {
-                // Find the first item which needs to be kept.
-                while (current < _size && match(_items[current])) current++;
-
-                if (current < _size)
-                {
-                    // copy item to the free slot.
-                    _items[freeIndex++] = _items[current++];
-                }
-            }
-
-            if (!typeof(T).IsValueType)
-            {
-                Array.Clear(_items, freeIndex, _size - freeIndex); // Clear the elements so that the gc can reclaim the references.
-            }
-
-            int result = _size - freeIndex;
-            _size = freeIndex;
-            _version++;
-            return result;
-        }
-
-        // Removes the element at the given index. The size of the list is
-        // decreased by one.
-        // 
-        public void RemoveAt(int index)
-        {
-            _size--;
-            if (index < _size)
-            {
-                Array.Copy(_items, index + 1, _items, index, _size - index);
-            }
-            if (!typeof(T).IsValueType)
-            {
-                _items[_size] = default(T);
-            }
-            _version++;
-        }
-
-        // Removes a range of elements from this list.
-        // 
-        public void RemoveRange(int index, int count)
-        {
-            if (count > 0)
-            {
-                int i = _size;
-                _size -= count;
-                if (index < _size)
-                {
-                    Array.Copy(_items, index + count, _items, index, _size - index);
-                }
-
-                _version++;
-                if (!typeof(T).IsValueType)
-                {
-                    Array.Clear(_items, _size, count);
-                }
-            }
-        }
-
-        // Reverses the elements in this list.
-        public void Reverse()
-        {
-            Reverse(0, Count);
-        }
-
-        // Reverses the elements in a range of this list. Following a call to this
-        // method, an element in the range given by index and count
-        // which was previously located at index i will now be located at
-        // index index + (index + count - i - 1).
-        // 
-        public void Reverse(int index, int count)
-        {
-            if (count > 1)
-            {
-                Array.Reverse(_items, index, count);
-            }
-            _version++;
-        }
-
-        // Sorts the elements in this list.  Uses the default comparer and 
-        // Array.Sort.
-        public void Sort()
-        {
-            Sort(0, Count, null);
-        }
-
-        // Sorts the elements in this list.  Uses Array.Sort with the
-        // provided comparer.
-        public void Sort(IComparer<T> comparer)
-        {
-            Sort(0, Count, comparer);
-        }
-
-        // Sorts the elements in a section of this list. The sort compares the
-        // elements to each other using the given IComparer interface. If
-        // comparer is null, the elements are compared to each other using
-        // the IComparable interface, which in that case must be implemented by all
-        // elements of the list.
-        // 
-        // This method uses the Array.Sort method to sort the elements.
-        // 
-        public void Sort(int index, int count, IComparer<T> comparer)
-        {
-            if (count > 1)
-            {
-                Array.Sort<T>(_items, index, count, comparer);
-            }
-            _version++;
-        }
-
-        public void Sort(Comparison<T> comparison)
-        {
-            throw new NotImplementedException();
-            /*if (_size > 1)
-            {
-                ArraySortHelper<T>.Sort(_items, 0, _size, comparison);
-            }
-            _version++;*/
-        }
-
-        // ToArray returns an array containing the contents of the UncheckedList.
-        // This requires copying the UncheckedList, which is an O(n) operation.
-        public T[] ToArray()
-        {
-            if (_size == 0)
-            {
-                return _emptyArray;
-            }
-
-            T[] array = new T[_size];
-            Array.Copy(_items, 0, array, 0, _size);
-            return array;
-        }
-
-        // Sets the capacity of this list to the size of the list. This method can
-        // be used to minimize a list's memory overhead once it is known that no
-        // new elements will be added to the list. To completely clear a list and
-        // release all memory referenced by the list, execute the following
-        // statements:
-        // 
-        // list.Clear();
-        // list.TrimExcess();
-        // 
-        public void TrimExcess()
-        {
-            int threshold = (int)(((double)_items.Length) * 0.9);
-            if (_size < threshold)
-            {
-                Capacity = _size;
-            }
-        }
-
-        public bool TrueForAll(Predicate<T> match)
-        {
-            for (int i = 0; i < _size; i++)
-            {
-                if (!match(_items[i]))
-                {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        private void AddEnumerable(IEnumerable<T> enumerable)
-        {
-            Debug.Assert(enumerable != null);
-            Debug.Assert(!(enumerable is ICollection<T>), "We should have optimized for this beforehand.");
-
-            using (IEnumerator<T> en = enumerable.GetEnumerator())
-            {
-                _version++; // Even if the enumerable has no items, we can update _version.
-
-                while (en.MoveNext())
-                {
-                    // Capture Current before doing anything else. If this throws
-                    // an exception, we want to make a clean break.
-                    T current = en.Current;
-
-                    if (_size == _items.Length)
-                    {
-                        EnsureCapacity(_size + 1);
-                    }
-
-                    _items[_size++] = current;
-                }
-            }
-        }
-
-        public struct Enumerator : IEnumerator<T>, System.Collections.IEnumerator
-        {
-            private UncheckedList<T> list;
-            private int index;
-            private int version;
-            private T current;
-
-            internal Enumerator(UncheckedList<T> list)
-            {
-                this.list = list;
-                index = 0;
-                version = list._version;
-                current = default(T);
-            }
-
-            public void Dispose()
-            {
-            }
-
-            public bool MoveNext()
-            {
-                UncheckedList<T> localUncheckedList = list;
-
-                if (version == localUncheckedList._version && ((uint)index < (uint)localUncheckedList._size))
-                {
-                    current = localUncheckedList._items[index];
-                    index++;
-                    return true;
-                }
-                return MoveNextRare();
-            }
-
-            private bool MoveNextRare()
-            {
-                index = list._size + 1;
-                current = default(T);
-                return false;
-            }
-
-            public T Current
-            {
-                get
-                {
-                    return current;
-                }
-            }
-
-            Object System.Collections.IEnumerator.Current
-            {
-                get
-                {
-                    return Current;
-                }
-            }
-
-            void System.Collections.IEnumerator.Reset()
-            {
-                index = 0;
-                current = default(T);
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Other/UncheckedList.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: d923aa25f3f74d0489a9082f6a6c9942
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 4de0bdaa0e6ff7b4696881fd8240823e
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 79
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/Extensions.cs

@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using Mono.Cecil;
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.TypeSystem;
-
-namespace ILRuntime.Reflection
-{
-    static class Extensions
-    {
-        public static object CreateInstance(this CustomAttribute attribute, IType at, Runtime.Enviorment.AppDomain appdomain)
-        {
-            object ins;
-            List<IType> param = null;
-            if (at is ILType)
-            {
-                var it = (ILType)at;
-                if (!attribute.HasConstructorArguments)
-                    ins = it.Instantiate(true);
-                else
-                {
-                    ins = it.Instantiate(false);
-                    if (param == null)
-                        param = new List<IType>();
-                    param.Clear();
-                    object[] p = new object[attribute.ConstructorArguments.Count];
-                    for (int j = 0; j < attribute.ConstructorArguments.Count; j++)
-                    {
-                        var ca = attribute.ConstructorArguments[j];
-                        param.Add(appdomain.GetType(ca.Type, null, null));
-                        p[j] = ca.Value;
-                    }
-                    var ctor = it.GetConstructor(param);
-                    appdomain.Invoke(ctor, ins, p);
-                }
-
-                if (attribute.HasProperties)
-                {
-                    object[] p = new object[1];
-                    foreach (var j in attribute.Properties)
-                    {
-                        p[0] = j.Argument.Value;
-                        var setter = it.GetMethod("set_" + j.Name, 1);
-                        appdomain.Invoke(setter, ins, p);
-                    }
-                }
-            }
-            else
-            {
-                param = new List<IType>();
-                object[] p = null;
-                if (attribute.HasConstructorArguments)
-                {
-                    p = new object[attribute.ConstructorArguments.Count];
-                    for (int j = 0; j < attribute.ConstructorArguments.Count; j++)
-                    {
-                        var ca = attribute.ConstructorArguments[j];
-                        param.Add(appdomain.GetType(ca.Type, null, null));
-                        p[j] = ca.Value;
-                    }
-                }
-                ins = ((CLRMethod)at.GetConstructor(param)).ConstructorInfo.Invoke(p);
-                if (attribute.HasProperties)
-                {
-                    foreach (var j in attribute.Properties)
-                    {
-                        var prop = at.TypeForCLR.GetProperty(j.Name);
-                        prop.SetValue(ins, j.Argument.Value, null);
-                    }
-                }
-            }
-
-            return ins;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/Extensions.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: ccb5490caeef4b7419ab1fc0690f19bd
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 108
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeConstructorInfo.cs

@@ -1,108 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using System.Globalization;
-
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.TypeSystem;
-
-namespace ILRuntime.Reflection
-{
-    public class ILRuntimeConstructorInfo : ConstructorInfo
-    {
-        ILMethod method;
-        ILRuntimeParameterInfo[] parameters;
-        public ILRuntimeConstructorInfo(ILMethod m)
-        {
-            method = m;
-            parameters = new ILRuntimeParameterInfo[m.ParameterCount];
-            for(int i = 0; i < m.ParameterCount; i++)
-            {
-                var pd = m.Definition.Parameters[i];
-                parameters[i] = new ILRuntimeParameterInfo(pd, m.Parameters[i], this);
-            }
-        }
-
-        internal ILMethod ILMethod { get { return method; } }
-        public override MethodAttributes Attributes
-        {
-            get
-            {
-                return MethodAttributes.Public;
-            }
-        }
-
-        public override Type DeclaringType
-        {
-            get
-            {
-                return method.DeclearingType.ReflectionType;
-            }
-        }
-
-        public override RuntimeMethodHandle MethodHandle
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public override string Name
-        {
-            get
-            {
-                return method.Name;
-            }
-        }
-
-        public override Type ReflectedType
-        {
-            get
-            {
-                return method.DeclearingType.ReflectionType;
-            }
-        }
-
-        public override object[] GetCustomAttributes(bool inherit)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override object[] GetCustomAttributes(Type attributeType, bool inherit)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override MethodImplAttributes GetMethodImplementationFlags()
-        {
-            throw new NotImplementedException();
-        }
-
-        public override ParameterInfo[] GetParameters()
-        {
-            return parameters;
-        }
-
-        public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
-        {
-            var res = ((ILType)method.DeclearingType).Instantiate(false);
-            method.DeclearingType.AppDomain.Invoke(method, res, parameters);
-            return res;
-        }
-
-        public override bool IsDefined(Type attributeType, bool inherit)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
-        {
-            var res = ((ILType)method.DeclearingType).Instantiate(false);
-            method.DeclearingType.AppDomain.Invoke(method, res, parameters);
-            return res;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeConstructorInfo.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 205a4012c9bebf742b9ebdc7fcb24bff
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 228
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeFieldInfo.cs

@@ -1,228 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using System.Globalization;
-
-using Mono.Cecil;
-using ILRuntime.CLR.Utils;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.Runtime;
-using ILRuntime.Runtime.Stack;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-
-namespace ILRuntime.Reflection
-{
-    public class ILRuntimeFieldInfo : FieldInfo
-    {
-        System.Reflection.FieldAttributes attr;
-        ILRuntimeType dType;
-        ILType ilType;
-        IType fieldType;
-        bool isStatic;
-        int fieldIdx;
-        string name;
-        FieldDefinition definition;
-        Runtime.Enviorment.AppDomain appdomain;
-        object[] customAttributes;
-        Type[] attributeTypes;
-
-        public IType ILFieldType { get { return fieldType; } }
-
-        public ILRuntimeFieldInfo(FieldDefinition def, ILRuntimeType declaredType, bool isStatic, int fieldIdx)
-        {
-            definition = def;
-            this.name = def.Name;
-            dType = declaredType;
-            ilType = dType.ILType;
-            appdomain = ilType.AppDomain;
-            this.isStatic = isStatic;
-            this.fieldIdx = fieldIdx; 
-            if (isStatic)
-                attr |= System.Reflection.FieldAttributes.Static;
-            if (def.IsPublic)
-            {
-                attr |= System.Reflection.FieldAttributes.Public;
-            }
-            else
-                attr |= System.Reflection.FieldAttributes.Private;
-            fieldType = isStatic ? ilType.StaticFieldTypes[fieldIdx] : ilType.FieldTypes[fieldIdx];
-        }
-
-        public ILRuntimeFieldInfo(FieldDefinition def, ILRuntimeType declaredType, int fieldIdx, IType fieldType)
-        {
-            definition = def;
-            this.name = def.Name;
-            dType = declaredType;
-            ilType = dType.ILType;
-            appdomain = ilType.AppDomain;
-            this.isStatic = false;
-            this.fieldIdx = fieldIdx;
-            if (isStatic)
-                attr |= System.Reflection.FieldAttributes.Static;
-            if (def.IsPublic)
-            {
-                attr |= System.Reflection.FieldAttributes.Public;
-            }
-            else
-                attr |= System.Reflection.FieldAttributes.Private;
-            this.fieldType = fieldType;
-        }
-
-        void InitializeCustomAttribute()
-        {
-            customAttributes = new object[definition.CustomAttributes.Count];
-            attributeTypes = new Type[customAttributes.Length];
-            for (int i = 0; i < definition.CustomAttributes.Count; i++)
-            {
-                var attribute = definition.CustomAttributes[i];
-                var at = appdomain.GetType(attribute.AttributeType, null, null);
-                try
-                {
-                    object ins = attribute.CreateInstance(at, appdomain);
-
-                    attributeTypes[i] = at.ReflectionType;
-                    customAttributes[i] = ins;
-                }
-                catch
-                {
-                    attributeTypes[i] = typeof(Attribute);
-                }
-            }
-        }
-
-        public override System.Reflection.FieldAttributes Attributes
-        {
-            get
-            {
-                return attr;
-            }
-        }
-
-        public override Type DeclaringType
-        {
-            get
-            {
-                return dType;
-            }
-        }
-
-        public override RuntimeFieldHandle FieldHandle
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public override Type FieldType
-        {
-            get
-            {
-                return fieldType.ReflectionType;
-            }
-        }
-
-        public override string Name
-        {
-            get
-            {
-                return name;
-            }
-        }
-
-        public override Type ReflectedType
-        {
-            get
-            {
-                return fieldType.ReflectionType;
-            }
-        }
-
-        public override object[] GetCustomAttributes(bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-            return customAttributes;
-        }
-
-        public override object[] GetCustomAttributes(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-            List<object> res = new List<object>();
-            for (int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i].Equals(attributeType))
-                {
-                    res.Add(customAttributes[i]);
-                }
-            }
-            return res.ToArray();
-        }
-
-        public override object GetValue(object obj)
-        {
-            unsafe
-            {
-                StackObject esp;
-                ILTypeInstance ins;
-                if (isStatic)
-                {
-                    ins = ilType.StaticInstance;
-                }
-                else
-                {
-                    if (obj is ILTypeInstance)
-                        ins = (ILTypeInstance)obj;
-                    else
-                        ins = ((CrossBindingAdaptorType)obj).ILInstance;
-                }
-                return fieldType.TypeForCLR.CheckCLRTypes(ins[fieldIdx]);
-            }
-        }
-
-        public override bool IsDefined(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-
-            for (int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i].Equals(attributeType))
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
-        {
-            unsafe
-            {
-                StackObject esp;
-                if (value is CrossBindingAdaptorType)
-                    value = ((CrossBindingAdaptorType)value).ILInstance;
-                ILTypeInstance ins;
-                if (isStatic)
-                {
-                    ins = ilType.StaticInstance;
-                }
-                else
-                {
-                    if (obj is ILTypeInstance)
-                        ins = (ILTypeInstance)obj;
-                    else
-                        ins = ((CrossBindingAdaptorType)obj).ILInstance;
-                }
-                ins[fieldIdx] = value;
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeFieldInfo.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 05340a76bcd08e843b481e980988b984
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 173
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeMethodInfo.cs

@@ -1,173 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using System.Globalization;
-
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.Utils;
-
-namespace ILRuntime.Reflection
-{
-    public class ILRuntimeMethodInfo : MethodInfo
-    {
-        ILMethod method;
-        ILRuntimeParameterInfo[] parameters;
-        Mono.Cecil.MethodDefinition definition;
-        ILRuntime.Runtime.Enviorment.AppDomain appdomain;
-
-        object[] customAttributes;
-        Type[] attributeTypes;
-        public ILRuntimeMethodInfo(ILMethod m)
-        {
-            method = m;
-            definition = m.Definition;
-            appdomain = m.DeclearingType.AppDomain;
-            parameters = new ILRuntimeParameterInfo[m.ParameterCount];
-            for (int i = 0; i < m.ParameterCount; i++)
-            {
-                var pd = m.Definition.Parameters[i];
-                parameters[i] = new ILRuntimeParameterInfo(pd, m.Parameters[i], this);
-            }
-        }
-
-        void InitializeCustomAttribute()
-        {
-            customAttributes = new object[definition.CustomAttributes.Count];
-            attributeTypes = new Type[customAttributes.Length];
-            for (int i = 0; i < definition.CustomAttributes.Count; i++)
-            {
-                var attribute = definition.CustomAttributes[i];
-                var at = appdomain.GetType(attribute.AttributeType, null, null);
-                try
-                {
-                    object ins = attribute.CreateInstance(at, appdomain);
-
-                    attributeTypes[i] = at.ReflectionType;
-                    customAttributes[i] = ins;
-                }
-                catch
-                {
-                    attributeTypes[i] = typeof(Attribute);
-                }
-            }
-        }
-
-        internal ILMethod ILMethod { get { return method; } }
-        public override MethodAttributes Attributes
-        {
-            get
-            {
-                return MethodAttributes.Public;
-            }
-        }
-
-        public override Type DeclaringType
-        {
-            get
-            {
-                return method.DeclearingType.ReflectionType;
-            }
-        }
-
-        public override RuntimeMethodHandle MethodHandle
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public override string Name
-        {
-            get
-            {
-                return method.Name;
-            }
-        }
-
-        public override Type ReflectedType
-        {
-            get
-            {
-                return method.DeclearingType.ReflectionType;
-            }
-        }
-
-        public override ICustomAttributeProvider ReturnTypeCustomAttributes
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public override MethodInfo GetBaseDefinition()
-        {
-            return this;
-        }
-
-        public override object[] GetCustomAttributes(bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-            return customAttributes;
-        }
-
-        public override object[] GetCustomAttributes(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-            List<object> res = new List<object>();
-            for (int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i] == attributeType)
-                    res.Add(customAttributes[i]);
-            }
-            return res.ToArray();
-        }
-
-        public override MethodImplAttributes GetMethodImplementationFlags()
-        {
-            throw new NotImplementedException();
-        }
-
-        public override ParameterInfo[] GetParameters()
-        {
-            return parameters;
-        }
-
-        public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
-        {
-            if (method.HasThis)
-            {
-                var res = appdomain.Invoke(method, obj, parameters);
-                return ReturnType.CheckCLRTypes(res);
-            }
-            else
-                return appdomain.Invoke(method, null, parameters);
-        }
-
-        public override bool IsDefined(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-            for (int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i] == attributeType)
-                    return true;
-            }
-            return false;
-        }
-
-        public override Type ReturnType
-        {
-            get
-            {
-                return method.ReturnType.ReflectionType;
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeMethodInfo.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e975e373cbb39824c9dbf99b5b834f76
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 34
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeParameterInfo.cs

@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using System.Globalization;
-
-using ILRuntime.CLR.TypeSystem;
-
-namespace ILRuntime.Reflection
-{
-    public class ILRuntimeParameterInfo : ParameterInfo
-    {
-        IType type;
-        MethodBase method;
-        Mono.Cecil.ParameterDefinition definition;
-
-        public ILRuntimeParameterInfo(Mono.Cecil.ParameterDefinition definition, IType type, MethodBase method)
-        {
-            this.type = type;
-            this.method = method;
-            this.MemberImpl = method;
-            this.definition = definition;
-            NameImpl = definition.Name;
-        }
-        public override Type ParameterType
-        {
-            get
-            {
-                return type.ReflectionType;
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeParameterInfo.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: fb4bb43a033c2ee45b6957d7b7ae8b28
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 257
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimePropertyInfo.cs

@@ -1,257 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using System.Globalization;
-
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.TypeSystem;
-
-namespace ILRuntime.Reflection
-{
-    public class ILRuntimePropertyInfo : PropertyInfo
-    {
-        ILMethod getter, setter;
-        ILType dType;
-        Mono.Cecil.PropertyDefinition definition;
-        ILRuntime.Runtime.Enviorment.AppDomain appdomain;
-
-        object[] customAttributes;
-        Type[] attributeTypes;
-
-        public ILMethod Getter
-        {
-            get { return getter; }
-            set
-            {
-                getter = value;
-            }
-        }
-
-        public ILMethod Setter
-        {
-            get { return setter; }
-            set
-            {
-                setter = value;
-            }
-        }
-
-        public bool IsPublic
-        {
-            get
-            {
-                if (getter != null)
-                    return getter.Definition.IsPublic;
-                else
-                    return setter.Definition.IsPublic;
-            }
-        }
-
-        public bool IsStatic
-        {
-            get
-            {
-                if (getter != null)
-                    return getter.IsStatic;
-                else
-                    return setter.IsStatic;
-            }
-        }
-        public ILRuntimePropertyInfo(Mono.Cecil.PropertyDefinition definition, ILType dType)
-        {
-            this.definition = definition;
-            this.dType = dType;
-            appdomain = dType.AppDomain;
-        }
-
-        void InitializeCustomAttribute()
-        {
-            customAttributes = new object[definition.CustomAttributes.Count];
-            attributeTypes = new Type[customAttributes.Length];
-            for (int i = 0; i < definition.CustomAttributes.Count; i++)
-            {
-                var attribute = definition.CustomAttributes[i];
-                var at = appdomain.GetType(attribute.AttributeType, null, null);
-                try
-                {
-                    object ins = attribute.CreateInstance(at, appdomain);
-
-                    attributeTypes[i] = at.ReflectionType;
-                    customAttributes[i] = ins;
-                }
-                catch
-                {
-                    attributeTypes[i] = typeof(Attribute);
-                }
-            }
-        }
-
-        public override string Name
-        {
-            get
-            {
-                return definition.Name;
-            }
-        }
-
-        public override Type ReflectedType
-        {
-            get
-            {
-                return dType.ReflectionType;
-            }
-        }
-
-        public override PropertyAttributes Attributes
-        {
-            get
-            {
-                return PropertyAttributes.None;
-            }
-        }
-
-        public override bool CanRead
-        {
-            get
-            {
-                return getter != null;
-            }
-        }
-
-        public override bool CanWrite
-        {
-            get
-            {
-                return setter != null;
-            }
-        }
-
-        public override Type PropertyType
-        {
-            get
-            {
-                if (getter != null)
-                    return getter.ReturnType.ReflectionType;
-                else
-                {
-                    return setter.Parameters[0].ReflectionType;
-                }
-            }
-        }
-
-        public override Type DeclaringType
-        {
-            get
-            {
-                return dType.ReflectionType;
-            }
-        }
-
-        public override object[] GetCustomAttributes(bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-            return customAttributes;
-        }
-
-        public override object[] GetCustomAttributes(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-            List<object> res = new List<object>();
-            for (int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i].Equals(attributeType))
-                {
-                    res.Add(customAttributes[i]);
-                }
-            }
-            return res.ToArray();
-        }
-
-        public override bool IsDefined(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-            for (int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i].Equals(attributeType))
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        public override MethodInfo[] GetAccessors(bool nonPublic)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override MethodInfo GetGetMethod(bool nonPublic)
-        {
-            if (getter != null)
-                return getter.ReflectionMethodInfo;
-            return null;
-        }
-
-        public override ParameterInfo[] GetIndexParameters()
-        {
-            return new ParameterInfo[0];
-        }
-
-        public override MethodInfo GetSetMethod(bool nonPublic)
-        {
-            if (setter != null)
-                return setter.ReflectionMethodInfo;
-            return null;
-        }
-
-        public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
-        {
-            var indexCnt = index != null ? index.Length : 0;
-            if (getter.ParameterCount <= indexCnt)
-            {
-                using (var ctx = appdomain.BeginInvoke(getter))
-                {
-                    if (!IsStatic)
-                        ctx.PushObject(obj);
-                    for (int i = 0; i < getter.ParameterCount; i++)
-                    {
-                        ctx.PushObject(index[i], !getter.Parameters[i].IsValueType);
-                    }
-                    ctx.Invoke();
-                    return ctx.ReadObject(getter.ReturnType.TypeForCLR);
-                }
-            }
-            else
-                throw new ArgumentException("Index count mismatch");
-        }
-
-        public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
-        {
-            var indexCnt = index != null ? index.Length : 0;
-            if (setter.ParameterCount <= indexCnt + 1)
-            {
-                using (var ctx = appdomain.BeginInvoke(setter))
-                {
-                    if (!IsStatic)
-                        ctx.PushObject(obj);
-                    for (int i = 0; i < setter.ParameterCount - 1; i++)
-                    {
-                        ctx.PushObject(index[i], !setter.Parameters[i].IsValueType);
-                    }
-                    ctx.PushObject(value, !setter.Parameters[setter.ParameterCount - 1].IsValueType);
-                    ctx.Invoke();
-                }
-            }
-            else
-                throw new ArgumentException("Index count mismatch");
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimePropertyInfo.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 15c350fc8adaa6d43b32f054dacecead
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 586
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeType.cs

@@ -1,586 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Intepreter;
-
-namespace ILRuntime.Reflection
-{
-    public class ILRuntimeType : Type
-    {
-        ILType type;
-        Runtime.Enviorment.AppDomain appdomain;
-        object[] customAttributes;
-        Type[] attributeTypes;
-        ILRuntimeFieldInfo[] fields;
-        ILRuntimePropertyInfo[] properties;
-        ILRuntimeMethodInfo[] methods;
-
-        public ILType ILType { get { return type; } }
-
-        public ILRuntimeType(ILType t)
-        {
-            type = t;
-            appdomain = t.AppDomain;
-        }
-
-        void InitializeCustomAttribute()
-        {
-            if(type.TypeDefinition == null)
-            {
-                customAttributes = new object[0];
-                attributeTypes = new Type[0];
-                return;
-            }
-            customAttributes = new object[type.TypeDefinition.CustomAttributes.Count];
-            attributeTypes = new Type[customAttributes.Length];
-            for (int i = 0; i < type.TypeDefinition.CustomAttributes.Count; i++)
-            {
-                var attribute = type.TypeDefinition.CustomAttributes[i];
-                var at = appdomain.GetType(attribute.AttributeType, type, null);
-                try
-                {
-                    object ins = attribute.CreateInstance(at, appdomain);
-
-                    attributeTypes[i] = at.ReflectionType is ILRuntimeWrapperType ? at.TypeForCLR : at.ReflectionType;
-                    customAttributes[i] = ins;
-                }
-                catch
-                {
-                    attributeTypes[i] = typeof(Attribute);
-                }
-            }
-
-        }
-
-        void InitializeProperties()
-        {
-            if (type.TypeDefinition == null)
-            {
-                properties = new ILRuntimePropertyInfo[0];
-                return;
-            }
-            int cnt = type.TypeDefinition.HasProperties ? type.TypeDefinition.Properties.Count : 0;
-            properties = new ILRuntimePropertyInfo[cnt];
-            for (int i = 0; i < cnt; i++)
-            {
-                Mono.Cecil.PropertyDefinition pd = type.TypeDefinition.Properties[i];
-                ILRuntimePropertyInfo pi = new ILRuntimePropertyInfo(pd, type);
-                properties[i] = pi;
-                if (pd.GetMethod != null)
-                    pi.Getter = type.GetMethod(pd.GetMethod.Name, pd.GetMethod.Parameters.Count) as ILMethod;
-                if (pd.SetMethod != null)
-                    pi.Setter = type.GetMethod(pd.SetMethod.Name, pd.SetMethod.Parameters.Count) as ILMethod;
-            }
-        }
-
-        void InitializeMethods()
-        {
-            var methods = type.GetMethods();
-            this.methods = new ILRuntimeMethodInfo[methods.Count];
-            for(int i = 0; i < methods.Count; i++)
-            {
-                this.methods[i] = (ILRuntimeMethodInfo)((ILMethod)methods[i]).ReflectionMethodInfo;
-            }
-        }
-
-        public override Type MakeGenericType(params Type[] typeArguments)
-        {
-            if (ILType.TypeReference.HasGenericParameters)
-            {
-                KeyValuePair<string, IType>[] ga = new KeyValuePair<string, IType>[typeArguments.Length];
-                for (int i = 0; i < ga.Length; i++)
-                {
-                    string key = ILType.TypeReference.GenericParameters[0].Name;
-                    if (typeArguments[i] is ILRuntimeType)
-                        ga[i] = new KeyValuePair<string, IType>(key, ((ILRuntimeType)typeArguments[i]).ILType);
-                    else
-                        ga[i] = new KeyValuePair<string, IType>(key, ILType.AppDomain.GetType(typeArguments[i]));
-                }
-                return ILType.MakeGenericInstance(ga).ReflectionType;
-            }
-            else
-                throw new NotSupportedException();
-        }
-
-        void InitializeFields()
-        {
-            int staticCnt = type.StaticFieldTypes != null ? type.StaticFieldTypes.Length : 0;
-            fields = new ILRuntimeFieldInfo[type.TotalFieldCount + staticCnt];
-            for (int i = 0; i < type.TotalFieldCount; i++)
-            {
-                Mono.Cecil.FieldDefinition fd;
-                var t = type.GetField(i, out fd);
-                fields[i] = new ILRuntimeFieldInfo(fd, this, i, t);
-            }
-            for (int i = type.TotalFieldCount; i < type.TotalFieldCount + staticCnt; i++)
-            {
-                fields[i] = new ILRuntimeFieldInfo(type.StaticFieldDefinitions[i - type.TotalFieldCount], this, true, i - type.TotalFieldCount);
-            }
-        }
-
-        public override Assembly Assembly
-        {
-            get
-            {
-                return typeof(ILRuntimeType).Assembly;
-            }
-        }
-
-        public override string AssemblyQualifiedName
-        {
-            get
-            {
-                return type.FullName;
-            }
-        }
-
-        public override Type BaseType
-        {
-            get
-            {
-                if (type.IsEnum)
-                    return typeof(Enum);
-                else if (type.IsArray)
-                    return typeof(Array);
-                else
-                {
-                    return type.BaseType != null ? type.BaseType.ReflectionType : null;
-                }
-            }
-        }
-
-        public override string FullName
-        {
-            get
-            {
-                return type.FullName;
-            }
-        }
-
-        public override Guid GUID
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public override Module Module
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        public override string Name
-        {
-            get
-            {
-                return type.Name;
-            }
-        }
-
-        public override string Namespace
-        {
-            get
-            {
-                return type.TypeDefinition.Namespace;
-            }
-        }
-
-        public override Type UnderlyingSystemType
-        {
-            get
-            {
-                return typeof(ILTypeInstance);
-            }
-        }
-
-        public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
-        {
-            var ctors = type.GetConstructors();
-            ConstructorInfo[] res = new ConstructorInfo[ctors.Count];
-            for(int i = 0; i < res.Length; i++)
-            {
-                res[i] = ctors[i].ReflectionConstructorInfo;
-            }
-            return res;
-        }
-
-        public override object[] GetCustomAttributes(bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-
-            return customAttributes;
-        }
-
-        public override object[] GetCustomAttributes(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-            List<object> res = new List<object>();
-            for(int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i].Equals((object)attributeType))
-                    res.Add(customAttributes[i]);
-            }
-            return res.ToArray();
-        }
-
-        public override bool IsAssignableFrom(Type c)
-        {
-            IType type;
-            if (c is ILRuntimeWrapperType)
-            {
-                type = ((ILRuntimeWrapperType)c).CLRType;
-            }
-            else if (c is ILRuntimeType)
-            {
-                type = ((ILRuntimeType)c).ILType;
-            }
-            else
-                type = ILType.AppDomain.GetType(c);
-            return type.CanAssignTo(ILType);
-        }
-
-        public override bool IsInstanceOfType(object o)
-        {
-            if (o == null)
-            {
-                return false;
-            }
-
-            var instance = o as ILTypeInstance;
-            return IsAssignableFrom(instance != null ? instance.Type.ReflectionType : o.GetType());
-        }
-
-        public override Type GetElementType()
-        {
-            if (type.IsArray)
-            {
-                return type.ElementType.ReflectionType;
-            }
-            else
-                throw new NotImplementedException();
-        }
-
-        public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override EventInfo[] GetEvents(BindingFlags bindingAttr)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override FieldInfo GetField(string name, BindingFlags bindingAttr)
-        {
-            if (fields == null)
-                InitializeFields();
-            foreach(var i in fields)
-            {
-                if (i.Name == name)
-                    return i;
-            }
-            if (BaseType != null && BaseType is ILRuntimeWrapperType)
-            {
-                return BaseType.GetField(name, bindingAttr);
-            }
-            return null;
-        }
-
-        public override FieldInfo[] GetFields(BindingFlags bindingAttr)
-        {
-            if (fields == null)
-                InitializeFields();
-            bool isPublic = (bindingAttr & BindingFlags.Public) == BindingFlags.Public;
-            bool isPrivate = (bindingAttr & BindingFlags.NonPublic) == BindingFlags.NonPublic;
-            bool isStatic = (bindingAttr & BindingFlags.Static) == BindingFlags.Static;
-            bool isInstance = (bindingAttr & BindingFlags.Instance) == BindingFlags.Instance;
-            List<FieldInfo> res = new List<FieldInfo>();
-            foreach(var i in fields)
-            {
-                if (isPublic != i.IsPublic && isPrivate != !i.IsPublic)
-                    continue;
-                if ((isStatic != i.IsStatic) && (isInstance != !i.IsStatic))
-                    continue;
-                res.Add(i);
-            }
-            if ((bindingAttr & BindingFlags.DeclaredOnly) != BindingFlags.DeclaredOnly)
-            {
-                if (BaseType != null && BaseType is ILRuntimeWrapperType)
-                {
-                    res.AddRange(BaseType.GetFields(bindingAttr));
-                }
-            }
-            return res.ToArray();
-        }
-
-        public override Type GetInterface(string name, bool ignoreCase)
-        {
-            if (type.FirstCLRInterface != null)
-            {
-                if (type.FirstCLRInterface.Name == name)
-                    return type.FirstCLRInterface.TypeForCLR;
-                else
-                    return null;
-            }
-            else
-                return null;
-        }
-
-        public override Type[] GetInterfaces()
-        {
-            if (type.FirstCLRInterface != null)
-                return new Type[] { type.FirstCLRInterface.TypeForCLR };
-            else
-                return new Type[0];
-        }
-
-        public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
-        {
-            if (methods == null)
-                InitializeMethods();
-            if (fields == null)
-                InitializeFields();
-            if (properties == null)
-                InitializeProperties();
-            MemberInfo[] res = new MemberInfo[methods.Length + fields.Length + properties.Length];
-            for (int i = 0; i < methods.Length; i++)
-            {
-                res[i] = methods[i];
-            }
-            for (int i = methods.Length; i < methods.Length + fields.Length; i++)
-            {
-                res[i] = fields[i - methods.Length];
-            }
-            for (int i = methods.Length + fields.Length; i < res.Length; i++)
-            {
-                res[i] = properties[i - methods.Length - fields.Length];
-            }
-
-            return res;
-        }
-
-        public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
-        {
-            if (methods == null)
-                InitializeMethods();
-            return methods;
-        }
-
-        public override Type GetNestedType(string name, BindingFlags bindingAttr)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override Type[] GetNestedTypes(BindingFlags bindingAttr)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
-        {
-            if (properties == null)
-                InitializeProperties();
-            bool isPublic = (bindingAttr & BindingFlags.Public) == BindingFlags.Public;
-            bool isPrivate = (bindingAttr & BindingFlags.NonPublic) == BindingFlags.NonPublic;
-            bool isStatic = (bindingAttr & BindingFlags.Static) == BindingFlags.Static;
-            bool isInstance = (bindingAttr & BindingFlags.Instance) == BindingFlags.Instance;
-            List<PropertyInfo> res = new List<PropertyInfo>();
-            foreach (var i in properties)
-            {
-                if (isPublic != i.IsPublic && isPrivate != !i.IsPublic)
-                    continue;
-                if ((isStatic != i.IsStatic) && (isInstance != !i.IsStatic))
-                    continue;
-                res.Add(i);
-            }
-            if ((bindingAttr & BindingFlags.DeclaredOnly) != BindingFlags.DeclaredOnly)
-            {
-                if (BaseType != null && BaseType is ILRuntimeWrapperType)
-                {
-                    res.AddRange(BaseType.GetProperties(bindingAttr));
-                }
-            }
-            return res.ToArray();
-        }
-
-        public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override bool IsDefined(Type attributeType, bool inherit)
-        {
-            if (customAttributes == null)
-                InitializeCustomAttribute();
-            for (int i = 0; i < customAttributes.Length; i++)
-            {
-                if (attributeTypes[i].Equals(attributeType))
-                    return true;
-            }
-            return false;
-        }
-
-        protected override TypeAttributes GetAttributeFlagsImpl()
-        {
-            TypeAttributes res = TypeAttributes.Public;
-            if (type.TypeDefinition == null)
-            {
-                return TypeAttributes.Class;
-            }
-            if (type.TypeDefinition.IsAbstract)
-                res |= TypeAttributes.Abstract;
-            if (!type.IsValueType)
-                res |= TypeAttributes.Class;
-            if (type.TypeDefinition.IsSealed)
-                res |= TypeAttributes.Sealed;
-            return res;
-        }
-
-        protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-        {
-            List<IType> param = new List<IType>();
-            for (int i = 0; i < types.Length; i++)
-            {
-                if (types[i] is ILRuntimeType)
-                    param.Add(((ILRuntimeType)types[i]).type);
-                else
-                {
-                    var t = appdomain.GetType(types[i]);
-                    if (t == null)
-                        t = appdomain.GetType(types[i].AssemblyQualifiedName);
-                    if (t == null)
-                        throw new TypeLoadException();
-                    param.Add(t);
-                }
-            }
-
-            var res = type.GetConstructor(param);
-
-            if (res != null)
-                return ((ILMethod)res).ReflectionConstructorInfo;
-            else
-                return null;
-        }
-
-        protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-        {
-            IMethod res;
-            if (types == null)
-                res = type.GetMethod(name);
-            else
-            {
-                List<IType> param = new List<IType>();
-                for (int i = 0; i < types.Length; i++)
-                {
-                    if (types[i] is ILRuntimeType)
-                        param.Add(((ILRuntimeType)types[i]).type);
-                    else
-                    {
-                        var t = appdomain.GetType(types[i]);
-                        if (t == null)
-                            t = appdomain.GetType(types[i].AssemblyQualifiedName);
-                        if (t == null)
-                            throw new TypeLoadException();
-                        param.Add(t);
-                    }
-                }
-                bool declearedOnly = (bindingAttr & BindingFlags.DeclaredOnly) == BindingFlags.DeclaredOnly;
-                res = type.GetMethod(name, param, null, null, declearedOnly);
-            }
-            if (res != null)
-                return ((ILMethod)res).ReflectionMethodInfo;
-            else
-                return null;
-        }
-
-        protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
-        {
-            if (properties == null)
-                InitializeProperties();
-
-            foreach(var i in properties)
-            {
-                if (i.Name == name)
-                    return i;
-            }
-            if ((bindingAttr & BindingFlags.DeclaredOnly) != BindingFlags.DeclaredOnly)
-            {
-                if (BaseType != null && BaseType is ILRuntimeWrapperType)
-                {
-                    return BaseType.GetProperty(name, bindingAttr);
-                }
-            }
-            return null;
-        }
-
-        protected override bool HasElementTypeImpl()
-        {
-            return false;
-        }
-        protected override bool IsArrayImpl()
-        {
-            return type.IsArray;
-        }
-
-        protected override bool IsByRefImpl()
-        {
-            return false;
-        }
-
-        protected override bool IsCOMObjectImpl()
-        {
-            return false;
-        }
-
-        protected override bool IsPointerImpl()
-        {
-            return false;
-        }
-
-        protected override bool IsPrimitiveImpl()
-        {
-            return false;
-        }
-        public override int GetHashCode()
-        {
-            return type.GetHashCode();
-        }
-        public override bool Equals(object o)
-        {
-            return o is ILRuntimeType ? ((ILRuntimeType)o).type == type : false;
-        }
-        public override bool IsGenericType
-        {
-            get
-            {
-                return type.HasGenericParameter || type.GenericArguments != null;
-            }
-        }
-
-        public override Type GetGenericTypeDefinition()
-        {
-            var def = type.GetGenericDefinition();
-
-            return def != null ? def.ReflectionType : null;
-        }
-
-        public override bool IsGenericTypeDefinition
-        {
-            get
-            {
-                return type.HasGenericParameter;
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeType.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f3a1f2fbaeb2b8446a4001bf4537351d
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 285
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeWrapperType.cs

@@ -1,285 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Intepreter;
-
-namespace ILRuntime.Reflection
-{
-    public class ILRuntimeWrapperType : Type
-    {
-        CLRType type;
-        Type et;
-
-        public CLRType CLRType { get { return type; } }
-
-        public Type RealType { get { return et; } }
-
-        public override Guid GUID
-        {
-            get
-            {
-                return et.GUID;
-            }
-        }
-
-        public override Module Module
-        {
-            get
-            {
-                return et.Module;
-            }
-        }
-
-        public override Assembly Assembly
-        {
-            get
-            {
-                return et.Assembly;
-            }
-        }
-
-        public override string FullName
-        {
-            get
-            {
-                return et.FullName;
-            }
-        }
-
-        public override string Namespace
-        {
-            get
-            {
-                return et.Namespace;
-            }
-        }
-
-        public override string AssemblyQualifiedName
-        {
-            get
-            {
-                return et.AssemblyQualifiedName;
-            }
-        }
-
-        public override Type BaseType
-        {
-            get
-            {
-                return et.BaseType;
-            }
-        }
-
-        public override Type UnderlyingSystemType
-        {
-            get
-            {
-                return et.UnderlyingSystemType;
-            }
-        }
-
-        public override string Name
-        {
-            get
-            {
-                return et.Name;
-            }
-        }
-
-        public ILRuntimeWrapperType(CLRType t)
-        {
-            type = t;
-            et = t.TypeForCLR;
-        }
-
-        public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
-        {
-            return et.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters);
-        }
-
-        protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-        {
-            return et.GetConstructor(bindingAttr, binder, callConvention, types, modifiers);
-        }
-
-        public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
-        {
-            return et.GetConstructors(bindingAttr);
-        }
-
-        protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-        {
-            return et.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers);
-        }
-
-        public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
-        {
-            return et.GetMethods(bindingAttr);
-        }
-
-        public override FieldInfo GetField(string name, BindingFlags bindingAttr)
-        {
-            return et.GetField(name, bindingAttr);
-        }
-
-        public override FieldInfo[] GetFields(BindingFlags bindingAttr)
-        {
-            return et.GetFields(bindingAttr);
-        }
-
-        public override Type GetInterface(string name, bool ignoreCase)
-        {
-            return et.GetInterface(name, ignoreCase);
-        }
-
-        public override Type[] GetInterfaces()
-        {
-            return et.GetInterfaces();
-        }
-
-        public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
-        {
-            return et.GetEvent(name, bindingAttr);
-        }
-
-        public override EventInfo[] GetEvents(BindingFlags bindingAttr)
-        {
-            return et.GetEvents(bindingAttr);
-        }
-
-        protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
-        {
-            return et.GetProperty(name, bindingAttr);
-        }
-
-        public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
-        {
-            return et.GetProperties(bindingAttr);
-        }
-
-        public override Type[] GetNestedTypes(BindingFlags bindingAttr)
-        {
-            return et.GetNestedTypes(bindingAttr);
-        }
-
-        public override int GetHashCode()
-        {
-            return type.GetHashCode();
-        }
-
-        public override bool IsAssignableFrom(Type c)
-        {
-            if (c is ILRuntimeWrapperType)
-                c = ((ILRuntimeWrapperType)c).RealType;
-            if (c is ILRuntimeType)
-                c = ((ILRuntimeType)c).ILType.TypeForCLR;
-            return et.IsAssignableFrom(c);
-        }
-
-        public override bool IsInstanceOfType(object o)
-        {
-            if (o == null)
-            {
-                return false;
-            }
-
-            var instance = o as ILTypeInstance;
-            return IsAssignableFrom(instance != null ? instance.Type.ReflectionType : o.GetType());
-        }
-
-        public override Type GetNestedType(string name, BindingFlags bindingAttr)
-        {
-            return et.GetNestedType(name, bindingAttr);
-        }
-
-        public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
-        {
-            return et.GetMembers(bindingAttr);
-        }
-
-        protected override TypeAttributes GetAttributeFlagsImpl()
-        {
-            return et.Attributes;
-        }
-
-        protected override bool IsArrayImpl()
-        {
-            return et.IsArray;
-        }
-
-        protected override bool IsByRefImpl()
-        {
-            return et.IsByRef;
-        }
-
-        protected override bool IsPointerImpl()
-        {
-            return et.IsPointer;
-        }
-
-        protected override bool IsPrimitiveImpl()
-        {
-            return et.IsPrimitive;
-        }
-
-        protected override bool IsCOMObjectImpl()
-        {
-            return et.IsCOMObject;
-        }
-
-        public override bool IsGenericType
-        {
-            get { return et.IsGenericType; }
-        }
-
-        public override bool IsGenericTypeDefinition
-        {
-            get
-            {
-                return et.IsGenericTypeDefinition;
-            }
-        }
-
-        public override Type GetGenericTypeDefinition()
-        {
-            return et.GetGenericTypeDefinition();
-        }
-
-        public override bool IsGenericParameter
-        {
-            get
-            {
-                return et.IsGenericParameter;
-            }
-        }
-        public override Type GetElementType()
-        {
-            return et.GetElementType();
-        }
-
-        protected override bool HasElementTypeImpl()
-        {
-            return et.HasElementType;
-        }
-
-        public override object[] GetCustomAttributes(bool inherit)
-        {
-            return et.GetCustomAttributes(inherit);
-        }
-
-        public override object[] GetCustomAttributes(Type attributeType, bool inherit)
-        {
-            return et.GetCustomAttributes(attributeType, inherit);
-        }
-
-        public override bool IsDefined(Type attributeType, bool inherit)
-        {
-            return et.IsDefined(attributeType, inherit);
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Reflection/ILRuntimeWrapperType.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: eaefbb07ad715ce489ab00dd2080222f
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: cfa8ba5fa2cea2d46ad6b593ee6e2575
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Adaptors.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 94e60d4ce90761b4497ec3f9f968e3e2
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 73
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Adaptors/CLRCrossBindingAdaptors.cs

@@ -1,73 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-
-namespace ILRuntime.Runtime.Adaptors
-{
-    class AttributeAdaptor : CrossBindingAdaptor
-    {
-        public override Type AdaptorType
-        {
-            get
-            {
-                return typeof(Adaptor);
-            }
-        }
-
-        public override Type BaseCLRType
-        {
-            get
-            {
-                return typeof(Attribute);
-            }
-        }
-
-        public override object CreateCLRInstance(Enviorment.AppDomain appdomain, ILTypeInstance instance)
-        {
-            return new Adaptor(appdomain, instance);
-        }
-
-        class Adaptor : Attribute, CrossBindingAdaptorType
-        {
-            ILTypeInstance instance;
-            ILRuntime.Runtime.Enviorment.AppDomain appdomain;
-
-            bool isToStringGot;
-            IMethod toString;
-
-            public Adaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance)
-            {
-                this.appdomain = appdomain;
-                this.instance = instance;
-            }
-            public ILTypeInstance ILInstance
-            {
-                get
-                {
-                    return instance;
-                }
-            }
-
-            public override string ToString()
-            {
-                if (!isToStringGot)
-                {
-                    isToStringGot = true;
-                    IMethod m = appdomain.ObjectType.GetMethod("ToString", 0);
-                    toString = instance.Type.GetVirtualMethod(m);
-                }
-                if (toString == null || toString is ILMethod)
-                {
-                    return instance.ToString();
-                }
-                else
-                    return instance.Type.FullName;
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Adaptors/CLRCrossBindingAdaptors.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 9c62df830a323ae4185db20e52d0a559
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: af221dfc6c56ebd45a5d24edf9e004d1
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 801
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs

@@ -1,801 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Other;
-
-namespace ILRuntime.Runtime.CLRBinding
-{
-    public class BindingCodeGenerator
-    {
-        
-        public static void GenerateBindingCode(List<Type> types, string outputPath, 
-                                               HashSet<MethodBase> excludeMethods = null, HashSet<FieldInfo> excludeFields = null, 
-                                               List<Type> valueTypeBinders = null, List<Type> delegateTypes = null)
-        {
-            if (!System.IO.Directory.Exists(outputPath))
-                System.IO.Directory.CreateDirectory(outputPath);
-            string[] oldFiles = System.IO.Directory.GetFiles(outputPath, "*.cs");
-            foreach (var i in oldFiles)
-            {
-                System.IO.File.Delete(i);
-            }
-
-            List<string> clsNames = new List<string>();
-
-            foreach (var i in types)
-            {
-                string clsName, realClsName;
-                bool isByRef;
-                if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0)
-                    continue;
-                i.GetClassName(out clsName, out realClsName, out isByRef);
-                clsNames.Add(clsName);
-                
-                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outputPath + "/" + clsName + ".cs", false, new UTF8Encoding(false)))
-                {
-                    StringBuilder sb = new StringBuilder();
-                    sb.Append(@"using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Runtime.Stack;
-using ILRuntime.Reflection;
-using ILRuntime.CLR.Utils;
-
-namespace ILRuntime.Runtime.Generated
-{
-    unsafe class ");
-                    sb.AppendLine(clsName);
-                    sb.Append(@"    {
-        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {
-");
-                    string flagDef = "            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;";
-                    string methodDef = "            MethodBase method;";
-                    string methodsDef = "            MethodInfo[] methods = type.GetMethods(flag).Where(t => !t.IsGenericMethod).ToArray();";
-                    string fieldDef = "            FieldInfo field;";
-                    string argsDef = "            Type[] args;";
-                    string typeDef = string.Format("            Type type = typeof({0});", realClsName);
-
-                    bool needMethods;
-                    MethodInfo[] methods = i.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly);
-                    FieldInfo[] fields = i.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly);
-                    string registerMethodCode = i.GenerateMethodRegisterCode(methods, excludeMethods, out needMethods);
-                    string registerFieldCode = i.GenerateFieldRegisterCode(fields, excludeFields);
-                    string registerValueTypeCode = i.GenerateValueTypeRegisterCode(realClsName);
-                    string registerMiscCode = i.GenerateMiscRegisterCode(realClsName, true, true);
-                    string commonCode = i.GenerateCommonCode(realClsName);
-                    ConstructorInfo[] ctors = i.GetConstructors(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly);
-                    string ctorRegisterCode = i.GenerateConstructorRegisterCode(ctors, excludeMethods);
-                    string methodWraperCode = i.GenerateMethodWraperCode(methods, realClsName, excludeMethods, valueTypeBinders, null);
-                    string fieldWraperCode = i.GenerateFieldWraperCode(fields, realClsName, excludeFields);
-                    string cloneWraperCode = i.GenerateCloneWraperCode(fields, realClsName);
-                    string ctorWraperCode = i.GenerateConstructorWraperCode(ctors, realClsName, excludeMethods, valueTypeBinders);
-
-                    bool hasMethodCode = !string.IsNullOrEmpty(registerMethodCode);
-                    bool hasFieldCode = !string.IsNullOrEmpty(registerFieldCode);
-                    bool hasValueTypeCode = !string.IsNullOrEmpty(registerValueTypeCode);
-                    bool hasMiscCode = !string.IsNullOrEmpty(registerMiscCode);
-                    bool hasCtorCode = !string.IsNullOrEmpty(ctorRegisterCode);
-                    bool hasNormalMethod = methods.Where(x => !x.IsGenericMethod).Count() != 0;
-
-                    if ((hasMethodCode && hasNormalMethod) || hasFieldCode || hasCtorCode)
-                        sb.AppendLine(flagDef);
-                    if (hasMethodCode || hasCtorCode)
-                        sb.AppendLine(methodDef);
-                    if (hasFieldCode)
-                        sb.AppendLine(fieldDef);
-                    if (hasMethodCode || hasFieldCode || hasCtorCode)
-                        sb.AppendLine(argsDef);
-                    if (hasMethodCode || hasFieldCode || hasValueTypeCode || hasMiscCode || hasCtorCode)
-                        sb.AppendLine(typeDef);
-                    if (needMethods)
-                        sb.AppendLine(methodsDef);
-
-
-                    sb.AppendLine(registerMethodCode);
-                    sb.AppendLine(registerFieldCode);
-                    sb.AppendLine(registerValueTypeCode);
-                    sb.AppendLine(registerMiscCode);
-                    sb.AppendLine(ctorRegisterCode);
-                    sb.AppendLine("        }");
-                    sb.AppendLine();
-                    sb.AppendLine(commonCode);
-                    sb.AppendLine(methodWraperCode);
-                    sb.AppendLine(fieldWraperCode);
-                    sb.AppendLine(cloneWraperCode);
-                    sb.AppendLine(ctorWraperCode);
-                    sb.AppendLine("    }");
-                    sb.AppendLine("}");
-
-                    sw.Write(Regex.Replace(sb.ToString(), "(?<!\r)\n", "\r\n"));
-                    sw.Flush();
-                }
-            }
-
-            var delegateClsNames = GenerateDelegateBinding(delegateTypes, outputPath);
-            clsNames.AddRange(delegateClsNames);
-
-            GenerateBindingInitializeScript(clsNames, valueTypeBinders, outputPath);
-        }
-
-        internal class CLRBindingGenerateInfo
-        {
-            public Type Type { get; set; }
-            public HashSet<MethodInfo> Methods { get; set; }
-            public HashSet<FieldInfo> Fields { get; set; }
-            public HashSet<ConstructorInfo> Constructors { get; set; }
-            public bool ArrayNeeded { get; set; }
-            public bool DefaultInstanceNeeded { get; set; }
-            public bool ValueTypeNeeded { get; set; }
-
-            public bool NeedGenerate
-            {
-                get
-                {
-                    if (Methods.Count == 0 && Constructors.Count == 0 && Fields.Count == 0 && !ArrayNeeded && !DefaultInstanceNeeded && !ValueTypeNeeded)
-                        return false;
-                    else
-                    {
-                        //Making CLRBinding for such types makes no sense
-                        if (Type == typeof(Delegate) || Type == typeof(System.Runtime.CompilerServices.RuntimeHelpers))
-                            return false;
-                        return true;
-                    }
-                }
-            }
-        }
-
-        public static void GenerateBindingCode(ILRuntime.Runtime.Enviorment.AppDomain domain, string outputPath, 
-                                               List<Type> valueTypeBinders = null, List<Type> delegateTypes = null)
-        {
-            if (domain == null)
-                return;
-            if (!System.IO.Directory.Exists(outputPath))
-                System.IO.Directory.CreateDirectory(outputPath);
-            Dictionary<Type, CLRBindingGenerateInfo> infos = new Dictionary<Type, CLRBindingGenerateInfo>(new ByReferenceKeyComparer<Type>());
-            CrawlAppdomain(domain, infos);
-            string[] oldFiles = System.IO.Directory.GetFiles(outputPath, "*.cs");
-            foreach (var i in oldFiles)
-            {
-                System.IO.File.Delete(i);
-            }
-
-            if (valueTypeBinders == null)
-                valueTypeBinders = new List<Type>(domain.ValueTypeBinders.Keys);
-
-            HashSet<MethodBase> excludeMethods = null;
-            HashSet<FieldInfo> excludeFields = null;
-            HashSet<string> files = new HashSet<string>();
-            List<string> clsNames = new List<string>();
-
-            foreach (var info in infos)
-            {
-                if (!info.Value.NeedGenerate)
-                    continue;
-                Type i = info.Value.Type;
-
-                //CLR binding for delegate is important for cross domain invocation,so it should be generated
-                //if (i.BaseType == typeof(MulticastDelegate))
-                //    continue;
-
-                string clsName, realClsName;
-                bool isByRef;
-                if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0)
-                    continue;
-                i.GetClassName(out clsName, out realClsName, out isByRef);
-                if (clsNames.Contains(clsName))
-                    clsName = clsName + "_t";
-                clsNames.Add(clsName);
-                
-                string oFileName = outputPath + "/" + clsName;
-                int len = Math.Min(oFileName.Length, 100);
-                if (len < oFileName.Length)
-                    oFileName = oFileName.Substring(0, len) + "_t";
-                while (files.Contains(oFileName))
-                    oFileName = oFileName + "_t";
-                files.Add(oFileName);
-                oFileName = oFileName + ".cs";
-                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(oFileName, false, new UTF8Encoding(false)))
-                {
-                    StringBuilder sb = new StringBuilder();
-                    sb.Append(@"using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Runtime.Stack;
-using ILRuntime.Reflection;
-using ILRuntime.CLR.Utils;
-
-namespace ILRuntime.Runtime.Generated
-{
-    unsafe class ");
-                    sb.AppendLine(clsName);
-                    sb.Append(@"    {
-        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {
-");
-                    string flagDef =    "            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;";
-                    string methodDef =  "            MethodBase method;";
-                    string methodsDef = "            MethodInfo[] methods = type.GetMethods(flag).Where(t => !t.IsGenericMethod).ToArray();";
-                    string fieldDef =   "            FieldInfo field;";
-                    string argsDef =    "            Type[] args;";
-                    string typeDef = string.Format("            Type type = typeof({0});", realClsName);
-
-                    bool needMethods;
-                    MethodInfo[] methods = info.Value.Methods.ToArray();
-                    FieldInfo[] fields = info.Value.Fields.ToArray();
-                    string registerMethodCode = i.GenerateMethodRegisterCode(methods, excludeMethods, out needMethods);
-                    string registerFieldCode = fields.Length > 0 ? i.GenerateFieldRegisterCode(fields, excludeFields) : null;
-                    string registerValueTypeCode = info.Value.ValueTypeNeeded ? i.GenerateValueTypeRegisterCode(realClsName) : null;
-                    string registerMiscCode = i.GenerateMiscRegisterCode(realClsName, info.Value.DefaultInstanceNeeded, info.Value.ArrayNeeded);
-                    string commonCode = i.GenerateCommonCode(realClsName);
-                    ConstructorInfo[] ctors = info.Value.Constructors.ToArray();
-                    string ctorRegisterCode = i.GenerateConstructorRegisterCode(ctors, excludeMethods);
-                    string methodWraperCode = i.GenerateMethodWraperCode(methods, realClsName, excludeMethods, valueTypeBinders, domain);
-                    string fieldWraperCode = fields.Length > 0 ? i.GenerateFieldWraperCode(fields, realClsName, excludeFields) : null;
-                    string cloneWraperCode = null;
-                    if (info.Value.ValueTypeNeeded)
-                    {
-                        //Memberwise clone should copy all fields
-                        var fs = i.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly);
-                        cloneWraperCode = i.GenerateCloneWraperCode(fs, realClsName);
-                    }
-
-                    bool hasMethodCode = !string.IsNullOrEmpty(registerMethodCode);
-                    bool hasFieldCode = !string.IsNullOrEmpty(registerFieldCode);
-                    bool hasValueTypeCode = !string.IsNullOrEmpty(registerValueTypeCode);
-                    bool hasMiscCode = !string.IsNullOrEmpty(registerMiscCode);
-                    bool hasCtorCode = !string.IsNullOrEmpty(ctorRegisterCode);
-                    bool hasNormalMethod = methods.Where(x => !x.IsGenericMethod).Count() != 0;
-
-                    if ((hasMethodCode && hasNormalMethod) || hasFieldCode || hasCtorCode)
-                        sb.AppendLine(flagDef);
-                    if (hasMethodCode || hasCtorCode)
-                        sb.AppendLine(methodDef);
-                    if (hasFieldCode)
-                        sb.AppendLine(fieldDef);
-                    if (hasMethodCode || hasFieldCode || hasCtorCode)
-                        sb.AppendLine(argsDef);
-                    if (hasMethodCode || hasFieldCode || hasValueTypeCode || hasMiscCode || hasCtorCode)
-                        sb.AppendLine(typeDef);
-                    if (needMethods)
-                        sb.AppendLine(methodsDef);
-
-                    sb.AppendLine(registerMethodCode);
-                    if (fields.Length > 0)
-                        sb.AppendLine(registerFieldCode);
-                    if (info.Value.ValueTypeNeeded)
-                        sb.AppendLine(registerValueTypeCode);
-                    if (!string.IsNullOrEmpty(registerMiscCode))
-                        sb.AppendLine(registerMiscCode);
-                    sb.AppendLine(ctorRegisterCode);
-                    sb.AppendLine("        }");
-                    sb.AppendLine();
-                    sb.AppendLine(commonCode);
-                    sb.AppendLine(methodWraperCode);
-                    if (fields.Length > 0)
-                        sb.AppendLine(fieldWraperCode);
-                    if (info.Value.ValueTypeNeeded)
-                        sb.AppendLine(cloneWraperCode);
-                    string ctorWraperCode = i.GenerateConstructorWraperCode(ctors, realClsName, excludeMethods, valueTypeBinders);
-                    sb.AppendLine(ctorWraperCode);
-                    sb.AppendLine("    }");
-                    sb.AppendLine("}");
-
-                    sw.Write(Regex.Replace(sb.ToString(), "(?<!\r)\n", "\r\n"));
-                    sw.Flush();
-                }
-            }
-
-            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outputPath + "/CLRBindings.cs", false, new UTF8Encoding(false)))
-            {
-                StringBuilder sb = new StringBuilder();
-                sb.AppendLine(@"using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace ILRuntime.Runtime.Generated
-{
-    class CLRBindings
-    {
-        /// <summary>
-        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
-        /// </summary>
-        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {");
-                foreach (var i in clsNames)
-                {
-                    sb.Append("            ");
-                    sb.Append(i);
-                    sb.AppendLine(".Register(app);");
-                }
-
-                sb.AppendLine(@"        }
-    }
-}");
-                sw.Write(Regex.Replace(sb.ToString(), "(?<!\r)\n", "\r\n"));
-            }
-
-            var delegateClsNames = GenerateDelegateBinding(delegateTypes, outputPath);
-            clsNames.AddRange(delegateClsNames);
-
-            GenerateBindingInitializeScript(clsNames, valueTypeBinders, outputPath);
-        }
-
-        internal static void CrawlAppdomain(ILRuntime.Runtime.Enviorment.AppDomain domain, Dictionary<Type, CLRBindingGenerateInfo> infos)
-        {
-            var arr = domain.LoadedTypes.Values.ToArray();
-            //Prewarm
-            foreach (var type in arr)
-            {
-                if (type is CLR.TypeSystem.ILType)
-                {
-                    if (type.HasGenericParameter)
-                        continue;
-                    var methods = type.GetMethods().ToList();
-                    foreach (var i in ((CLR.TypeSystem.ILType)type).GetConstructors())
-                        methods.Add(i);
-                    if (((CLR.TypeSystem.ILType)type).GetStaticConstroctor() != null)
-                        methods.Add(((CLR.TypeSystem.ILType)type).GetStaticConstroctor());
-                    foreach (var j in methods)
-                    {
-                        CLR.Method.ILMethod method = j as CLR.Method.ILMethod;
-                        if (method != null)
-                        {
-                            if (method.GenericParameterCount > 0 && !method.IsGenericInstance)
-                                continue;
-                            var body = method.Body;
-                        }
-                    }
-                }
-            }
-            arr = domain.LoadedTypes.Values.ToArray();
-            foreach (var type in arr)
-            {
-                if (type is CLR.TypeSystem.ILType)
-                {
-                    if (type.TypeForCLR.IsByRef || type.HasGenericParameter)
-                        continue;
-                    var methods = type.GetMethods().ToList();
-                    foreach (var i in ((CLR.TypeSystem.ILType)type).GetConstructors())
-                        methods.Add(i);
-                    if (((CLR.TypeSystem.ILType)type).GetStaticConstroctor() != null)
-                        methods.Add(((CLR.TypeSystem.ILType)type).GetStaticConstroctor());
-                    foreach (var j in methods)
-                    {
-                        CLR.Method.ILMethod method = j as CLR.Method.ILMethod;
-                        if (method != null)
-                        {
-                            if (method.GenericParameterCount > 0 && !method.IsGenericInstance)
-                                continue;
-                            var body = method.Body;
-                            foreach (var ins in body)
-                            {
-                                switch (ins.Code)
-                                {
-                                    case Intepreter.OpCodes.OpCodeEnum.Newobj:
-                                        {
-                                            CLR.Method.CLRMethod m = domain.GetMethod(ins.TokenInteger) as CLR.Method.CLRMethod;
-                                            if (m != null)
-                                            {
-                                                if (m.DeclearingType.IsDelegate)
-                                                    continue;
-                                                Type t = m.DeclearingType.TypeForCLR;
-                                                CLRBindingGenerateInfo info;
-                                                if (!infos.TryGetValue(t, out info))
-                                                {
-                                                    info = CreateNewBindingInfo(t);
-                                                    infos[t] = info;
-                                                }
-                                                if (m.IsConstructor)
-                                                    info.Constructors.Add(m.ConstructorInfo);
-                                                else
-                                                    info.Methods.Add(m.MethodInfo);
-                                            }
-                                        }
-                                        break;
-                                    case Intepreter.OpCodes.OpCodeEnum.Ldfld:
-                                    case Intepreter.OpCodes.OpCodeEnum.Stfld:
-                                    case Intepreter.OpCodes.OpCodeEnum.Ldflda:
-                                    case Intepreter.OpCodes.OpCodeEnum.Ldsfld:
-                                    case Intepreter.OpCodes.OpCodeEnum.Ldsflda:
-                                    case Intepreter.OpCodes.OpCodeEnum.Stsfld:
-                                        {
-                                            var t = domain.GetType((int)(ins.TokenLong >> 32)) as CLR.TypeSystem.CLRType;
-                                            if(t != null)
-                                            {
-                                                var fi = t.GetField((int)ins.TokenLong);
-                                                if (fi != null && fi.IsPublic)
-                                                {
-                                                    CLRBindingGenerateInfo info;
-                                                    if (!infos.TryGetValue(t.TypeForCLR, out info))
-                                                    {
-                                                        info = CreateNewBindingInfo(t.TypeForCLR);
-                                                        infos[t.TypeForCLR] = info;
-                                                    }
-                                                    if(ins.Code == Intepreter.OpCodes.OpCodeEnum.Stfld || ins.Code == Intepreter.OpCodes.OpCodeEnum.Stsfld)
-                                                    {
-                                                        if (t.IsValueType)
-                                                        {
-                                                            info.ValueTypeNeeded = true;
-                                                            info.DefaultInstanceNeeded = true;
-                                                        }
-                                                    }
-                                                    if (t.TypeForCLR.CheckCanPinn() || !t.IsValueType)
-                                                        info.Fields.Add(fi);
-                                                }
-                                            }
-                                        }
-                                        break;
-                                    case Intepreter.OpCodes.OpCodeEnum.Ldtoken:
-                                        {
-                                            if (ins.TokenInteger == 0)
-                                            {
-                                                var t = domain.GetType((int)(ins.TokenLong >> 32)) as CLR.TypeSystem.CLRType;
-                                                if (t != null)
-                                                {
-                                                    var fi = t.GetField((int)ins.TokenLong);
-                                                    if (fi != null)
-                                                    {
-                                                        CLRBindingGenerateInfo info;
-                                                        if (!infos.TryGetValue(t.TypeForCLR, out info))
-                                                        {
-                                                            info = CreateNewBindingInfo(t.TypeForCLR);
-                                                            infos[t.TypeForCLR] = info;
-                                                        }
-                                                        info.Fields.Add(fi);
-                                                    }
-                                                }
-                                            }
-                                        }
-                                        break;
-                                    case Intepreter.OpCodes.OpCodeEnum.Newarr:
-                                        {
-                                            var t = domain.GetType(ins.TokenInteger) as CLR.TypeSystem.CLRType;
-                                            if(t != null)
-                                            {
-                                                CLRBindingGenerateInfo info;
-                                                if (!infos.TryGetValue(t.TypeForCLR, out info))
-                                                {
-                                                    info = CreateNewBindingInfo(t.TypeForCLR);
-                                                    infos[t.TypeForCLR] = info;
-                                                }
-                                                info.ArrayNeeded = true;
-                                            }
-                                        }
-                                        break;
-                                    case Intepreter.OpCodes.OpCodeEnum.Call:
-                                    case Intepreter.OpCodes.OpCodeEnum.Callvirt:
-                                        {
-                                            CLR.Method.CLRMethod m = domain.GetMethod(ins.TokenInteger) as CLR.Method.CLRMethod;
-                                            if (m != null)
-                                            {
-                                                //Cannot explicit call base class's constructor directly
-                                                if (m.IsConstructor && m.DeclearingType.CanAssignTo(((CLR.TypeSystem.ILType)type).FirstCLRBaseType))
-                                                    continue;
-                                                if (m.IsConstructor)
-                                                {
-                                                    if (!m.ConstructorInfo.IsPublic)
-                                                        continue;
-                                                    Type t = m.DeclearingType.TypeForCLR;
-                                                    CLRBindingGenerateInfo info;
-                                                    if (!infos.TryGetValue(t, out info))
-                                                    {
-                                                        info = CreateNewBindingInfo(t);
-                                                        infos[t] = info;
-                                                    }
-
-                                                    info.Constructors.Add(m.ConstructorInfo);
-                                                }
-                                                else
-                                                {
-                                                    if (!m.MethodInfo.IsPublic)
-                                                        continue;
-                                                    Type t = m.DeclearingType.TypeForCLR;
-                                                    CLRBindingGenerateInfo info;
-                                                    if (!infos.TryGetValue(t, out info))
-                                                    {
-                                                        info = CreateNewBindingInfo(t);
-                                                        infos[t] = info;
-                                                    }
-
-                                                    info.Methods.Add(m.MethodInfo);
-                                                }
-                                            }
-                                        }
-                                        break;
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        internal static CLRBindingGenerateInfo CreateNewBindingInfo(Type t)
-        {
-            CLRBindingGenerateInfo info = new CLRBindingGenerateInfo();
-            info.Type = t;
-            info.Methods = new HashSet<MethodInfo>();
-            info.Fields = new HashSet<FieldInfo>();
-            info.Constructors = new HashSet<ConstructorInfo>();
-            if (t.IsValueType)
-                info.DefaultInstanceNeeded = true;
-            return info;
-        }
-
-        internal static List<string> GenerateDelegateBinding(List<Type> types, string outputPath)
-        {
-            if (types == null)
-                types = new List<Type>(0);
-
-            List<string> clsNames = new List<string>();
-
-            foreach (var i in types)
-            {
-                var mi = i.GetMethod("Invoke");
-                var miParameters = mi.GetParameters();
-                if (mi.ReturnType == typeof(void) && miParameters.Length == 0)
-                    continue;
-
-                string clsName, realClsName, paramClsName, paramRealClsName;
-                bool isByRef, paramIsByRef;
-                i.GetClassName(out clsName, out realClsName, out isByRef);
-                clsNames.Add(clsName);
-                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outputPath + "/" + clsName + ".cs", false, new UTF8Encoding(false)))
-                {
-                    StringBuilder sb = new StringBuilder();
-                    sb.Append(@"using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.CLR.Method;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Runtime.Stack;
-using ILRuntime.Reflection;
-using ILRuntime.CLR.Utils;
-
-namespace ILRuntime.Runtime.Generated
-{
-    unsafe class ");
-                    sb.AppendLine(clsName);
-                    sb.AppendLine(@"    {
-        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {");
-                    bool first = true;
-
-                    if (mi.ReturnType != typeof(void))
-                    {
-                        sb.Append("            app.DelegateManager.RegisterFunctionDelegate<");
-                        first = true;
-                        foreach (var j in miParameters)
-                        {
-                            if (first)
-                            {
-                                first = false;
-                            }
-                            else
-                                sb.Append(", ");
-                            j.ParameterType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef);
-                            sb.Append(paramRealClsName);
-                        }
-                        if (!first)
-                            sb.Append(", ");
-                        mi.ReturnType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef);
-                        sb.Append(paramRealClsName);
-                        sb.AppendLine("> ();");
-                    }
-                    else
-                    {
-                        sb.Append("            app.DelegateManager.RegisterMethodDelegate<");
-                        first = true;
-                        foreach (var j in miParameters)
-                        {
-                            if (first)
-                            {
-                                first = false;
-                            }
-                            else
-                                sb.Append(", ");
-                            j.ParameterType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef);
-                            sb.Append(paramRealClsName);
-                        }
-                        sb.AppendLine("> ();");
-                    }
-                    sb.AppendLine();
-
-                    sb.Append("            app.DelegateManager.RegisterDelegateConvertor<");
-                    sb.Append(realClsName);
-                    sb.AppendLine(">((act) =>");
-                    sb.AppendLine("            {");
-                    sb.Append("                return new ");
-                    sb.Append(realClsName);
-                    sb.Append("((");
-                    first = true;
-                    foreach (var j in miParameters)
-                    {
-                        if (first)
-                        {
-                            first = false;
-                        }
-                        else
-                            sb.Append(", ");
-                        sb.Append(j.Name);
-                    }
-                    sb.AppendLine(") =>");
-                    sb.AppendLine("                {");
-                    if (mi.ReturnType != typeof(void))
-                    {
-                        sb.Append("                    return ((Func<");
-                        first = true;
-                        foreach (var j in miParameters)
-                        {
-                            if (first)
-                            {
-                                first = false;
-                            }
-                            else
-                                sb.Append(", ");
-                            j.ParameterType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef);
-                            sb.Append(paramRealClsName);
-                        }
-                        if (!first)
-                            sb.Append(", ");
-                        mi.ReturnType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef);
-                        sb.Append(paramRealClsName);
-                    }
-                    else
-                    {
-                        sb.Append("                    ((Action<");
-                        first = true;
-                        foreach (var j in miParameters)
-                        {
-                            if (first)
-                            {
-                                first = false;
-                            }
-                            else
-                                sb.Append(", ");
-                            j.ParameterType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef);
-                            sb.Append(paramRealClsName);
-                        }
-                    }
-                    sb.Append(">)act)(");
-                    first = true;
-                    foreach (var j in miParameters)
-                    {
-                        if (first)
-                        {
-                            first = false;
-                        }
-                        else
-                            sb.Append(", ");
-                        sb.Append(j.Name);
-                    }
-                    sb.AppendLine(");");
-                    sb.AppendLine("                });");
-                    sb.AppendLine("            });");
-
-                    sb.AppendLine("        }");
-                    sb.AppendLine("    }");
-                    sb.AppendLine("}");
-
-                    sw.Write(Regex.Replace(sb.ToString(), "(?<!\r)\n", "\r\n"));
-                    sw.Flush();
-                }
-            }
-
-            return clsNames;
-        }
-
-        internal static void GenerateBindingInitializeScript(List<string> clsNames, List<Type> valueTypeBinders, string outputPath)
-        {
-            if (!System.IO.Directory.Exists(outputPath))
-                System.IO.Directory.CreateDirectory(outputPath);
-            
-            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outputPath + "/CLRBindings.cs", false, new UTF8Encoding(false)))
-            {
-                StringBuilder sb = new StringBuilder();
-                sb.AppendLine(@"using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace ILRuntime.Runtime.Generated
-{
-    class CLRBindings
-    {");
-
-                if (valueTypeBinders != null)
-                {
-                    sb.AppendLine();
-
-                    foreach (var i in valueTypeBinders)
-                    {
-                        string clsName, realClsName;
-                        bool isByRef;
-                        i.GetClassName(out clsName, out realClsName, out isByRef);
-
-                        sb.AppendLine(string.Format("        internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder<{0}> s_{1}_Binder = null;", realClsName, clsName));
-                    }
-
-                    sb.AppendLine();
-                }
-
-                sb.AppendLine(@"        /// <summary>
-        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
-        /// </summary>
-        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {");
-                if (clsNames != null)
-                {
-                    foreach (var i in clsNames)
-                    {
-                        sb.Append("            ");
-                        sb.Append(i);
-                        sb.AppendLine(".Register(app);");
-                    }
-                }
-
-                if (valueTypeBinders != null)
-                {
-                    sb.AppendLine();
-
-                    sb.AppendLine("            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;");
-                    foreach (var i in valueTypeBinders)
-                    {
-                        string clsName, realClsName;
-                        bool isByRef;
-                        i.GetClassName(out clsName, out realClsName, out isByRef);
-
-                        sb.AppendLine(string.Format("            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType (typeof({0}));", realClsName));
-                        sb.AppendLine(string.Format("            s_{0}_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder<{1}>;", clsName, realClsName));
-                    }
-                }
-                sb.AppendLine(@"        }");
-
-                sb.AppendLine(@"
-        /// <summary>
-        /// Release the CLR binding, please invoke this BEFORE ILRuntime Appdomain destroy
-        /// </summary>
-        public static void Shutdown(ILRuntime.Runtime.Enviorment.AppDomain app)
-        {");
-                if (valueTypeBinders != null)
-                {
-                    foreach (var i in valueTypeBinders)
-                    {
-                        string clsName, realClsName;
-                        bool isByRef;
-                        i.GetClassName(out clsName, out realClsName, out isByRef);
-
-                        sb.AppendLine(string.Format("            s_{0}_Binder = null;", clsName));
-                    }
-                }
-                sb.AppendLine(@"        }");
-
-                sb.AppendLine(@"    }
-}");
-                sw.Write(Regex.Replace(sb.ToString(), "(?<!\r)\n", "\r\n"));
-            }
-        }
-
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 4e7ba7f4b3e5e4843a17ebdf3ff249ef
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 416
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs

@@ -1,416 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Text;
-using ILRuntime.Runtime.Enviorment;
-
-namespace ILRuntime.Runtime.CLRBinding
-{
-    static class BindingGeneratorExtensions
-    {
-        internal static bool ShouldSkipField(this Type type, FieldInfo i)
-        {
-            if (i.IsPrivate)
-                return true;
-            //EventHandler is currently not supported
-            if (i.IsSpecialName)
-            {
-                return true;
-            }
-            if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0)
-                return true;
-            return false;
-        }
-
-        internal static bool ShouldSkipMethod(this Type type, MethodBase i)
-        {
-            if (i.IsPrivate)
-                return true;
-            if (i.IsGenericMethodDefinition)
-                return true;
-            if (i.IsConstructor && type.IsAbstract)
-                return true;
-            if (i is MethodInfo && ((MethodInfo)i).ReturnType.IsByRef)
-                return true;
-            //EventHandler is currently not supported
-            var param = i.GetParameters();
-            if (i.IsSpecialName)
-            {
-                string[] t = i.Name.Split('_');
-                if (t[0] == "add" || t[0] == "remove")
-                    return true;
-                if (t[0] == "get" || t[0] == "set")
-                {
-                    Type[] ts;
-                    var cnt = t[0] == "set" ? param.Length - 1 : param.Length;
-
-                    if (cnt > 0)
-                    {
-                        ts = new Type[cnt];
-                        for (int j = 0; j < cnt; j++)
-                        {
-                            ts[j] = param[j].ParameterType;
-                        }
-                    }
-                    else
-                        ts = new Type[0];
-                    var prop = type.GetProperty(t[1], ts);
-                    if (prop == null)
-                    {
-                        return true;
-                    }
-                    if (prop.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0)
-                        return true;
-                }
-            }
-            if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0)
-                return true;
-            foreach (var j in param)
-            {
-                if (j.ParameterType.IsPointer)
-                    return true;
-            }
-            return false;
-        }
-
-        internal static void AppendParameters(this ParameterInfo[] param, StringBuilder sb, bool isMultiArr = false, int skipLast = 0)
-        {
-            bool first = true;
-            for (int i = 0; i < param.Length - skipLast; i++)
-            {
-                if (first)
-                    first = false;
-                else
-                    sb.Append(", ");
-                var j = param[i];
-                if (j.IsOut && j.ParameterType.IsByRef)
-                    sb.Append("out ");
-                else if (j.ParameterType.IsByRef)
-                    sb.Append("ref ");
-                if (isMultiArr)
-                {
-                    sb.Append("a");
-                    sb.Append(i + 1);
-                }
-                else
-                {
-                    sb.Append("@");
-                    sb.Append(j.Name);
-                }
-            }
-        }
-
-        internal static string GetRetrieveValueCode(this Type type, string realClsName)
-        {
-            if (type.IsByRef)
-                type = type.GetElementType();
-            if (type.IsPrimitive)
-            {
-                if (type == typeof(int))
-                {
-                    return "ptr_of_this_method->Value";
-                }
-                else if (type == typeof(long))
-                {
-                    return "*(long*)&ptr_of_this_method->Value";
-                }
-                else if (type == typeof(short))
-                {
-                    return "(short)ptr_of_this_method->Value";
-                }
-                else if (type == typeof(bool))
-                {
-                    return "ptr_of_this_method->Value == 1";
-                }
-                else if (type == typeof(ushort))
-                {
-                    return "(ushort)ptr_of_this_method->Value";
-                }
-                else if (type == typeof(float))
-                {
-                    return "*(float*)&ptr_of_this_method->Value";
-                }
-                else if (type == typeof(double))
-                {
-                    return "*(double*)&ptr_of_this_method->Value";
-                }
-                else if (type == typeof(byte))
-                {
-                    return "(byte)ptr_of_this_method->Value";
-                }
-                else if (type == typeof(sbyte))
-                {
-                    return "(sbyte)ptr_of_this_method->Value";
-                }
-                else if (type == typeof(uint))
-                {
-                    return "(uint)ptr_of_this_method->Value";
-                }
-                else if (type == typeof(char))
-                {
-                    return "(char)ptr_of_this_method->Value";
-                }
-                else if (type == typeof(ulong))
-                {
-                    return "*(ulong*)&ptr_of_this_method->Value";
-                }
-                else
-                    throw new NotImplementedException();
-            }
-            else
-            {
-                return string.Format("({0})typeof({0}).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack))", realClsName);
-            }
-        }
-
-        internal static void GetRefWriteBackValueCode(this Type type, StringBuilder sb, string paramName)
-        {
-            if (type.IsPrimitive)
-            {
-                if (type == typeof(int))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(long))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Long;");
-                    sb.Append("                        *(long*)&___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(short))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(bool))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = @" + paramName + " ? 1 : 0;");
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(ushort))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(float))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Float;");
-                    sb.Append("                        *(float*)&___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(double))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Double;");
-                    sb.Append("                        *(double*)&___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(byte))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(sbyte))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(uint))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = (int)@" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(char))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Integer;");
-                    sb.Append("                        ___dst->Value = (int)@" + paramName);
-                    sb.AppendLine(";");
-                }
-                else if (type == typeof(ulong))
-                {
-                    sb.AppendLine("                        ___dst->ObjectType = ObjectTypes.Long;");
-                    sb.Append("                        *(ulong*)&___dst->Value = @" + paramName);
-                    sb.AppendLine(";");
-                }
-                else
-                    throw new NotImplementedException();
-            }
-            else
-            {
-                sb.Append(@"                        object ___obj = @");
-                sb.Append(paramName);
-                sb.AppendLine(";");
-                sb.AppendLine(@"                        if (___dst->ObjectType >= ObjectTypes.Object)
-                        {
-                            if (___obj is CrossBindingAdaptorType)
-                                ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
-                            __mStack[___dst->Value] = ___obj;
-                        }
-                        else
-                        {
-                            ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
-                        }");
-                /*if (!type.IsValueType)
-                {
-                    sb.Append(@"                        object ___obj = ");
-                    sb.Append(paramName);
-                    sb.AppendLine(";");
-
-                    sb.AppendLine(@"                        if (___obj is CrossBindingAdaptorType)
-                            ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
-                        __mStack[___dst->Value] = ___obj; ");
-                }
-                else
-                {
-                    sb.Append("                        __mStack[___dst->Value] = ");
-                    sb.Append(paramName);
-                    sb.AppendLine(";");
-                }*/
-            }
-        }
-
-        internal static void GetReturnValueCode(this Type type, StringBuilder sb, Enviorment.AppDomain domain)
-        {
-            if (type.IsPrimitive)
-            {
-                if (type == typeof(int))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(long))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Long;");
-                    sb.AppendLine("            *(long*)&__ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(short))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(bool))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = result_of_this_method ? 1 : 0;");
-                }
-                else if (type == typeof(ushort))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(float))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Float;");
-                    sb.AppendLine("            *(float*)&__ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(double))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Double;");
-                    sb.AppendLine("            *(double*)&__ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(byte))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(sbyte))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = result_of_this_method;");
-                }
-                else if (type == typeof(uint))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = (int)result_of_this_method;");
-                }
-                else if (type == typeof(char))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Integer;");
-                    sb.AppendLine("            __ret->Value = (int)result_of_this_method;");
-                }
-                else if (type == typeof(ulong))
-                {
-                    sb.AppendLine("            __ret->ObjectType = ObjectTypes.Long;");
-                    sb.AppendLine("            *(ulong*)&__ret->Value = result_of_this_method;");
-                }
-                else
-                    throw new NotImplementedException();
-                sb.AppendLine("            return __ret + 1;");
-
-            }
-            else
-            {
-                string isBox;
-                if (type == typeof(object))
-                    isBox = ", true";
-                else
-                    isBox = "";
-                if (!type.IsSealed && type != typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance))
-                {
-                    if(domain == null || CheckAssignableToCrossBindingAdapters(domain, type))
-                    {
-                        sb.Append(@"            object obj_result_of_this_method = result_of_this_method;
-            if(obj_result_of_this_method is CrossBindingAdaptorType)
-            {    
-                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance");
-                        sb.Append(isBox);
-                        sb.AppendLine(@");
-            }");
-                    }
-                    else if (typeof(CrossBindingAdaptorType).IsAssignableFrom(type))
-                    {
-                        sb.AppendLine(string.Format("            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method.ILInstance{0});", isBox));
-                        return;
-                    }
-                    
-                }
-                sb.AppendLine(string.Format("            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method{0});", isBox));
-            }
-        }
-
-        static bool CheckAssignableToCrossBindingAdapters(Enviorment.AppDomain domain, Type type)
-        {
-            if (type == typeof(object))
-                return true;
-            bool res = domain.CrossBindingAdaptors.ContainsKey(type);
-            if (!res)
-            {
-                var baseType = type.BaseType;
-                if (baseType != null && baseType != typeof(object))
-                {
-                    res = CheckAssignableToCrossBindingAdapters(domain, baseType);
-                }
-            }
-            if (!res)
-            {
-                var interfaces = type.GetInterfaces();
-                foreach(var i in interfaces)
-                {
-                    res = CheckAssignableToCrossBindingAdapters(domain, i);
-                    if (res)
-                        break;
-                }
-            }
-            return res;
-        }
-
-        internal static bool HasByRefParam(this ParameterInfo[] param)
-        {
-            for (int j = param.Length; j > 0; j--)
-            {
-                var p = param[j - 1];
-                if (p.ParameterType.IsByRef)
-                    return true;
-            }
-            return false;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 3e91768ea7d0ed240bd26b8251c32ee8
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 186
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/CommonBindingGenerator.cs

@@ -1,186 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Text;
-using ILRuntime.Runtime.Enviorment;
-
-namespace ILRuntime.Runtime.CLRBinding
-{
-    static class CommonBindingGenerator
-    {
-        internal static string GenerateMiscRegisterCode(this Type type, string typeClsName, bool defaultCtor, bool newArr)
-        {
-            StringBuilder sb = new StringBuilder();
-
-            if (defaultCtor && !type.IsPrimitive && !type.IsAbstract)
-            {
-                var constructorFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
-                var hasDefaultConstructor = type.GetConstructor(constructorFlags, null, new Type[0], null) != null;
-
-                if (hasDefaultConstructor || type.IsValueType)
-                {
-                    sb.AppendLine(string.Format("            app.RegisterCLRCreateDefaultInstance(type, () => new {0}());", typeClsName));
-                }
-            }
-
-            if (newArr)
-            {
-                if (!type.IsAbstract || !type.IsSealed)
-                {
-                    if (type.IsArray)
-                    {
-                        Type elementType = type;
-                        int arrCnt = 0;
-                        while (elementType.IsArray)
-                        {
-                            elementType = elementType.GetElementType();
-                            arrCnt++;
-                        }
-                        string elem, clsName;
-                        bool isByRef;
-                        elementType.GetClassName(out clsName, out elem, out isByRef);
-                        string trail = "";
-                        for (int i = 0; i < arrCnt; i++)
-                            trail += "[]";
-                        sb.AppendLine(string.Format("            app.RegisterCLRCreateArrayInstance(type, s => new {0}[s]{1});", elem, trail));
-                    }
-                    else
-                        sb.AppendLine(string.Format("            app.RegisterCLRCreateArrayInstance(type, s => new {0}[s]);", typeClsName));
-                }
-            }
-
-            return sb.ToString();
-        }
-        internal static string GenerateCommonCode(this Type type, string typeClsName)
-        {
-            if (!type.IsValueType)
-                return "";
-            StringBuilder sb = new StringBuilder();
-            if (type.IsPrimitive)
-            {
-                sb.AppendLine(string.Format("        static {0} GetInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack)", typeClsName));
-                sb.AppendLine("        {");
-                if (type.IsPrimitive || type.IsValueType)
-                    sb.AppendLine("            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);");
-                sb.AppendLine(string.Format("            {0} instance_of_this_method;", typeClsName));
-                sb.Append(@"            switch(ptr_of_this_method->ObjectType)
-            {
-                case ObjectTypes.FieldReference:
-                    {
-                        var instance_of_fieldReference = __mStack[ptr_of_this_method->Value];
-                        if(instance_of_fieldReference is ILTypeInstance)
-                        {
-                            instance_of_this_method = (");
-                sb.Append(typeClsName);
-                sb.Append(")typeof(");
-                sb.Append(typeClsName);
-                
-                sb.Append(").CheckCLRTypes(((ILTypeInstance)instance_of_fieldReference)[ptr_of_this_method->ValueLow])");
-                sb.Append(";");
-                sb.Append(@"
-                        }
-                        else
-                        {
-                            var t = __domain.GetType(instance_of_fieldReference.GetType()) as CLRType;
-                            instance_of_this_method = (");
-                sb.Append(typeClsName);
-                sb.Append(")t.GetFieldValue(ptr_of_this_method->ValueLow, instance_of_fieldReference);");
-                sb.Append(@"
-                        }
-                    }
-                    break;
-                case ObjectTypes.StaticFieldReference:
-                    {
-                        var t = __domain.GetType(ptr_of_this_method->Value);
-                        if(t is ILType)
-                        {
-                            instance_of_this_method = (");
-                sb.Append(typeClsName);
-                sb.Append(")typeof(");
-                sb.Append(typeClsName);
-                sb.Append(").CheckCLRTypes(((ILType)t).StaticInstance[ptr_of_this_method->ValueLow])");
-                sb.Append(";");
-                sb.Append(@"
-                        }
-                        else
-                        {
-                            instance_of_this_method = (");
-                sb.Append(typeClsName);
-                sb.Append(@")((CLRType)t).GetFieldValue(ptr_of_this_method->ValueLow, null);
-                        }
-                    }
-                    break;
-                case ObjectTypes.ArrayReference:
-                    {
-                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ");
-                sb.Append(typeClsName);
-                sb.AppendLine(@"[];
-                        instance_of_this_method = instance_of_arrayReference[ptr_of_this_method->ValueLow];                        
-                    }
-                    break;
-                default:");
-                sb.AppendLine(string.Format("                    instance_of_this_method = {0};", type.GetRetrieveValueCode(typeClsName)));
-                sb.AppendLine(@"                    break;
-            }
-            return instance_of_this_method;");
-                sb.AppendLine("        }");
-            }
-            if (!type.IsPrimitive && !type.IsAbstract)
-            {
-                sb.AppendLine(string.Format("        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref {0} instance_of_this_method)", typeClsName));
-                sb.AppendLine("        {");
-                sb.AppendLine(@"            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            switch(ptr_of_this_method->ObjectType)
-            {
-                case ObjectTypes.Object:
-                    {
-                        __mStack[ptr_of_this_method->Value] = instance_of_this_method;");
-                sb.Append(@"                    }
-                    break;
-                case ObjectTypes.FieldReference:
-                    {
-                        var ___obj = __mStack[ptr_of_this_method->Value];
-                        if(___obj is ILTypeInstance)
-                        {
-                            ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method");
-                sb.Append(@";
-                        }
-                        else
-                        {
-                            var t = __domain.GetType(___obj.GetType()) as CLRType;
-                            t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method");
-                sb.Append(@");
-                        }
-                    }
-                    break;
-                case ObjectTypes.StaticFieldReference:
-                    {
-                        var t = __domain.GetType(ptr_of_this_method->Value);
-                        if(t is ILType)
-                        {
-                            ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method");
-                sb.Append(@";
-                        }
-                        else
-                        {
-                            ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method");
-                sb.Append(@");
-                        }
-                    }
-                    break;
-                 case ObjectTypes.ArrayReference:
-                    {
-                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ");
-                sb.Append(typeClsName);
-                sb.AppendLine(@"[];
-                        instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
-                    }
-                    break;
-            }");
-                sb.AppendLine(@"        }");
-            }
-            return sb.ToString();
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/CommonBindingGenerator.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: d2c990d8ba791ea41bdf7f8a58a4a713
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 348
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ConstructorBindingGenerator.cs

@@ -1,348 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Text;
-using ILRuntime.Runtime.Enviorment;
-
-namespace ILRuntime.Runtime.CLRBinding
-{
-    static class ConstructorBindingGenerator
-    {
-        internal static string GenerateConstructorRegisterCode(this Type type, ConstructorInfo[] methods, HashSet<MethodBase> excludes)
-        {
-            StringBuilder sb = new StringBuilder();
-            int idx = 0;
-            foreach (var i in methods)
-            {
-                if (excludes != null && excludes.Contains(i))
-                    continue;
-                if (type.ShouldSkipMethod(i))
-                    continue;
-                var param = i.GetParameters();
-                StringBuilder sb2 = new StringBuilder();
-                sb2.Append("{");
-                bool first = true;
-                foreach (var j in param)
-                {
-                    if (first)
-                        first = false;
-                    else
-                        sb2.Append(", ");
-                    sb2.Append("typeof(");
-                    string clsName, realClsName;
-                    bool isByRef;
-                    j.ParameterType.GetClassName(out clsName, out realClsName, out isByRef);
-                    sb2.Append(realClsName);
-                    sb2.Append(")");
-                    if (isByRef)
-                        sb2.Append(".MakeByRefType()");
-                }
-                sb2.Append("}");
-                sb.AppendLine(string.Format("            args = new Type[]{0};", sb2));
-                sb.AppendLine("            method = type.GetConstructor(flag, null, args, null);");
-                sb.AppendLine(string.Format("            app.RegisterCLRMethodRedirection(method, Ctor_{0});",idx));
-
-                idx++;
-            }
-            return sb.ToString();
-        }
-
-        internal static string GenerateConstructorWraperCode(this Type type, ConstructorInfo[] methods, string typeClsName, HashSet<MethodBase> excludes, List<Type> valueTypeBinders)
-        {
-            StringBuilder sb = new StringBuilder();
-
-            int idx = 0;
-            bool isMultiArr = type.IsArray && type.GetArrayRank() > 1;
-            foreach (var i in methods)
-            {
-                if (excludes != null && excludes.Contains(i))
-                    continue;
-                if (type.ShouldSkipMethod(i) || i.IsStatic)
-                    continue;
-                var param = i.GetParameters();
-                int paramCnt = param.Length;
-                sb.AppendLine(string.Format("        static StackObject* Ctor_{0}(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)", idx));
-                sb.AppendLine("        {");
-                sb.AppendLine("            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;");
-                if (param.Length != 0)
-                    sb.AppendLine("            StackObject* ptr_of_this_method;");
-                sb.AppendLine(string.Format("            StackObject* __ret = ILIntepreter.Minus(__esp, {0});", paramCnt));
-                bool hasByRef = param.HasByRefParam();
-                string shouldFreeParam = hasByRef ? "false" : "true";
-                for (int j = param.Length; j > 0; j--)
-                {
-                    var p = param[j - 1];
-                    sb.AppendLine(string.Format("            ptr_of_this_method = ILIntepreter.Minus(__esp, {0});", param.Length - j + 1));
-                    string clsName, realClsName;
-                    bool isByRef;
-                    p.ParameterType.GetClassName(out clsName, out realClsName, out isByRef);
-
-                    var pt = p.ParameterType.IsByRef ? p.ParameterType.GetElementType() : p.ParameterType;
-                    if (pt.IsValueType && !pt.IsPrimitive && valueTypeBinders != null && valueTypeBinders.Contains(pt))
-                    {
-                        if (isMultiArr)
-                            sb.AppendLine(string.Format("            {0} a{1} = new {0}();", realClsName, j));
-                        else
-                            sb.AppendLine(string.Format("            {0} @{1} = new {0}();", realClsName, p.Name));
-
-                        sb.AppendLine(string.Format("            if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                        if (isMultiArr)
-                            sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{1}_Binder.ParseValue(ref a{0}, __intp, ptr_of_this_method, __mStack, {2});", j, clsName, shouldFreeParam));
-                        else
-                            sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{1}_Binder.ParseValue(ref @{0}, __intp, ptr_of_this_method, __mStack, {2});", p.Name, clsName, shouldFreeParam));
-
-                        sb.AppendLine("            } else {");
-
-                        if (isByRef)
-                            sb.AppendLine("                ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);");
-                        if (isMultiArr)
-                            sb.AppendLine(string.Format("                a{0} = {1};", j, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                        else
-                            sb.AppendLine(string.Format("                @{0} = {1};", p.Name, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                        if (!hasByRef)
-                            sb.AppendLine("                __intp.Free(ptr_of_this_method);");
-
-                        sb.AppendLine("            }");
-                    }
-                    else
-                    {
-                        if (isByRef)
-                        {
-                            if (p.ParameterType.GetElementType().IsPrimitive)
-                            {
-                                if (pt == typeof(int) || pt == typeof(uint) || pt == typeof(short) || pt == typeof(ushort) || pt == typeof(byte) || pt == typeof(sbyte) || pt == typeof(char))
-                                {
-                                    if (pt == typeof(int))
-                                        sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveInt32(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                    else
-                                        sb.AppendLine(string.Format("            {0} @{1} = ({0})__intp.RetriveInt32(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(long) || pt == typeof(ulong))
-                                {
-                                    if (pt == typeof(long))
-                                        sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveInt64(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                    else
-                                        sb.AppendLine(string.Format("            {0} @{1} = ({0})__intp.RetriveInt64(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(float))
-                                {
-                                    sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveFloat(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(double))
-                                {
-                                    sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveDouble(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(bool))
-                                {
-                                    sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveInt32(ptr_of_this_method, __mStack) == 1;", realClsName, p.Name));
-                                }
-                                else
-                                    throw new NotSupportedException();
-                            }
-                            else
-                            {
-                                sb.AppendLine(string.Format("            {0} @{1} = ({0})typeof({0}).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));", realClsName, p.Name));
-                            }
-
-                        }
-                        else
-                        {
-                            if (isMultiArr)
-                                sb.AppendLine(string.Format("            {0} a{1} = {2};", realClsName, j, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                            else
-                                sb.AppendLine(string.Format("            {0} @{1} = {2};", realClsName, p.Name, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                            if (!hasByRef && !p.ParameterType.IsPrimitive)
-                                sb.AppendLine("            __intp.Free(ptr_of_this_method);");
-
-                        }
-                    }
-                    sb.AppendLine();
-                }
-                sb.AppendLine();
-                sb.Append("            var result_of_this_method = ");
-                {
-                    string clsName, realClsName;
-                    bool isByRef;
-                    if (isMultiArr)
-                    {
-                        type.GetElementType().GetClassName(out clsName, out realClsName, out isByRef);
-                        sb.Append(string.Format("new {0}[", realClsName));
-                        param.AppendParameters(sb, isMultiArr);
-                        sb.AppendLine("];");
-                    }
-                    else
-                    {
-                        type.GetClassName(out clsName, out realClsName, out isByRef);
-                        sb.Append(string.Format("new {0}(", realClsName));
-                        param.AppendParameters(sb, isMultiArr);
-                        sb.AppendLine(");");
-                    }
-                }
-                sb.AppendLine();
-
-                //Ref/Out
-                for (int j = param.Length; j > 0; j--)
-                {
-                    var p = param[j - 1];
-                    if (!p.ParameterType.IsByRef && !hasByRef)
-                    {
-                        continue;
-                    }
-                    string clsName, realClsName;
-                    bool isByRef;
-                    var pt = p.ParameterType.IsByRef ? p.ParameterType.GetElementType() : p.ParameterType;
-                    pt.GetClassName(out clsName, out realClsName, out isByRef);
-                    sb.AppendLine(string.Format("            ptr_of_this_method = ILIntepreter.Minus(__esp, {0});", param.Length - j + 1));
-                    if (p.ParameterType.IsByRef)
-                    {
-                        sb.AppendLine(@"            switch(ptr_of_this_method->ObjectType)
-            {
-                case ObjectTypes.StackObjectReference:
-                    {
-                        var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);");
-
-                        if (p.ParameterType.IsValueType && !p.ParameterType.IsPrimitive && valueTypeBinders != null && valueTypeBinders.Contains(p.ParameterType))
-                        {
-                            sb.AppendLine(string.Format("                if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                            sb.AppendLine(string.Format("                        ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder.WriteBackValue(__domain, ptr_of_this_method, __mStack, ref {1});", realClsName, p.Name));
-
-                            sb.AppendLine("                } else {");
-
-                            p.ParameterType.GetElementType().GetRefWriteBackValueCode(sb, p.Name);
-
-                            sb.AppendLine("                }");
-                        }
-                        else
-                        {
-                            p.ParameterType.GetElementType().GetRefWriteBackValueCode(sb, p.Name);
-                        }
-
-                        sb.Append(@"                    }
-                    break;
-                case ObjectTypes.FieldReference:
-                    {
-                        var ___obj = __mStack[ptr_of_this_method->Value];
-                        if(___obj is ILTypeInstance)
-                        {
-                            ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = ");
-                        sb.Append(p.Name);
-                        sb.Append(@";
-                        }
-                        else
-                        {
-                            var t = __domain.GetType(___obj.GetType()) as CLRType;
-                            t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, ");
-                        sb.Append(p.Name);
-                        sb.Append(@");
-                        }
-                    }
-                    break;
-                case ObjectTypes.StaticFieldReference:
-                    {
-                        var t = __domain.GetType(ptr_of_this_method->Value);
-                        if(t is ILType)
-                        {
-                            ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = ");
-                        sb.Append(p.Name);
-                        sb.Append(@";
-                        }
-                        else
-                        {
-                            ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, ");
-                        sb.Append(p.Name);
-                        sb.Append(@");
-                        }
-                    }
-                    break;
-                 case ObjectTypes.ArrayReference:
-                    {
-                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ");
-                        sb.Append(realClsName);
-                        sb.Append(@"[];
-                        instance_of_arrayReference[ptr_of_this_method->ValueLow] = ");
-                        sb.Append(p.Name);
-                        sb.AppendLine(@";
-                    }
-                    break;
-            }");
-                        sb.AppendLine();
-                    }
-                    else if (pt.IsValueType && !pt.IsPrimitive)
-                    {
-                        sb.AppendLine("            __intp.FreeStackValueType(ptr_of_this_method);");
-                    }
-
-                    sb.AppendLine("            __intp.Free(ptr_of_this_method);");
-                }
-
-                if (type.IsValueType)
-                {
-                    if (valueTypeBinders != null && valueTypeBinders.Contains(type))
-                    {
-                        string clsName, realClsName;
-                        bool isByRef;
-                        type.GetClassName(out clsName, out realClsName, out isByRef);
-
-                        sb.AppendLine(@"            if(!isNewObj)
-            {
-                __ret--;");
-
-                        sb.AppendLine(string.Format("                if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                        sb.AppendLine(string.Format("                    ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder.WriteBackValue(__domain, __ret, __mStack, ref result_of_this_method);", clsName));
-
-                        sb.AppendLine("                } else {");
-
-                        sb.AppendLine("                    WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);");
-
-                        sb.AppendLine("                }");
-
-                        sb.AppendLine(@"                return __ret;
-            }");
-                    }
-                    else
-                    {
-                        sb.AppendLine(@"            if(!isNewObj)
-            {
-                __ret--;
-                WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
-                return __ret;
-            }");
-                    }
-                    sb.AppendLine();
-                }
-
-                if (type.IsValueType && valueTypeBinders != null && valueTypeBinders.Contains(type))
-                {
-                    string clsName, realClsName;
-                    bool isByRef;
-                    type.GetClassName(out clsName, out realClsName, out isByRef);
-
-                    sb.AppendLine(string.Format("            if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                    sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder.PushValue(ref result_of_this_method, __intp, __ret, __mStack);", clsName));
-                    sb.AppendLine("                return __ret + 1;");
-
-                    sb.AppendLine("            } else {");
-
-                    sb.AppendLine("                return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);");
-
-                    sb.AppendLine("            }");
-                }
-                else
-                {
-                    sb.AppendLine("            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);");
-                }
-
-                sb.AppendLine("        }");
-                sb.AppendLine();
-                idx++;
-            }
-
-            return sb.ToString();
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ConstructorBindingGenerator.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 531c09b4001f4574dbe7f989aef71c18
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 114
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/FieldBindingGenerator.cs

@@ -1,114 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Text;
-using ILRuntime.Runtime.Enviorment;
-
-namespace ILRuntime.Runtime.CLRBinding
-{
-    static class FieldBindingGenerator
-    {
-        internal static string GenerateFieldRegisterCode(this Type type, FieldInfo[] fields, HashSet<FieldInfo> excludes)
-        {
-            StringBuilder sb = new StringBuilder();
-            int idx = 0;
-            foreach (var i in fields)
-            {
-                if (excludes != null && excludes.Contains(i))
-                    continue;
-                if (type.ShouldSkipField(i))
-                    continue;
-                if (i.IsSpecialName)
-                    continue;
-
-                sb.AppendLine(string.Format("            field = type.GetField(\"{0}\", flag);", i.Name));
-                sb.AppendLine(string.Format("            app.RegisterCLRFieldGetter(field, get_{0}_{1});", i.Name, idx));
-                if (!i.IsInitOnly && !i.IsLiteral)
-                {
-                    sb.AppendLine(string.Format("            app.RegisterCLRFieldSetter(field, set_{0}_{1});", i.Name, idx));
-                }
-
-                idx++;
-            }
-            return sb.ToString();
-        }
-
-        internal static string GenerateFieldWraperCode(this Type type, FieldInfo[] fields, string typeClsName, HashSet<FieldInfo> excludes)
-        {
-            StringBuilder sb = new StringBuilder();
-
-            int idx = 0;
-            foreach (var i in fields)
-            {
-                if (excludes != null && excludes.Contains(i))
-                    continue;
-                if (type.ShouldSkipField(i))
-                    continue;
-                sb.AppendLine(string.Format("        static object get_{0}_{1}(ref object o)", i.Name, idx));
-                sb.AppendLine("        {");
-                if (i.IsStatic)
-                {
-                    sb.AppendLine(string.Format("            return {0}.{1};", typeClsName, i.Name));
-                }
-                else
-                {
-                    sb.AppendLine(string.Format("            return (({0})o).{1};", typeClsName, i.Name));
-                }
-                sb.AppendLine("        }");
-
-                if (!i.IsInitOnly && !i.IsLiteral)
-                {
-                    sb.AppendLine(string.Format("        static void set_{0}_{1}(ref object o, object v)", i.Name, idx));
-                    sb.AppendLine("        {");
-                    string clsName, realClsName;
-                    bool isByRef;
-                    i.FieldType.GetClassName(out clsName, out realClsName, out isByRef);
-                    if (i.IsStatic)
-                    {
-                        sb.AppendLine(string.Format("            {0}.{1} = ({2})v;", typeClsName, i.Name, realClsName));
-                    }
-                    else
-                    {
-                        if (CheckCanPinn(type))
-                        {
-                            sb.AppendLine("            var h = GCHandle.Alloc(o, GCHandleType.Pinned);");
-                            sb.AppendLine(string.Format("            {0}* p = ({0} *)(void *)h.AddrOfPinnedObject();", typeClsName));
-                            sb.AppendLine(string.Format("            p->{0} = ({1})v;", i.Name, realClsName));
-                            sb.AppendLine("            h.Free();");
-                        }
-                        else
-                        {
-                            sb.AppendLine(string.Format("            (({0})o).{1} = ({2})v;", typeClsName, i.Name, realClsName));
-                        }
-                    }
-                    sb.AppendLine("        }");
-                }
-                idx++;
-            }
-
-            return sb.ToString();
-        }
-
-        internal static bool CheckCanPinn(this Type type)
-        {
-            if (type.IsValueType)
-            {
-                FieldInfo[] fi = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
-                bool res = true;
-                foreach(var i in fi)
-                {
-                    if(!i.FieldType.IsPrimitive)
-                    {
-                        res = false;
-                        break;
-                    }
-                }
-
-                return res;
-            }
-            else
-                return false;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/FieldBindingGenerator.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 9c0373a996c429f46ac5a2a2711f1793
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 649
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/MethodBindingGenerator.cs

@@ -1,649 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Text;
-using ILRuntime.Runtime.Enviorment;
-using ILRuntime.CLR.Utils;
-
-namespace ILRuntime.Runtime.CLRBinding
-{
-    static class MethodBindingGenerator
-    {
-        static string GenerateParameterTypes(MethodInfo i, bool needBracket)
-        {
-            string clsName, realClsName;
-            bool isByRef;
-            var param = i.GetParameters();
-            StringBuilder sb2 = new StringBuilder();
-            if (needBracket)
-                sb2.Append("{");
-            bool first = true;
-            foreach (var j in param)
-            {
-                if (first)
-                    first = false;
-                else
-                    sb2.Append(", ");
-                sb2.Append("typeof(");
-                j.ParameterType.GetClassName(out clsName, out realClsName, out isByRef);
-                sb2.Append(realClsName);
-                sb2.Append(")");
-                if (isByRef)
-                    sb2.Append(".MakeByRefType()");
-            }
-            if (needBracket)
-                sb2.Append("}");
-            return sb2.ToString();
-        }
-        internal static string GenerateMethodRegisterCode(this Type type, MethodInfo[] methods, HashSet<MethodBase> excludes, out bool needMethods)
-        {
-            needMethods = false;
-            MethodInfo[] allMethods = type.GetMethods();
-
-            StringBuilder sb = new StringBuilder();
-            int idx = 0;
-            bool isMethodsGot = false;
-            foreach (var i in methods)
-            {
-                if (excludes != null && excludes.Contains(i))
-                    continue;
-                if (type.ShouldSkipMethod(i))
-                    continue;
-
-                if (i.IsGenericMethod)
-                {
-                    if (!isMethodsGot)
-                    {
-                        sb.AppendLine(@"            Dictionary<string, List<MethodInfo>> genericMethods = new Dictionary<string, List<MethodInfo>>();
-            List<MethodInfo> lst = null;                    
-            foreach(var m in type.GetMethods())
-            {
-                if(m.IsGenericMethodDefinition)
-                {
-                    if (!genericMethods.TryGetValue(m.Name, out lst))
-                    {
-                        lst = new List<MethodInfo>();
-                        genericMethods[m.Name] = lst;
-                    }
-                    lst.Add(m);
-                }
-            }");
-                        isMethodsGot = true;
-                    }
-
-                    var param = i.GetGenericArguments();
-                    StringBuilder sb2 = new StringBuilder();
-                    sb2.Append("{");
-                    bool first = true;
-                    string clsName, realClsName;
-                    bool isByRef;
-                    foreach (var j in param)
-                    {
-                        if (first)
-                            first = false;
-                        else
-                            sb2.Append(", ");
-                        sb2.Append("typeof(");
-                        j.GetClassName(out clsName, out realClsName, out isByRef);
-                        sb2.Append(realClsName);
-                        sb2.Append(")");
-                        if (isByRef)
-                            sb2.Append(".MakeByRefType()");
-                    }
-                    sb2.Append("}");
-                    sb.AppendLine(string.Format("            args = new Type[]{0};", sb2));
-                    sb.AppendLine(string.Format("            if (genericMethods.TryGetValue(\"{0}\", out lst))", i.Name));
-                    sb.Append(@"            {
-                foreach(var m in lst)
-                {
-                    if(m.MatchGenericParameters(args, ");
-                    if (i.ReturnType != typeof(void))
-                    {
-                        sb.Append("typeof(");
-                        i.ReturnType.GetClassName(out clsName, out realClsName, out isByRef);
-                        sb.Append(realClsName);
-                        sb.Append(")");
-                    }
-                    else
-                        sb.Append("typeof(void)");
-                    if (i.GetParameters().Length > 0)
-                    {
-                        sb.Append(", ");
-                        sb.Append(GenerateParameterTypes(i, false));
-                    }
-                    sb.Append(@"))
-                    {
-                        method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, ");
-                    sb.AppendLine(string.Format("{0}_{1});", i.Name, idx));
-                    sb.AppendLine(@"
-                        break;
-                    }
-                }
-            }");
-                }
-                else
-                {
-                    string clsName, realClsName;
-                    bool isByRef;
-                    var param = i.GetParameters();
-                    string sb2 = GenerateParameterTypes(i, true);
-                    sb.AppendLine(string.Format("            args = new Type[]{0};", sb2));
-
-                    i.ReturnType.GetClassName(out clsName, out realClsName, out isByRef);
-                    if ((i.Name.Equals("op_Implicit") || i.Name.Equals("op_Explicit")) && allMethods.Count(m => m.Name.Equals(i.Name)) > 1)
-                    {
-                        // Type conversions can have different return types
-                        needMethods = true;
-                        sb.AppendLine(string.Format("            method = methods.Where(t => t.Name.Equals(\"{0}\") && t.ReturnType == typeof({1}) && t.CheckMethodParams(args)).Single();", i.Name, realClsName));
-                    }
-                    else if (allMethods.Any(m => m.IsGenericMethod && m.Name.Equals(i.Name) && m.CheckMethodParams(param)))
-                    {
-                        // Check for a generic method with the same name and params
-                        needMethods = true;
-                        sb.AppendLine(string.Format("            method = methods.Where(t => t.Name.Equals(\"{0}\") && t.CheckMethodParams(args)).Single();", i.Name));
-                    } else
-                        sb.AppendLine(string.Format("            method = type.GetMethod(\"{0}\", flag, null, args, null);", i.Name));
-
-                    sb.AppendLine(string.Format("            app.RegisterCLRMethodRedirection(method, {0}_{1});", i.Name, idx));
-                }
-
-                idx++;
-            }
-            return sb.ToString();
-        }
-    
-        internal static string GenerateMethodWraperCode(this Type type, MethodInfo[] methods, string typeClsName, HashSet<MethodBase> excludes, List<Type> valueTypeBinders, Enviorment.AppDomain domain)
-        {
-            StringBuilder sb = new StringBuilder();
-            bool isMultiArr = type.IsArray && type.GetArrayRank() > 1;
-            int idx = 0;
-            foreach (var i in methods)
-            {
-                if (excludes != null && excludes.Contains(i))
-                    continue;
-                if (type.ShouldSkipMethod(i))
-                    continue;
-                bool isProperty = i.IsSpecialName;
-                var param = i.GetParameters();
-                int paramCnt = param.Length;
-                if (!i.IsStatic)
-                    paramCnt++;
-                sb.AppendLine(string.Format("        static StackObject* {0}_{1}(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)", i.Name, idx));
-                sb.AppendLine("        {");
-                sb.AppendLine("            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;");
-                if (param.Length != 0 || !i.IsStatic)
-                    sb.AppendLine("            StackObject* ptr_of_this_method;");
-                sb.AppendLine(string.Format("            StackObject* __ret = ILIntepreter.Minus(__esp, {0});", paramCnt));
-                sb.AppendLine();
-                bool hasByRef = param.HasByRefParam();
-                string shouldFreeParam = hasByRef ? "false" : "true";
-                for (int j = param.Length; j > 0; j--)
-                {
-                    var p = param[j - 1];
-                    sb.AppendLine(string.Format("            ptr_of_this_method = ILIntepreter.Minus(__esp, {0});", param.Length - j + 1));
-                    string clsName, realClsName;
-                    bool isByRef;
-                    p.ParameterType.GetClassName(out clsName, out realClsName, out isByRef);
-                    var pt = p.ParameterType.IsByRef ? p.ParameterType.GetElementType() : p.ParameterType;
-                    if (pt.IsValueType && !pt.IsPrimitive && valueTypeBinders != null && valueTypeBinders.Contains(pt))
-                    {
-                        if (isMultiArr)
-                            sb.AppendLine(string.Format("            {0} a{1} = new {0}();", realClsName, j));
-                        else
-                            sb.AppendLine(string.Format("            {0} @{1} = new {0}();", realClsName, p.Name));
-
-                        sb.AppendLine(string.Format("            if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                        if (isMultiArr)
-                            sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{1}_Binder.ParseValue(ref a{0}, __intp, ptr_of_this_method, __mStack, {2});", j, clsName, shouldFreeParam));
-                        else
-                            sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{1}_Binder.ParseValue(ref @{0}, __intp, ptr_of_this_method, __mStack, {2});", p.Name, clsName, shouldFreeParam));
-
-                        sb.AppendLine("            } else {");
-
-                        if (isByRef)
-                            sb.AppendLine("                ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);");
-                        if (isMultiArr)
-                            sb.AppendLine(string.Format("                a{0} = {1};", j, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                        else
-                            sb.AppendLine(string.Format("                @{0} = {1};", p.Name, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                        if (!hasByRef)
-                            sb.AppendLine("                __intp.Free(ptr_of_this_method);");
-
-                        sb.AppendLine("            }");
-                    }
-                    else
-                    {
-                        if (isByRef)
-                        {
-                            if (p.ParameterType.GetElementType().IsPrimitive)
-                            {
-                                if (pt == typeof(int) || pt == typeof(uint) || pt == typeof(short) || pt == typeof(ushort) || pt == typeof(byte) || pt == typeof(sbyte) || pt == typeof(char))
-                                {
-                                    if (pt == typeof(int))
-                                        sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveInt32(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                    else
-                                        sb.AppendLine(string.Format("            {0} @{1} = ({0})__intp.RetriveInt32(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(long) || pt == typeof(ulong))
-                                {
-                                    if (pt == typeof(long))
-                                        sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveInt64(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                    else
-                                        sb.AppendLine(string.Format("            {0} @{1} = ({0})__intp.RetriveInt64(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(float))
-                                {
-                                    sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveFloat(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(double))
-                                {
-                                    sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveDouble(ptr_of_this_method, __mStack);", realClsName, p.Name));
-                                }
-                                else if (pt == typeof(bool))
-                                {
-                                    sb.AppendLine(string.Format("            {0} @{1} = __intp.RetriveInt32(ptr_of_this_method, __mStack) == 1;", realClsName, p.Name));
-                                }
-                                else
-                                    throw new NotSupportedException();
-                            }
-                            else
-                            {
-                                sb.AppendLine(string.Format("            {0} @{1} = ({0})typeof({0}).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));", realClsName, p.Name));
-                            }
-
-                        }
-                        else
-                        {
-                            if (isMultiArr)
-                                sb.AppendLine(string.Format("            {0} a{1} = {2};", realClsName, j, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                            else
-                                sb.AppendLine(string.Format("            {0} @{1} = {2};", realClsName, p.Name, p.ParameterType.GetRetrieveValueCode(realClsName)));
-                            if (!hasByRef && !p.ParameterType.IsPrimitive)
-                                sb.AppendLine("            __intp.Free(ptr_of_this_method);");
-
-                        }
-                    }
-                    sb.AppendLine();
-                }
-                if (!i.IsStatic)
-                {
-                    sb.AppendLine(string.Format("            ptr_of_this_method = ILIntepreter.Minus(__esp, {0});", paramCnt));
-                    if (type.IsPrimitive)
-                        sb.AppendLine(string.Format("            {0} instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack);", typeClsName));
-                    else if (type.IsValueType && !type.IsPrimitive && valueTypeBinders != null && valueTypeBinders.Contains(type))
-                    {
-                        string clsName, realClsName;
-                        bool isByRef;
-                        type.GetClassName(out clsName, out realClsName, out isByRef);
-
-                        sb.AppendLine(string.Format("            {0} instance_of_this_method = new {0}();", realClsName));
-
-                        sb.AppendLine(string.Format("            if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                        sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder.ParseValue(ref instance_of_this_method, __intp, ptr_of_this_method, __mStack, false);", clsName));
-
-                        sb.AppendLine("            } else {");
-
-                        if (type.IsValueType)
-                            sb.AppendLine("                ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);");
-                        sb.AppendLine(string.Format("                instance_of_this_method = {0};", type.GetRetrieveValueCode(typeClsName)));
-                        if (!type.IsValueType && !hasByRef)
-                            sb.AppendLine("                __intp.Free(ptr_of_this_method);");
-
-                        sb.AppendLine("            }");
-                    }
-                    else
-                    {
-                        if (type.IsValueType)
-                            sb.AppendLine("            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);");
-                        sb.AppendLine(string.Format("            {0} instance_of_this_method = {1};", typeClsName, type.GetRetrieveValueCode(typeClsName)));
-                        if (!type.IsValueType && !hasByRef)
-                            sb.AppendLine("            __intp.Free(ptr_of_this_method);");
-                    }
-                }
-                sb.AppendLine();
-                if (i.ReturnType != typeof(void))
-                {
-                    sb.Append("            var result_of_this_method = ");
-                }
-                else
-                    sb.Append("            ");
-                string genericArguments = "";
-                if (i.IsGenericMethod)
-                {
-                    var p = i.GetGenericArguments();
-                    StringBuilder sb2 = new StringBuilder();
-                    bool first = true;
-                    sb2.Append('<');
-                    foreach (var j in p)
-                    {
-                        if (first)
-                            first = false;
-                        else
-                            sb2.Append(", ");
-                        string clsName, realClsName;
-                        bool isByRef;
-                        j.GetClassName(out clsName, out realClsName, out isByRef);
-                        sb2.Append(realClsName);
-                    }
-                    sb2.Append('>');
-                    genericArguments = sb2.ToString();
-                }
-                if (i.IsStatic)
-                {
-                    if (isProperty)
-                    {
-                        string[] t = new string[2];
-                        int firstUnderlineIndex = i.Name.IndexOf("_");
-                        t[0] = i.Name.Substring(0, firstUnderlineIndex);
-                        t[1] = i.Name.Substring(firstUnderlineIndex + 1);
-                        string propType = t[0];
-
-                        if (propType == "get")
-                        {
-                            bool isIndexer = param.Length > 0;
-                            if (isIndexer)
-                            {
-                                sb.AppendLine(string.Format("{1}[{0}];", param[0].Name, typeClsName));
-                            }
-                            else
-                                sb.AppendLine(string.Format("{1}.{0};", t[1], typeClsName));
-                        }
-                        else if (propType == "set")
-                        {
-                            bool isIndexer = param.Length > 1;
-                            if (isIndexer)
-                            {
-                                sb.AppendLine(string.Format("{2}[{0}] = {1};", param[0].Name, param[1].Name, typeClsName));
-                            }
-                            else
-                                sb.AppendLine(string.Format("{2}.{0} = {1};", t[1], param[0].Name, typeClsName));
-                        }
-                        else if (propType == "op")
-                        {
-                            switch (t[1])
-                            {
-                                case "Equality":
-                                    sb.AppendLine(string.Format("{0} == {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "Inequality":
-                                    sb.AppendLine(string.Format("{0} != {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "Addition":
-                                    sb.AppendLine(string.Format("{0} + {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "Subtraction":
-                                    sb.AppendLine(string.Format("{0} - {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "Multiply":
-                                    sb.AppendLine(string.Format("{0} * {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "Division":
-                                    sb.AppendLine(string.Format("{0} / {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "GreaterThan":
-                                    sb.AppendLine(string.Format("{0} > {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "GreaterThanOrEqual":
-                                    sb.AppendLine(string.Format("{0} >= {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "LessThan":
-                                    sb.AppendLine(string.Format("{0} < {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "LessThanOrEqual":
-                                    sb.AppendLine(string.Format("{0} <= {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "UnaryNegation":
-                                    sb.AppendLine(string.Format("-{0};", param[0].Name));
-                                    break;
-                                case "Modulus":
-                                    sb.AppendLine(string.Format("{0} % {1};", param[0].Name, param[1].Name));
-                                    break;
-                                case "Implicit":
-                                case "Explicit":
-                                    {
-                                        string clsName, realClsName;
-                                        bool isByRef;
-                                        i.ReturnType.GetClassName(out clsName, out realClsName, out isByRef);
-                                        sb.AppendLine(string.Format("({1}){0};", param[0].Name, realClsName));
-                                    }
-                                    break;
-                                default:
-                                    throw new NotImplementedException(i.Name);
-                            }
-                        }
-                        else
-                            throw new NotImplementedException();
-                    }
-                    else
-                    {
-                        sb.Append(string.Format("{0}.{1}{2}(", typeClsName, i.Name, genericArguments));
-                        param.AppendParameters(sb);
-                        sb.AppendLine(");");
-                    }
-                }
-                else
-                {
-                    if (isProperty)
-                    {
-                        string[] t = new string[2];
-                        int firstUnderlineIndex = i.Name.IndexOf("_");
-                        t[0] = i.Name.Substring(0, firstUnderlineIndex);
-                        t[1] = i.Name.Substring(firstUnderlineIndex + 1);
-                        string propType = t[0];
-
-                        if (propType == "get")
-                        {
-                            bool isIndexer = param.Length > 0;
-                            if (isIndexer)
-                            {
-                                sb.AppendLine(string.Format("instance_of_this_method[{0}];", param[0].Name));
-                            }
-                            else
-                                sb.AppendLine(string.Format("instance_of_this_method.{0};", t[1]));
-                        }
-                        else if (propType == "set")
-                        {
-                            bool isIndexer = param.Length > 1;
-                            if (isIndexer)
-                            {
-                                sb.AppendLine(string.Format("instance_of_this_method[{0}] = {1};", param[0].Name, param[1].Name));
-                            }
-                            else
-                                sb.AppendLine(string.Format("instance_of_this_method.{0} = {1};", t[1], param[0].Name));
-                        }
-                        else
-                            throw new NotImplementedException();
-                    }
-                    else if (isMultiArr)
-                    {
-                        if (i.Name == "Get")
-                        {
-                            sb.Append("instance_of_this_method[");
-                            param.AppendParameters(sb, true);
-                            sb.AppendLine("];");
-                        }
-                        else
-                        {
-                            sb.Append("instance_of_this_method[");
-                            param.AppendParameters(sb, true, 1);
-                            sb.Append("]");
-                            sb.Append(" = a");
-                            sb.Append(param.Length);
-                            sb.AppendLine(";");
-                        }
-                    }
-                    else
-                    {
-                        sb.Append(string.Format("instance_of_this_method.{0}{1}(", i.Name, genericArguments));
-                        param.AppendParameters(sb);
-                        sb.AppendLine(");");
-                    }
-                }
-                sb.AppendLine();
-
-                //Ref/Out
-                for (int j = param.Length; j > 0; j--)
-                {
-                    var p = param[j - 1];
-                    if (!p.ParameterType.IsByRef && !hasByRef)
-                    {
-                        continue;
-                    }
-                    string clsName, realClsName;
-                    bool isByRef;
-                    var pt = p.ParameterType.IsByRef ? p.ParameterType.GetElementType() : p.ParameterType;
-                    pt.GetClassName(out clsName, out realClsName, out isByRef);
-                    sb.AppendLine(string.Format("            ptr_of_this_method = ILIntepreter.Minus(__esp, {0});", param.Length - j + 1));
-                    if (p.ParameterType.IsByRef)
-                    {
-                        sb.AppendLine(@"            switch(ptr_of_this_method->ObjectType)
-            {
-                case ObjectTypes.StackObjectReference:
-                    {
-                        var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);");
-
-                        if (pt.IsValueType && !pt.IsPrimitive && valueTypeBinders != null && valueTypeBinders.Contains(pt))
-                        {
-                            sb.AppendLine(string.Format("                if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                            sb.AppendLine(string.Format("                        ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder.WriteBackValue(__domain, ptr_of_this_method, __mStack, ref {1});", clsName, p.Name));
-
-                            sb.AppendLine("                } else {");
-
-                            pt.GetRefWriteBackValueCode(sb, p.Name);
-
-                            sb.AppendLine("                }");
-                        }
-                        else
-                        {
-                            pt.GetRefWriteBackValueCode(sb, p.Name);
-                        }
-
-                        sb.Append(@"                    }
-                    break;
-                case ObjectTypes.FieldReference:
-                    {
-                        var ___obj = __mStack[ptr_of_this_method->Value];
-                        if(___obj is ILTypeInstance)
-                        {
-                            ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @");
-                        sb.Append(p.Name);
-                        sb.Append(@";
-                        }
-                        else
-                        {
-                            var ___type = __domain.GetType(___obj.GetType()) as CLRType;
-                            ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @");
-                        sb.Append(p.Name);
-                        sb.Append(@");
-                        }
-                    }
-                    break;
-                case ObjectTypes.StaticFieldReference:
-                    {
-                        var ___type = __domain.GetType(ptr_of_this_method->Value);
-                        if(___type is ILType)
-                        {
-                            ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @");
-                        sb.Append(p.Name);
-                        sb.Append(@";
-                        }
-                        else
-                        {
-                            ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @");
-                        sb.Append(p.Name);
-                        sb.Append(@");
-                        }
-                    }
-                    break;
-                 case ObjectTypes.ArrayReference:
-                    {
-                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ");
-                        sb.Append(realClsName);
-                        sb.Append(@"[];
-                        instance_of_arrayReference[ptr_of_this_method->ValueLow] = @");
-                        sb.Append(p.Name);
-                        sb.AppendLine(@";
-                    }
-                    break;
-            }");
-                        sb.AppendLine();
-                    }
-                    else if(pt.IsValueType && !pt.IsPrimitive)
-                    {
-                        sb.AppendLine("            __intp.FreeStackValueType(ptr_of_this_method);");
-                    }
-
-                    sb.AppendLine("            __intp.Free(ptr_of_this_method);");
-                }
-
-                if (!i.IsStatic && ((type.IsValueType && !type.IsPrimitive) || hasByRef))//need to write back value type instance
-                {
-                    sb.AppendLine(string.Format("            ptr_of_this_method = ILIntepreter.Minus(__esp, {0});", paramCnt));
-
-                    if (type.IsValueType && !type.IsPrimitive)
-                    {
-                        if (valueTypeBinders != null && valueTypeBinders.Contains(type))
-                        {
-                            string clsName, realClsName;
-                            bool isByRef;
-                            type.GetClassName(out clsName, out realClsName, out isByRef);
-
-                            sb.AppendLine(string.Format("            if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                            sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder.WriteBackValue(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);", clsName));
-
-                            sb.AppendLine("            } else {");
-
-                            sb.AppendLine("                WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);");
-
-                            sb.AppendLine("            }");
-                        }
-                        else
-                        {
-                            sb.AppendLine("            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);");
-                        }
-                        sb.AppendLine();
-                    }
-                    sb.AppendLine("            __intp.Free(ptr_of_this_method);");
-                }
-                
-                if (i.ReturnType != typeof(void))
-                {
-                    if (i.ReturnType.IsValueType && !i.ReturnType.IsPrimitive && valueTypeBinders != null && valueTypeBinders.Contains(i.ReturnType))
-                    {
-                        string clsName, realClsName;
-                        bool isByRef;
-                        i.ReturnType.GetClassName(out clsName, out realClsName, out isByRef);
-
-                        sb.AppendLine(string.Format("            if (ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder != null) {{", clsName));
-
-                        sb.AppendLine(string.Format("                ILRuntime.Runtime.Generated.CLRBindings.s_{0}_Binder.PushValue(ref result_of_this_method, __intp, __ret, __mStack);", clsName));
-                        sb.AppendLine("                return __ret + 1;");
-
-                        sb.AppendLine("            } else {");
-
-                        i.ReturnType.GetReturnValueCode(sb, domain);
-
-                        sb.AppendLine("            }");
-                    }
-                    else
-                    {
-                        i.ReturnType.GetReturnValueCode(sb, domain);
-                    }
-                }
-                else
-                    sb.AppendLine("            return __ret;");
-                sb.AppendLine("        }");
-                sb.AppendLine();
-                idx++;
-            }
-
-            return sb.ToString();
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/MethodBindingGenerator.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 3e7a4b0b251e3c24bbc7fbb93dc9d799
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 38
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ValueTypeBindingGenerator.cs

@@ -1,38 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Text;
-using ILRuntime.Runtime.Enviorment;
-
-namespace ILRuntime.Runtime.CLRBinding
-{
-    static class ValueTypeBindingGenerator
-    {
-        internal static string GenerateValueTypeRegisterCode(this Type type, string typeClsName)
-        {
-            StringBuilder sb = new StringBuilder();
-
-            if (type.IsValueType && !type.IsPrimitive && !type.IsEnum)
-            {
-                sb.AppendLine("            app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone);");
-            }
-            return sb.ToString();
-        }
-
-        internal static string GenerateCloneWraperCode(this Type type, FieldInfo[] fields, string typeClsName)
-        {
-            if (!type.IsValueType || type.IsPrimitive) return string.Empty;
-            StringBuilder sb = new StringBuilder();
-
-            sb.AppendLine("        static object PerformMemberwiseClone(ref object o)");
-            sb.AppendLine("        {");
-            sb.AppendLine(string.Format("            var ins = new {0}();", typeClsName));
-            sb.AppendLine(string.Format("            ins = ({0})o;", typeClsName));
-            sb.AppendLine("            return ins;");
-            sb.AppendLine("        }");
-            return sb.ToString();
-
-        }
-    }
-}

+ 0 - 11
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/ValueTypeBindingGenerator.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 668af796108e80c408d8997b279d5728
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Debugger.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d13f66766121a994fae9cf07b8221201
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 61
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Debugger/BreakPointContext.cs

@@ -1,61 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Runtime.Stack;
-namespace ILRuntime.Runtime.Debugger
-{
-    unsafe class BreakPointContext
-    {
-        public ILIntepreter Interpreter { get; set; }
-        public Exception Exception { get; set; }
-
-        public string DumpContext()
-        {
-            /*StringBuilder sb = new StringBuilder();
-            if (Exception != null)
-                sb.AppendLine(Exception.Message);
-            StackFrame[] frames = Interpreter.Stack.Frames.ToArray();
-            StackFrame topFrame = frames[0];
-            var m = topFrame.Method;
-            if (m.HasThis)
-            {
-                sb.AppendLine("this:");
-                sb.AppendLine(DebugService.Instance.GetThisInfo(Interpreter));
-            }
-            sb.AppendLine("->" + topFrame.Method.Definition.Body.Instructions[topFrame.Address.Value]);
-            sb.AppendLine("Local Variables:");
-            sb.AppendLine(DebugService.Instance.GetLocalVariableInfo(Interpreter));
-
-            sb.Append(DebugService.Instance.GetStackTrance(Interpreter));
-            return sb.ToString();*/
-            return null;
-        }
-
-        string GetStackObjectValue(StackObject val, IList<object> mStack)
-        {
-            string v;
-            switch (val.ObjectType)
-            {
-                case ObjectTypes.Null:
-                    v = "null";
-                    break;
-                case ObjectTypes.Integer:
-                    v = val.Value.ToString();
-                    break;
-                case ObjectTypes.Object:
-                    {
-                        object obj = Interpreter.Stack.ManagedStack[val.Value];
-                        v = obj.ToString();
-                    }
-                    break;
-                default:
-                    v = "Unknown type";
-                    break;
-            }
-            return v;
-        }        
-    }
-}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików