示例#1
0
        private static void GenerateCLRBindingByAnalysis()
        {
            //用新的分析热更dll调用引用来生成绑定代码
            ILRuntime.Runtime.Enviorment.AppDomain domain = new ILRuntime.Runtime.Enviorment.AppDomain();
            using (System.IO.FileStream fs = new System.IO.FileStream(BuildAssemblieEditor.ScriptAssembliesDir + "Code.dll", System.IO.FileMode.Open,
                                                                      System.IO.FileAccess.Read))
            {
                domain.LoadAssembly(fs);

                ILHelper.RegisterAdaptor(domain);

                ILRuntime.Runtime.CLRBinding.BindingCodeGenerator.GenerateBindingCode(domain, "Assets/Mono/ILRuntime/Generate");
            }

            AssetDatabase.Refresh();

            Debug.Log("生成CLR绑定文件完成");
        }
示例#2
0
        private static void GenerateCLRBindingByAnalysis()
        {
            string jstr         = File.ReadAllText("Assets/AssetsPackage/config.bytes");
            var    config       = LitJson.JsonMapper.ToObject <Dictionary <string, string> >(jstr);
            string assemblyName = "Code" + config["ResVer"];

            //用新的分析热更dll调用引用来生成绑定代码
            ILRuntime.Runtime.Enviorment.AppDomain domain = new ILRuntime.Runtime.Enviorment.AppDomain();
            using (System.IO.FileStream fs = new System.IO.FileStream(Path.Combine(Define.BuildOutputDir, $"{assemblyName}.dll"), System.IO.FileMode.Open,
                                                                      System.IO.FileAccess.Read))
            {
                domain.LoadAssembly(fs);

                ILHelper.RegisterAdaptor(domain);

                ILRuntime.Runtime.CLRBinding.BindingCodeGenerator.GenerateBindingCode(domain, "Assets/Mono/ILRuntime/Generate");
            }

            AssetDatabase.Refresh();

            Debug.Log("生成CLR绑定文件完成");
        }