Пример #1
0
        public void BuildCLRBinding()
        {
            AppDomain appDomain = new AppDomain();

            using (MemoryStream dll = new MemoryStream(RijndaelUtil.RijndaelDecrypt("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", FileUtil.GetAsset("Assets/Resources/DLL/Unity.Hotfix.dll.bytes"))))
            {
                appDomain.LoadAssembly(dll);
                ILRuntimeUtil.LccFrameworkRegisterCrossBindingAdaptor(appDomain);
                BindingCodeGenerator.GenerateBindingCode(appDomain, "Assets/Scripts/Runtime/Core/Manager/ILRuntime/Generated");
            }
            AssetDatabase.Refresh();
        }
Пример #2
0
        public static void GenerateCLRBindingByAnalysis()
        {
            //用新的分析热更dll调用引用来生成绑定代码
            AppDomain domain = new AppDomain();

            using (FileStream fs = new FileStream("Assets/Resources/DLL/Unity.Hotfix.dll.bytes", FileMode.Open, FileAccess.Read))
            {
                byte[] bytes = new byte[fs.ReadByte()];
                fs.Read(bytes, 0, bytes.Length);
                MemoryStream dll = new MemoryStream(RijndaelUtil.RijndaelDecrypt("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", bytes));
                domain.LoadAssembly(dll);
                //Crossbind Adapter is needed to generate the correct binding code
                InitILRuntime(domain);
                BindingCodeGenerator.GenerateBindingCode(domain, "Assets/Scripts/Runtime/Core/Manager/ILRuntime/Generated");
            }
            AssetDatabase.Refresh();
        }