Esempio n. 1
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding.Register(app);
            System_Object_Binding.Register(app);
            System_Reflection_MemberInfo_Binding.Register(app);
            System_String_Binding.Register(app);
            MotionEngine_LogSystem_Binding.Register(app);
            System_Collections_Generic_List_1_Int32_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_KeyValuePair_2_Int32_ILTypeInstance_Binding.Register(app);
            System_IDisposable_Binding.Register(app);
            System_Collections_Generic_List_1_Int64_Binding.Register(app);
            System_Collections_Generic_List_1_Single_Binding.Register(app);
            System_Collections_Generic_List_1_Double_Binding.Register(app);
            System_Collections_Generic_List_1_String_Binding.Register(app);
            MotionEngine_IO_StringConvert_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_List_1_Action_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_List_1_Action_1_ILTypeInstance_Binding_KeyCollection_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_List_1_Action_1_ILTypeInstance_Binding_KeyCollection_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_List_1_Action_1_ILTypeInstance_Binding.Register(app);
            System_Action_1_ILTypeInstance_Binding.Register(app);
            UnityEngine_Debug_Binding.Register(app);
            MotionEngine_Res_AssetObject_Binding.Register(app);
            MotionEngine_Res_Asset_Binding.Register(app);
            MotionGame_EventManager_Binding.Register(app);
            MotionGame_NetManager_Binding.Register(app);
            TestEventMsg_Binding.Register(app);
            UnityEngine_Object_Binding.Register(app);
            UnityEngine_GameObject_Binding.Register(app);
            UnityEngine_TransformExtension_Binding.Register(app);
            UnityEngine_Transform_Binding.Register(app);
            UnityEngine_UI_UIManifest_Binding.Register(app);
            UnityEngine_UI_Text_Binding.Register(app);
            UnityEngine_UI_Button_Binding.Register(app);
            UnityEngine_Events_UnityEvent_Binding.Register(app);
            MotionGame_AudioManager_Binding.Register(app);
            UnityEngine_UI_UISprite_Binding.Register(app);
            System_Type_Binding.Register(app);
            UnityEngine_Time_Binding.Register(app);
            Google_Protobuf_ProtoPreconditions_Binding.Register(app);
            Google_Protobuf_CodedOutputStream_Binding.Register(app);
            Google_Protobuf_CodedInputStream_Binding.Register(app);
            MotionGame_ILRManager_Binding.Register(app);
            System_Collections_Generic_List_1_Type_Binding.Register(app);
            System_Attribute_Binding.Register(app);
            MotionGame_NetMessageAttribute_Binding.Register(app);
            MotionGame_DoubleMap_2_UInt16_Type_Binding.Register(app);
            System_Exception_Binding.Register(app);
            MotionGame_NetReceivePackage_Binding.Register(app);
            System_Activator_Binding.Register(app);
            MotionGame_ProtobufHelper_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
            s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
            s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
        }
Esempio n. 2
0
        void InitCodeBody()
        {
            if (def.HasBody)
            {
                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);
                }

                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.
                }
            }
            else
            {
                body = new OpCode[0];
            }
        }
Esempio n. 3
0
 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;
 }
 /// <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;
     __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
     s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
     __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
     s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
     __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
     s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
 }
Esempio n. 5
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            System_Type_Binding.Register(app);
            ComponentOwner_Binding.Register(app);
            FrameBase_Binding.Register(app);
            CommandSystem_Binding.Register(app);
            UnityEngine_Vector3_Binding.Register(app);
            MathUtility_Binding.Register(app);
            Transformable_Binding.Register(app);
            GameScene_Binding.Register(app);
            LT_Binding.Register(app);
            UnityUtility_Binding.Register(app);
            CommandCharacterManagerCreateCharacter_Binding.Register(app);
            CharacterManager_Binding.Register(app);
            Character_Binding.Register(app);
            CommandCharacterManagerDestroy_Binding.Register(app);
            CommandGameSceneManagerEnter_Binding.Register(app);
            GameBase_Binding.Register(app);
            System_Object_Binding.Register(app);
            MovableObject_Binding.Register(app);
            CommandReceiver_Binding.Register(app);
            Command_Binding.Register(app);
            FrameSystem_Binding.Register(app);
            GameComponent_Binding.Register(app);
            PlayerState_Binding.Register(app);
            PooledWindow_Binding.Register(app);
            SceneInstance_Binding.Register(app);
            SceneProcedure_Binding.Register(app);
            LayoutScript_Binding.Register(app);
            SQLiteData_Binding.Register(app);
            SQLiteTable_Binding.Register(app);
            StateParam_Binding.Register(app);
            GameLayout_Binding.Register(app);
            LayoutManager_Binding.Register(app);
            StringUtility_Binding.Register(app);
            System_String_Binding.Register(app);
            myUGUIText_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
            s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
            s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2Int));
            s_UnityEngine_Vector2Int_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2Int>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3Int));
            s_UnityEngine_Vector3Int_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3Int>;
        }
Esempio n. 6
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            Framework_Utility_StringUtility_Binding.Register(app);
            System_Type_Binding.Register(app);
            UnityEngine_Debug_Binding.Register(app);
            System_Activator_Binding.Register(app);
            System_String_Binding.Register(app);
            System_Reflection_MemberInfo_Binding.Register(app);
            System_Object_Binding.Register(app);
            System_Reflection_PropertyInfo_Binding.Register(app);
            System_Collections_Generic_List_1_Button_Binding.Register(app);
            System_Collections_Generic_List_1_Button_Binding_Enumerator_Binding.Register(app);
            UnityEngine_Object_Binding.Register(app);
            UnityEngine_UI_Button_Binding.Register(app);
            UnityEngine_Events_UnityEvent_Binding.Register(app);
            System_IDisposable_Binding.Register(app);
            UnityEngine_Events_UnityEventBase_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Queue_1_ILTypeInstance_Binding.Register(app);
            System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Binding.Register(app);
            System_Threading_Tasks_Task_Binding.Register(app);
            System_Runtime_CompilerServices_TaskAwaiter_Binding.Register(app);
            UnityEngine_GameObject_Binding.Register(app);
            UnityEngine_Canvas_Binding.Register(app);
            Framework_Module_Resource_ResourceLoader_Binding.Register(app);
            System_Threading_Tasks_Task_1_GameObject_Binding.Register(app);
            System_Runtime_CompilerServices_TaskAwaiter_1_GameObject_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding.Register(app);
            System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_GameObject_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_GameObject_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_KeyValuePair_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Stack_1_ILTypeInstance_Binding.Register(app);
            System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Binding.Register(app);
            Framework_Module_Resource_IResourceLoader_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_List_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding_ValueCollection_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding_ValueCollection_Binding_Enumerator_Binding.Register(app);
            System_ValueTuple_3_Int32_String_Boolean_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
            s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
            s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
        }
Esempio n. 7
0
        public IlRuntime(byte[] dat, RectTransform uiRoot)
        {
            _app = new ILRuntime.Runtime.Enviorment.AppDomain();
            RegDelegate();
            using (MemoryStream m = new MemoryStream(dat))
            {
                _app.LoadAssembly(m);
            }
            mainScript = _app.GetType("Main") as ILType;
            var start = mainScript.GetMethod("Start");

            if (start != null)
            {
                try
                {
                    _app.Invoke(mainScript.FullName, start.Name, mainScript, uiRoot);
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.StackTrace);
                }
            }
            Update = mainScript.GetMethod("Update");
            Resize = mainScript.GetMethod("Resize");
            Cmd    = mainScript.GetMethod("Cmd");
        }
Esempio n. 8
0
        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;
#if DEBUG
            if (def.HasBody)
            {
                var sp = DebugService.FindSequencePoint(def.Body.Instructions[0]);
                if (sp != null)
                {
                    StartLine = sp.StartLine;
                    sp        = DebugService.FindSequencePoint(def.Body.Instructions[def.Body.Instructions.Count - 1]);
                    if (sp != null)
                    {
                        EndLine = sp.EndLine;
                    }
                }
            }
#endif
        }
 public ILInstanceMethod Fill(object instance, string typeFullName, string methodName, int paramCount)
 {
     m_AppDomain   = GameEntry.Hotfix.ILAppDomain;
     this.m_Method = m_AppDomain.GetType(typeFullName).GetMethod(methodName, paramCount);
     SetInstance(instance, paramCount);
     return(this);
 }
Esempio n. 10
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            System_Collections_Generic_List_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_Int32_Binding.Register(app);
            UnityEngine_Debug_Binding.Register(app);
            System_Diagnostics_Stopwatch_Binding.Register(app);
            UnityEngine_Vector3_Binding.Register(app);
            System_Object_Binding.Register(app);
            System_String_Binding.Register(app);
            System_Boolean_Binding.Register(app);
            System_Single_Binding.Register(app);
            UnityEngine_Quaternion_Binding.Register(app);
            UnityEngine_Vector2_Binding.Register(app);
            UnityEngine_Vector2Int_Binding.Register(app);
            System_Int32_Binding.Register(app);
            UnityEngine_Vector3Int_Binding.Register(app);
            UnityEngine_Vector4_Binding.Register(app);
            System_DateTime_Binding.Register(app);
            System_TimeSpan_Binding.Register(app);
            System_Collections_Generic_List_1_Type_Binding.Register(app);
            System_Type_Binding.Register(app);
            UnityEngine_Time_Binding.Register(app);
            UnityEngine_GameObject_Binding.Register(app);
            System_Collections_Generic_List_1_Int32_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
        }
Esempio n. 11
0
        private void LoadHotFix()
        {
            byte[] assBytes;
            byte[] pdbBytes;
            Addressables.LoadAssetAsync <TextAsset>("Dll/hotfix.dll").Completed += dll =>
            {
                assBytes = dll.Result.bytes;
                Addressables.LoadAssetAsync <TextAsset>("Dll/hotfix.pdb").Completed += pdb =>
                {
                    pdbBytes = pdb.Result.bytes;
#if ILRuntime
                    Debug.Log($"当前使用的是ILRuntime模式");
                    this.appDomain = new ILRuntime.Runtime.Enviorment.AppDomain();
                    this.dllStream = new MemoryStream(assBytes);
                    this.pdbStream = new MemoryStream(pdbBytes);
                    //this.pdbStream = null;//调试文件 出错加载会报错
                    this.appDomain.LoadAssembly(this.dllStream, this.pdbStream, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider());

                    ILHelper.InitILRuntime(this.appDomain);
                    var iMethod = appDomain.GetType(GamePath.IL_Entry).GetMethod("Awake", 0);
                    this.appDomain.Invoke(iMethod, null, null);
#else
                    Debug.Log($"当前使用的是Mono模式");
                    this.assembly    = Assembly.Load(assBytes, pdbBytes);
                    this.hotfixTypes = this.assembly.GetTypes().ToList();
                    var methodInfo = assembly.GetType(GamePath.IL_Entry).GetMethod("Awake");
                    methodInfo?.Invoke(null, new object[methodInfo.GetParameters().Length]);
#endif
                };
            };
        }
Esempio n. 12
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            HotFixBaseGui_Binding.Register(app);
            UnityEngine_GameObject_Binding.Register(app);
            Omnana_GameObjectRef_Binding.Register(app);
            UnityEngine_UI_Button_Binding.Register(app);
            UnityEngine_Events_UnityEvent_Binding.Register(app);
            UIExtensions_Binding.Register(app);
            System_String_Binding.Register(app);
            UnityEngine_UI_Text_Binding.Register(app);
            UnityEngine_Object_Binding.Register(app);
            UnityEngine_UI_Graphic_Binding.Register(app);
            DG_Tweening_ShortcutExtensions_Binding.Register(app);
            Omnana_ServiceBase_Binding.Register(app);
            Omnana_BaseCtrl_Binding.Register(app);
            Omnana_BindableProperty_1_String_Binding.Register(app);
            Omnana_ServiceLocator_Binding.Register(app);
            Omnana_MessageAggregator_1_Object_Binding.Register(app);
            Omnana_MessageAggregator_1_String_Binding.Register(app);
            Omnana_MessageArgs_1_String_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
        }
Esempio n. 13
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            UnityEngine_Debug_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_Int32_Binding.Register(app);
            LitJson_JsonMapper_Binding.Register(app);
            System_Diagnostics_Stopwatch_Binding.Register(app);
            UnityEngine_Vector3_Binding.Register(app);
            System_String_Binding.Register(app);
            System_Boolean_Binding.Register(app);
            System_Object_Binding.Register(app);
            UnityEngine_Quaternion_Binding.Register(app);
            UnityEngine_Vector2_Binding.Register(app);
            UnityEngine_Time_Binding.Register(app);
            UnityEngine_GameObject_Binding.Register(app);
            CoroutineDemo_Binding.Register(app);
            UnityEngine_WaitForSeconds_Binding.Register(app);
            System_NotSupportedException_Binding.Register(app);
            CLRBindingTestClass_Binding.Register(app);
            TestClassBase_Binding.Register(app);
            TestDelegateMethod_Binding.Register(app);
            TestDelegateFunction_Binding.Register(app);
            System_Action_1_String_Binding.Register(app);
            DelegateDemo_Binding.Register(app);
            System_Int32_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
        }
Esempio n. 14
0
 public void Load(byte[] dat, byte[] pdb = null)
 {
     if (dllStream != null)
     {
         dllStream.Dispose();
     }
     if (pdbStream != null)
     {
         pdbStream.Dispose();
     }
     dll       = dat;
     dllStream = new MemoryStream(dat);
     if (pdb != null)
     {
         pdbStream = new MemoryStream(pdb);
         _app.LoadAssembly(dllStream, pdbStream, new ILRuntime.Mono.Cecil.Cil.PortablePdbReaderProvider());
     }
     else
     {
         _app.LoadAssembly(dllStream);
     }
     mainScript = _app.GetType("Main") as ILType;
     start      = mainScript.GetMethod("Start");
     Update     = mainScript.GetMethod("Update");
     Resize     = mainScript.GetMethod("Resize");
     Cmd        = mainScript.GetMethod("Cmd");
     FullCmd    = mainScript.GetMethod("FullCmd");
     Dispose    = mainScript.GetMethod("Dispose");
 }
Esempio n. 15
0
        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
        }
Esempio n. 16
0
 public static List <IType> GetParamList(this MethodReference def, ILRuntime.Runtime.Enviorment.AppDomain appdomain, IType contextType)
 {
     if (def.HasParameters)
     {
         List <IType> param = new List <IType>();
         var          dt    = appdomain.GetType(def.DeclaringType, contextType);
         foreach (var i in def.Parameters)
         {
             IType t = null;
             t = appdomain.GetType(i.ParameterType, dt);
             if (t == null && def.IsGenericInstance)
             {
                 GenericInstanceMethod gim = (GenericInstanceMethod)def;
                 string name = 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);
                         break;
                     }
                     else if (name.Contains(gp.Name))
                     {
                         name = name.Replace(gp.Name, ga.FullName);
                     }
                 }
                 if (t == null)
                 {
                     t = appdomain.GetType(name);
                 }
             }
             if (t == null)
             {
                 throw new KeyNotFoundException("Cannot find type:" + i.ParameterType);
             }
             param.Add(t);
         }
         return(param);
     }
     else
     {
         return(EmptyParamList);
     }
 }
Esempio n. 17
0
        public void Unity2Hotfix(GameObject go, Type t)
        {
#if ILRuntime
            IType   classType        = appDomain.GetType(t.FullName);
            IType[] genericArguments = new IType[] { classType };
            Debug.LogWarning("替换Unity域脚本为热更域脚本" + t);
            appDomain.InvokeGenericMethod("ETHotfix.Init", "Unity2Hotfix", genericArguments, null, go);
#endif
        }
Esempio n. 18
0
        public static IMethod[] GetMethodInfo(string typeName)
        {
            ILRuntime.Runtime.Enviorment.AppDomain appDomain = Init.Instance.AppDomain;
            if (appDomain == null)
            {
                return(new IMethod[0]);
            }

            return(appDomain.GetType(typeName).GetMethods().ToArray());
        }
Esempio n. 19
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            System_Object_Binding.Register(app);
            System_String_Binding.Register(app);
            System_Func_1_Int32_Binding.Register(app);
            System_Action_1_ILTypeInstance_Binding.Register(app);
            System_Exception_Binding.Register(app);
            FP_Binding.Register(app);
            TSVector2_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding.Register(app);
            System_Func_3_ILTypeInstance_Int32_ILTypeInstance_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
            s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
            s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2Int));
            s_UnityEngine_Vector2Int_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2Int>;
            __clrType                  = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(global::FP));
            s_FP_Binding_Binder        = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <global::FP>;
            __clrType                  = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(global::TSVector2));
            s_TSVector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <global::TSVector2>;
        }
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            UnityEngine_Debug_Binding.Register(app);
            TinaX_XCore_Binding.Register(app);
            TinaX_IXCore_Binding.Register(app);
            System_Array_Binding.Register(app);
            TinaX_Container_IServiceContainer_Binding.Register(app);
            TinaX_UIKit_IUIKit_Binding.Register(app);
            TinaX_VFSKit_IVFS_Binding.Register(app);
            System_Exception_Binding.Register(app);
            System_String_Binding.Register(app);
            TinaX_VFSKit_ISceneAsset_Binding.Register(app);
            TinaX_UIKit_DataBinding_BindableProperty_1_Int32_Binding.Register(app);
            UnityEngine_UI_Button_Binding.Register(app);
            UnityEngine_Events_UnityEvent_Binding.Register(app);
            TinaX_I18N_II18N_Binding.Register(app);
            UnityEngine_UI_Text_Binding.Register(app);
            System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Binding.Register(app);
            System_Threading_Tasks_Task_1_IAsset_Binding.Register(app);
            System_Runtime_CompilerServices_TaskAwaiter_1_IAsset_Binding.Register(app);
            TinaX_VFSKit_IAsset_Binding.Register(app);
            UnityEngine_TextAsset_Binding.Register(app);
            System_IDisposable_Binding.Register(app);
            TinaX_UIKit_OpenUIParam_Binding.Register(app);
            System_Object_Binding.Register(app);
            System_Threading_Tasks_Task_1_IUIEntity_Binding.Register(app);
            System_Runtime_CompilerServices_TaskAwaiter_1_IUIEntity_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
            s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
            s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Color));
            s_UnityEngine_Color_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Color>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3Int));
            s_UnityEngine_Vector3Int_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3Int>;
        }
Esempio n. 21
0
        public ILMethod(MethodDefinition def, ILType type, ILRuntime.Runtime.Enviorment.AppDomain domain, int flags)
        {
            this.def      = def;
            declaringType = type;
            this.jitFlags = flags;
            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 (def.HasCustomAttributes)
            {
                for (int i = 0; i < def.CustomAttributes.Count; i++)
                {
                    int f;
                    if (def.CustomAttributes[i].GetJITFlags(domain, out f))
                    {
                        this.jitFlags = f;
                        break;
                    }
                }
            }
            jitImmediately = (jitFlags & ILRuntimeJITFlags.JITImmediately) == ILRuntimeJITFlags.JITImmediately;
            jitOnDemand    = (jitFlags & ILRuntimeJITFlags.JITOnDemand) == ILRuntimeJITFlags.JITOnDemand;
//#if DEBUG && !DISABLE_ILRUNTIME_DEBUG
#if HOT_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
        }
Esempio n. 22
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            UnityEngine_Debug_Binding.Register(app);
            System_String_Binding.Register(app);
            HFFramework_HFLog_Binding.Register(app);
            HFFramework_IDGenerator_Binding.Register(app);
            UnityEngine_Object_Binding.Register(app);
            UnityEngine_GameObject_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding.Register(app);
            Cysharp_Threading_Tasks_CompilerServices_AsyncUniTaskMethodBuilder_Binding.Register(app);
            UnityEngine_Transform_Binding.Register(app);
            UnityEngine_Component_Binding.Register(app);
            HFFramework_NotificationCenter_Binding.Register(app);
            System_Collections_Generic_HashSet_1_UInt64_Binding.Register(app);
            System_Int64_Binding.Register(app);
            System_Collections_Generic_HashSet_1_UInt64_Binding_Enumerator_Binding.Register(app);
            System_IDisposable_Binding.Register(app);
            System_Object_Binding.Register(app);
            System_Reflection_MemberInfo_Binding.Register(app);
            HFFramework_AssetManager_Binding.Register(app);
            Cysharp_Threading_Tasks_UniTask_1_GameObject_Binding.Register(app);
            Cysharp_Threading_Tasks_UniTask_1_GameObject_Binding_Awaiter_Binding.Register(app);
            System_Type_Binding.Register(app);
            System_Activator_Binding.Register(app);
            HFFramework_GameFactory_Binding.Register(app);
            UnityEngine_Time_Binding.Register(app);
            HFFramework_GameLooper_Binding.Register(app);
            UnityEngine_MonoBehaviour_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
            s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
            s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
        }
Esempio n. 23
0
        void PrewarmBody(HashSet <ILMethod> alreadyPrewarmed)
        {
            //当前方法用到的IType,提前InitializeMethods()。各个子调用,提前InitParameters()
            var body = Body;

            foreach (var ins in body)
            {
                switch (ins.Code)
                {
                case OpCodeEnum.Call:
                case OpCodeEnum.Newobj:
                case OpCodeEnum.Ldftn:
                case OpCodeEnum.Ldvirtftn:
                case OpCodeEnum.Callvirt:
                {
                    var m = appdomain.GetMethod(ins.TokenInteger);
                    if (m is ILMethod)
                    {
                        ILMethod ilm = (ILMethod)m;
                        //如果参数alreadyPrewarmed不为空,则不仅prewarm当前方法,还会递归prewarm所有子调用
                        //如果参数alreadyPrewarmed为空,则只prewarm当前方法
                        if (alreadyPrewarmed != null)
                        {
                            ilm.Prewarm(alreadyPrewarmed);
                        }
                    }
                    else if (m is CLRMethod)
                    {
                        CLRMethod clrm = (CLRMethod)m;
                        ILRuntime.CLR.Utils.Extensions.GetTypeFlags(clrm.DeclearingType.TypeForCLR);
                    }
                }
                break;

                case OpCodeEnum.Ldfld:
                case OpCodeEnum.Stfld:
                case OpCodeEnum.Ldflda:
                case OpCodeEnum.Ldsfld:
                case OpCodeEnum.Ldsflda:
                case OpCodeEnum.Stsfld:
                case OpCodeEnum.Ldtoken:
                {
                    //提前InitializeBaseType()
                    var t = appdomain.GetType((int)(ins.TokenLong >> 32));
                    if (t != null)
                    {
                        var baseType = t.BaseType;
                    }
                }
                break;
                }
            }
        }
Esempio n. 24
0
 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);
     }
     if (type.IsDelegate && def.Name == "Invoke")
     {
         isDelegateInvoke = true;
     }
     this.appdomain = domain;
 }
Esempio n. 25
0
        void InitializeCustomAttribute()
        {
            customAttributes = new Attribute[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
                {
                    Attribute ins = attribute.CreateInstance(at, appdomain) as Attribute;

                    attributeTypes[i]   = at.ReflectionType;
                    customAttributes[i] = ins;
                }
                catch
                {
                    attributeTypes[i] = typeof(Attribute);
                }
            }
        }
Esempio n. 26
0
        private object ILInvoke(out bool succesed, string klass, string method, object host, params object[] args)
        {
            var type = mDomain.GetType(klass);

            if (type == null)
            {
                succesed = false;
                return(null);
            }
            var mi = type.GetMethod(method, args != null? args.Length : 0);

            if (mi == null)
            {
                succesed = false;
                return(null);
            }

            succesed = true;
            return(mDomain.Invoke(mi, host, args));
            //return mDomain.Invoke(klass, method, host, args);
        }
Esempio n. 27
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            System_Text_StringBuilder_Binding.Register(app);
            System_Object_Binding.Register(app);
            System_Collections_IEnumerable_Binding.Register(app);
            System_Collections_IEnumerator_Binding.Register(app);
            System_IDisposable_Binding.Register(app);
            System_Type_Binding.Register(app);
            Google_Protobuf_ByteString_Binding.Register(app);
            ETModel_ByteHelper_Binding.Register(app);
            System_Array_Binding.Register(app);
            System_Reflection_MemberInfo_Binding.Register(app);
            System_String_Binding.Register(app);
            System_Reflection_PropertyInfo_Binding.Register(app);
            System_Reflection_MethodBase_Binding.Register(app);
            UnityEngine_Debug_Binding.Register(app);
            System_Exception_Binding.Register(app);
            System_Collections_IDictionary_Binding.Register(app);
            ETModel_Log_Binding.Register(app);
            ETModel_IdGenerater_Binding.Register(app);
            UnityEngine_Object_Binding.Register(app);
            ETModel_MongoHelper_Binding.Register(app);
            System_Activator_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Type_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Type_ILTypeInstance_Binding_ValueCollection_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Type_ILTypeInstance_Binding_ValueCollection_Binding_Enumerator_Binding.Register(app);
            System_Linq_Enumerable_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int64_ILTypeInstance_Binding.Register(app);
            ETModel_UnOrderMultiMap_2_Type_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Queue_1_Int64_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_List_1_Type_Binding.Register(app);
            Trinity_GameEntry_Binding.Register(app);
            Trinity_ILRuntimeComponent_Binding.Register(app);
            System_Collections_Generic_List_1_Type_Binding_Enumerator_Binding.Register(app);
            GameFramework_Utility_Binding_Json_Binding.Register(app);
            System_Collections_Generic_Queue_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Type_ILTypeInstance_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_KeyValuePair_2_Type_ILTypeInstance_Binding.Register(app);
            Google_Protobuf_ProtoPreconditions_Binding.Register(app);
            Google_Protobuf_CodedOutputStream_Binding.Register(app);
            Google_Protobuf_CodedInputStream_Binding.Register(app);
            Google_Protobuf_MessageParser_1_Google_Protobuf_IMessageAdaptor_Binding_Adaptor_Binding.Register(app);
            Google_Protobuf_Collections_RepeatedField_1_Google_Protobuf_IMessageAdaptor_Binding_Adaptor_Binding.Register(app);
            Google_Protobuf_Collections_RepeatedField_1_String_Binding.Register(app);
            Google_Protobuf_Collections_RepeatedField_1_Int32_Binding.Register(app);
            Google_Protobuf_Collections_RepeatedField_1_Int64_Binding.Register(app);
            Google_Protobuf_FieldCodec_Binding.Register(app);
            System_NotImplementedException_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_UInt16_List_1_ILTypeInstance_Binding.Register(app);
            ETModel_Game_Binding.Register(app);
            ETModel_Entity_Binding.Register(app);
            ETModel_OpcodeTypeComponent_Binding.Register(app);
            ETModel_MessageProxy_Binding.Register(app);
            ETModel_MessageDispatcherComponent_Binding.Register(app);
            ETModel_MessageInfo_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Type_Queue_1_Object_Binding.Register(app);
            System_Collections_Generic_Queue_1_Object_Binding.Register(app);
            ETModel_DoubleMap_2_UInt16_Type_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_UInt16_Object_Binding.Register(app);
            ETModel_MessageAttribute_Binding.Register(app);
            ETModel_SessionCallbackComponent_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_Action_1_Google_Protobuf_IMessageAdaptor_Binding_Adaptor_Binding.Register(app);
            ETModel_Session_Binding.Register(app);
            System_Action_1_Google_Protobuf_IMessageAdaptor_Binding_Adaptor_Binding.Register(app);
            ETModel_Component_Binding.Register(app);
            ETModel_NetworkComponent_Binding.Register(app);
            ETModel_IMessagePacker_Binding.Register(app);
            ETModel_OpcodeHelper_Binding.Register(app);
            ETModel_StringHelper_Binding.Register(app);
            ETModel_ETTaskCompletionSource_1_Google_Protobuf_IMessageAdaptor_Binding_Adaptor_Binding.Register(app);
            System_Threading_CancellationToken_Binding.Register(app);
            ETModel_ErrorCode_Binding.Register(app);
            ETModel_RpcException_Binding.Register(app);
            UnityEngine_Vector3_Binding.Register(app);
            UnityEngine_Quaternion_Binding.Register(app);
            GameFramework_GameFrameworkException_Binding.Register(app);
            Trinity_ETNetworkComponent_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding.Register(app);
            GameFramework_Utility_Binding_Text_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_KeyValuePair_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_Variable_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding.Register(app);
            UnityGameFramework_Runtime_Log_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_Action_Binding.Register(app);
            UnityGameFramework_Runtime_LoadSceneSuccessEventArgs_Binding.Register(app);
            UnityGameFramework_Runtime_EventComponent_Binding.Register(app);
            UnityGameFramework_Runtime_LoadSceneFailureEventArgs_Binding.Register(app);
            UnityGameFramework_Runtime_LoadSceneUpdateEventArgs_Binding.Register(app);
            UnityGameFramework_Runtime_LoadSceneDependencyAssetEventArgs_Binding.Register(app);
            UnityGameFramework_Runtime_SceneComponent_Binding.Register(app);
            UnityGameFramework_Runtime_BaseComponent_Binding.Register(app);
            GameFramework_Variable_1_Int32_Binding.Register(app);
            UnityGameFramework_Runtime_DataTableComponent_Binding.Register(app);
            GameFramework_DataTable_IDataTable_1_DRScene_Binding.Register(app);
            System_Int32_Binding.Register(app);
            Trinity_DRScene_Binding.Register(app);
            Trinity_AssetUtility_Binding.Register(app);
            System_Action_Binding.Register(app);
            Trinity_SoundExtension_Binding.Register(app);
            System_Single_Binding.Register(app);
            UnityGameFramework_Runtime_VarInt_Binding.Register(app);
            System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Binding.Register(app);
            UnityEngine_Input_Binding.Register(app);
            ETModel_ETTask_1_Google_Protobuf_IMessageAdaptor_Binding_Adaptor_Binding.Register(app);
            ETModel_ETTask_1_Google_Protobuf_IMessageAdaptor_Binding_Adaptor_Binding_Awaiter_Binding.Register(app);
            Trinity_UIExtension_Binding.Register(app);
            System_Collections_Generic_ICollection_1_KeyValuePair_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_IEnumerable_1_KeyValuePair_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_IEnumerator_1_KeyValuePair_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_IDictionary_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_LinkedList_1_EventHandler_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_LinkedList_1_EventHandler_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_LinkedListNode_1_EventHandler_1_ILTypeInstance_Binding.Register(app);
            System_EventHandler_1_ILTypeInstance_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector3));
            s_UnityEngine_Vector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Quaternion));
            s_UnityEngine_Quaternion_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Quaternion>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(UnityEngine.Vector2));
            s_UnityEngine_Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <UnityEngine.Vector2>;
        }
Esempio n. 28
0
        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);
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration
        /// </summary>
        public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            System_Object_Binding.Register(app);
            System_String_Binding.Register(app);
            System_Activator_Binding.Register(app);
            System_Console_Binding.Register(app);
            System_Type_Binding.Register(app);
            System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Binding.Register(app);
            System_Threading_Tasks_Task_Binding.Register(app);
            System_Runtime_CompilerServices_TaskAwaiter_Binding.Register(app);
            System_Threading_Tasks_Task_1_Int32_Binding.Register(app);
            System_Runtime_CompilerServices_TaskAwaiter_1_Int32_Binding.Register(app);
            System_Collections_Generic_List_1_Int32_Binding.Register(app);
            System_Linq_Enumerable_Binding.Register(app);
            System_Collections_Generic_List_1_Dictionary_2_String_Object_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_Object_Binding.Register(app);
            ILRuntimeTest_TestFramework_ClassInheritanceTest_Binding.Register(app);
            System_Int32_Binding.Register(app);
            System_Object_Array_Binding.Register(app);
            System_Action_1_Int32_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding.Register(app);
            LitJson_JsonMapper_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_Int32_Binding.Register(app);
            System_Collections_Generic_List_1_ILRuntimeTest_TestFramework_TestClass3Adaptor_Binding_Adaptor_Binding.Register(app);
            System_Reflection_MethodBase_Binding.Register(app);
            System_Reflection_MemberInfo_Binding.Register(app);
            System_Reflection_FieldInfo_Binding.Register(app);
            System_Exception_Binding.Register(app);
            System_Reflection_PropertyInfo_Binding.Register(app);
            System_Collections_Generic_List_1_ILRuntimeTest_TestFramework_ClassInheritanceTestAdaptor_Binding_Adaptor_Binding.Register(app);
            ILRuntimeTest_TestFramework_ClassInheritanceTest2_1_ILRuntimeTest_TestFramework_ClassInheritanceTest2Adaptor_Binding_Adaptor_Binding.Register(app);
            ILRuntimeTest_TestFramework_TestClass2_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_ILRuntimeTest_TestFramework_ClassInheritanceTestAdaptor_Binding_Adaptor_Binding.Register(app);
            ILRuntimeTest_TestFramework_DelegateTest_Binding.Register(app);
            ILRuntimeTest_TestFramework_IntDelegate_Binding.Register(app);
            ILRuntimeTest_TestFramework_IntDelegate2_Binding.Register(app);
            System_Func_2_Int32_Int32_Binding.Register(app);
            System_Action_3_Int32_String_String_Binding.Register(app);
            ILRuntimeTest_TestFramework_BaseClassTest_Binding.Register(app);
            System_Action_1_String_Binding.Register(app);
            System_Boolean_Binding.Register(app);
            System_Action_Binding.Register(app);
            System_Math_Binding.Register(app);
            ILRuntimeTest_TestFramework_TestStruct_Binding.Register(app);
            ILRuntimeTest_TestFramework_TestClass3_Binding.Register(app);
            System_Byte_Binding.Register(app);
            System_IO_File_Binding.Register(app);
            System_IO_FileStream_Binding.Register(app);
            System_IO_Stream_Binding.Register(app);
            System_IDisposable_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int64_Int32_Binding.Register(app);
            System_Enum_Binding.Register(app);
            System_Array_Binding.Register(app);
            System_Collections_IEnumerator_Binding.Register(app);
            System_Int32_Array_Binding.Register(app);
            System_Int32_Array_Binding_Array_Binding.Register(app);
            System_Double_Binding.Register(app);
            ILRuntimeTest_TestFramework_TestVector3_Binding.Register(app);
            System_Int32_Array3_Binding.Register(app);
            System_Int32_Array2_Binding.Register(app);
            System_Single_Binding.Register(app);
            System_Nullable_1_Int32_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_Int32_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_KeyValuePair_2_String_Int32_Binding.Register(app);
            System_Diagnostics_Stopwatch_Binding.Register(app);
            System_Func_4_Int32_Single_Int16_Double_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int64_Int64_Array_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Array_Binding.Register(app);
            System_Collections_Generic_IEnumerator_1_KeyValuePair_2_Int32_Int32_Binding.Register(app);
            System_Collections_Generic_KeyValuePair_2_Int32_Int32_Binding.Register(app);
            System_Collections_Generic_List_1_List_1_Int32_Binding.Register(app);
            System_Collections_Generic_List_1_List_1_List_1_Int32_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_ILTypeInstance_Int32_Binding.Register(app);
            System_Collections_Generic_List_1_Int32_Array_Binding.Register(app);
            System_Collections_Generic_List_1_Object_Binding.Register(app);
            System_Convert_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding_ValueCollection_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding_ValueCollection_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_List_1_String_Binding.Register(app);
            System_Collections_Generic_List_1_String_Binding_Enumerator_Binding.Register(app);
            System_NotSupportedException_Binding.Register(app);
            System_Collections_Generic_List_1_ILTypeInstance_Binding_Enumerator_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Type_Int32_Binding.Register(app);
            System_Collections_IDictionary_Binding.Register(app);
            System_NotImplementedException_Binding.Register(app);
            ILRuntimeTest_TestFramework_TestVectorStruct_Binding.Register(app);
            ILRuntimeTest_TestFramework_TestVectorStruct2_Binding.Register(app);
            System_DateTime_Binding.Register(app);
            ILRuntimeTest_TestFramework_TestVectorClass_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Object_Object_Binding.Register(app);
            System_IComparable_1_Int32_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_Int32_Binding.Register(app);
            System_Collections_Generic_Dictionary_2_Int32_Int32_Binding_Enumerator_Binding.Register(app);

            ILRuntime.CLR.TypeSystem.CLRType __clrType = null;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(ILRuntimeTest.TestFramework.TestVector3));
            s_ILRuntimeTest_TestFramework_TestVector3_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <ILRuntimeTest.TestFramework.TestVector3>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(ILRuntimeTest.TestFramework.TestVectorStruct));
            s_ILRuntimeTest_TestFramework_TestVectorStruct_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <ILRuntimeTest.TestFramework.TestVectorStruct>;
            __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType(typeof(ILRuntimeTest.TestFramework.TestVectorStruct2));
            s_ILRuntimeTest_TestFramework_TestVectorStruct2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder <ILRuntimeTest.TestFramework.TestVectorStruct2>;
        }
Esempio n. 30
0
 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];
 }