示例#1
0
文件: AddonManager.cs 项目: nistck/Jx
        private void AddonsMainMenu_Click(object obj, EventArgs eventArgs)
        {
            ToolStripMenuItem   key = (ToolStripMenuItem)obj;
            ResourceEditorAddon resourceEditorAddon = this.resourceEditorAddonMenuDic[key];

            resourceEditorAddon.OnMainMenuItemClick();
        }
示例#2
0
文件: AddonManager.cs 项目: nistck/Jx
        public bool PreInitInternal()
        {
            ResourceEditorAddon.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.ResourceEditorAddon, 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(ResourceEditorAddon).IsAssignableFrom(type) && !type.IsAbstract)
                    {
                        ConstructorInfo     constructor = type.GetConstructor(new Type[0]);
                        ResourceEditorAddon item2       = (ResourceEditorAddon)constructor.Invoke(null);
                        resourceEditorAddons.Add(item2);
                    }
                }
            }
            return(true);
        }