private bool b() { ComponentManager.ComponentInfo[] componentsByType = ComponentManager.Instance.GetComponentsByType(ComponentManager.ComponentTypeFlags.Archive, true); List <Assembly> list = new List <Assembly>(); for (int i = 0; i < componentsByType.Length; i++) { ComponentManager.ComponentInfo componentInfo = componentsByType[i]; ComponentManager.ComponentInfo.PathInfo[] allEntryPointsForThisPlatform = componentInfo.GetAllEntryPointsForThisPlatform(); for (int j = 0; j < allEntryPointsForThisPlatform.Length; j++) { ComponentManager.ComponentInfo.PathInfo pathInfo = allEntryPointsForThisPlatform[j]; string fileName = Path.Combine(VirtualFileSystem.ExecutableDirectoryPath, pathInfo.Path); Assembly item = AssemblyUtils.LoadAssemblyByFileName(fileName); if (!list.Contains(item)) { list.Add(item); } } } List <Type> list2 = new List <Type>(); foreach (Assembly current in list) { Type[] types = current.GetTypes(); for (int k = 0; k < types.Length; k++) { Type type = types[k]; if (typeof(ArchiveFactory).IsAssignableFrom(type) && !type.IsAbstract) { list2.Add(type); } } } foreach (Type current2 in list2) { ConstructorInfo constructor = current2.GetConstructor(new Type[0]); ArchiveFactory archiveFactory = (ArchiveFactory)constructor.Invoke(null); if (!archiveFactory.OnInit()) { return(false); } this.S.Add(archiveFactory); } return(true); }
public bool PreInitInternal() { DesignerAddon.Internal_InitApplicationData(MainForm.Instance, MainForm.Instance.MainMenu, MainForm.Instance.ToolStripGeneral, MainForm.Instance.DockPanel); List <Assembly> list = new List <Assembly>(); ComponentManager.ComponentInfo[] componentsByType = ComponentManager.Instance.GetComponentsByType(ComponentManager.ComponentTypeFlags.DesignerAddon, true); for (int i = 0; i < componentsByType.Length; i++) { ComponentManager.ComponentInfo componentInfo = componentsByType[i]; ComponentManager.ComponentInfo.PathInfo[] allEntryPointsForThisPlatform = componentInfo.GetAllEntryPointsForThisPlatform(); for (int j = 0; j < allEntryPointsForThisPlatform.Length; j++) { ComponentManager.ComponentInfo.PathInfo pathInfo = allEntryPointsForThisPlatform[j]; Assembly item = AssemblyUtils.LoadAssemblyByRealFileName(pathInfo.Path, false); if (item != null && !list.Contains(item)) { list.Add(item); } } } foreach (Assembly current in list) { Type[] types = current.GetTypes(); for (int k = 0; k < types.Length; k++) { Type type = types[k]; if (typeof(DesignerAddon).IsAssignableFrom(type) && !type.IsAbstract) { ConstructorInfo constructor = type.GetConstructor(new Type[0]); DesignerAddon item2 = (DesignerAddon)constructor.Invoke(null); resourceEditorAddons.Add(item2); } } } return(true); }
private bool _Startup() { #region 缺省 Entity.tickDelta = 20; #endregion TextBlock textBlock = null; if (VirtualFile.Exists("Base/Constants/EntitySystem.config")) { textBlock = TextBlockUtils.LoadFromVirtualFile("Base/Constants/EntitySystem.config"); if (textBlock != null) { } } if (JxEngineApp.Instance != null) { Entity.tickDelta = JxEngineApp.Instance.LoopInterval; } CreateEntityClassAssembly(typeof(EntitySystemWorld).Assembly); CreateEntityClassAssembly(Assembly.GetExecutingAssembly()); /* * Assembly item = AssemblyUtils.LoadAssemblyByRealFileName("MapSystem.dll", false); * entityClassAssemblies.Add(item); * //*/ ComponentManager.ComponentInfo[] componentsByType = ComponentManager.Instance.GetComponentsByType(ComponentManager.ComponentTypeFlags.EntityClasses, true); for (int i = 0; i < componentsByType.Length; i++) { ComponentManager.ComponentInfo componentInfo = componentsByType[i]; ComponentManager.ComponentInfo.PathInfo[] allEntryPointsForThisPlatform = componentInfo.GetAllEntryPointsForThisPlatform(); LongOperationNotifier.Notify("初始化组件({0}/{1}): {2}, 入口数: {3}", i + 1, componentsByType.Length, componentInfo.FullName, allEntryPointsForThisPlatform.Length); for (int j = 0; j < allEntryPointsForThisPlatform.Length; j++) { ComponentManager.ComponentInfo.PathInfo pathInfo = allEntryPointsForThisPlatform[j]; Assembly assembly = AssemblyUtils.LoadAssemblyByRealFileName(pathInfo.Path, false); CreateEntityClassAssembly(assembly); } } if (textBlock != null) { TextBlock logicSystemBlock = textBlock.FindChild("logicSystem"); if (logicSystemBlock != null) { TextBlock logicSystemClassAssembliesBlock = logicSystemBlock.FindChild("systemClassesAssemblies"); if (logicSystemClassAssembliesBlock != null) { foreach (TextBlock current in logicSystemClassAssembliesBlock.Children) { string assemblyFileName = current.GetAttribute("file"); logicSystemSystemClassesAssemblies.Add(assemblyFileName); } } } } LogicSystemClasses.Init(); if (!EntityTypes.Init()) { return(false); } if (textBlock != null) { string defaultWorldType = textBlock.GetAttribute("defaultWorldType"); if (!string.IsNullOrEmpty(defaultWorldType)) { this.defaultWorldType = EntityTypes.Instance.GetByName(defaultWorldType) as WorldType; if (this.defaultWorldType == null) { this.defaultWorldType = EntityTypes.Instance.GetByName(typeof(DefaultWorld).Name) as WorldType; } } if (this.defaultWorldType == null) { Log.Fatal("EntitySystemWorld: Init: World type \"{0}\" is not defined or it is not a WorldType (Base\\Constants\\EntitySystem.config: \"defaultWorldType\" attribute).", defaultWorldType); return(false); } } Log.Info(">> 默认WorldType: {0}", defaultWorldType); return(true); }