コード例 #1
0
        public void resolve()
        {
            requiredBundleList = new List <BundleImpl>();
            loadRequiredBundle();

            this.activatorClassName = null;
            unloadAssemblyLoadContext();
            bundleAssemblyLoadContext            = new CollectibleAssemblyLoadContext($"Bundle[Id:{getBundleId()}, Name:{getSymbolicName()}] AssemblyLoadContext");
            bundleAssemblyLoadContext.Resolving += BundleAssemblyLoadContext_Resolving;
            bundleAssemblyLoadContext.Unloading += BundleAssemblyLoadContext_Unloading;
            loadAssemblys();
            this.activatorClassName = FindBundleActivatorClassName();
            if (this.activatorClassName != null)
            {
                headerDictionary.Add("Activator", activatorClassName);
            }

            //解析Bundle完成
            this.state = Bundle_Const.RESOLVED;
            framework.fireBundleEvent(new BundleEvent(BundleEvent.RESOLVED, this));
        }
コード例 #2
0
ファイル: BundleImpl.cs プロジェクト: fysxm/golion
        public void resolve()
        {
            requiredBundleList = new List <BundleImpl>();
            loadRequiredBundle();

            this.activatorClassName = null;
            if (framework.IsUseAppDomain())
            {
                unloadAppDomain();
                bundleAppDomain = AppDomain.CreateDomain(String.Format("Bundle[{0}] AppDomain", this.getSymbolicName()));
                bundleResovler  = bundleAppDomain.CreateInstanceAndUnwrap(typeof(BundleImpl).Assembly.FullName, typeof(BundleResovler).FullName) as BundleResovler;
                bundleResovler.Init(this);
                this.activatorClassName = bundleResovler.FindBundleActivatorClassName();
            }
            else
            {
                loadAssemblys();

                //搜索Activator
                foreach (Type type in bundleAssembly.GetTypes())
                {
                    if (typeof(BundleActivator).IsAssignableFrom(type))
                    {
                        this.activatorClassName = type.FullName;
                        break;
                    }
                }
            }
            if (this.activatorClassName != null)
            {
                headerDictionary.Add("Activator", activatorClassName);
            }

            //解析Bundle完成
            this.state = Bundle_Const.RESOLVED;
            framework.fireBundleEvent(new BundleEvent(BundleEvent.RESOLVED, this));
        }