Ejemplo n.º 1
0
        /// <summary>
        /// 启动热更代码执行
        /// </summary>
        /// <param name="dllDir">Dll文件所在目录</param>
        /// <param name="dllName">DLL文件名称(不含扩展名)</param>
        /// <param name="isDebug">是否是调试模式(仅针对ILRuntime,可以用第三方插件在APP运行时进行调试)</param>
        /// <param name="methodName">是否需要加载PDB文件(仅针对ILRuntime,可以在调试时打印出错代码信息)</param>
        public void Startup(string dllDir, string dllName, bool isDebug, bool isNeedPdbFile)
        {
            this.dllDir  = dllDir;
            this.dllName = dllName;

            string dllPath = Path.Combine(dllDir, dllName + ".dll");

            byte[] dllBytes = File.ReadAllBytes(dllPath);

            Assembly assembly = null;

            //如果是反射执行模式,则优先检查是否反射执行,如果不行则切换为ILRuntime模式
            if (Runtime.Ins.VO.ilType == EILType.REFLECTION)
            {
                assembly = AssemblyILWorker.LoadAssembly(dllBytes);
            }

            if (null != assembly)
            {
                //使用Assembly
                iLWorker = new AssemblyILWorker(assembly);
            }
            else
            {
                //使用ILRuntime
                var ilruntimeWorker = new ILRuntimeILWorker(dllBytes, dllDir, dllName, isDebug, isNeedPdbFile);
                iLWorker = ilruntimeWorker;

                ILRuntimeAppDomain = ilruntimeWorker.appDomain;
                IsILRuntimeMode    = true;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 启动热更代码执行
        /// </summary>
        /// <param name="dllDir">Dll文件所在目录</param>
        /// <param name="dllName">DLL文件名称(不含扩展名)</param>
        /// <param name="isDebug">是否是调试模式(仅针对ILRuntime,可以用第三方插件在APP运行时进行调试)</param>
        /// <param name="methodName">是否需要加载PDB文件(仅针对ILRuntime,可以在调试时打印出错代码信息)</param>
        public void Startup(string dllDir, string dllName, bool isDebug, bool isNeedPdbFile)
        {
            this.dllDir  = dllDir;
            this.dllName = dllName;

            string dllPath = Path.Combine(dllDir, dllName + ".dll");

            byte[] dllBytes = File.ReadAllBytes(dllPath);

            Assembly assembly = null;

            //开发时,优先保证代码在ILRuntime下能够正常运行
            if (Runtime.Ins.VO.ilType == EILType.REFLECTION)
            {
                assembly = AssemblyILWorker.LoadAssembly(dllBytes);
            }

            if (null != assembly)
            {
                //使用Assembly
                iLWorker = new AssemblyILWorker(assembly);
            }
            else
            {
                //使用ILRuntime
                iLWorker = new ILRuntimeILWorker(dllBytes, dllDir, dllName, isDebug, isNeedPdbFile);
            }
        }
Ejemplo n.º 3
0
 public void Startup()
 {
     //使用Assembly
     iLWorker = new AssemblyILWorker(this.GetType().Assembly);
 }