Пример #1
0
        private void NewAbout_Load(object sender, System.EventArgs e)
        {
            this.fun1.Start();
            Assembly asmblyMyGen      = System.Reflection.Assembly.GetEntryAssembly();
            Assembly asmblyZeus       = System.Reflection.Assembly.GetAssembly(typeof(Zeus.ZeusTemplate));
            Assembly asmblyPlugins    = System.Reflection.Assembly.GetAssembly(typeof(Zeus.IZeusCodeSegment));
            Assembly asmblyMyMeta     = System.Reflection.Assembly.GetAssembly(typeof(MyMeta.Database));
            Assembly asmblyScintilla  = System.Reflection.Assembly.GetAssembly(typeof(Scintilla.ScintillaControl));
            Assembly asmblyWinFormsUI = System.Reflection.Assembly.GetAssembly(typeof(DockContent));

            lstBoxProducts.Items.Add("MyGeneration".PadRight(29) + asmblyMyGen.GetName().Version.ToString());
            lstBoxProducts.Items.Add("MyMeta".PadRight(29) + asmblyMyMeta.GetName().Version.ToString());
            lstBoxProducts.Items.Add("Zeus Parser".PadRight(29) + asmblyZeus.GetName().Version.ToString());
            lstBoxProducts.Items.Add("Plug-in Interface".PadRight(29) + asmblyPlugins.GetName().Version.ToString());
            lstBoxProducts.Items.Add("ScintillaNet".PadRight(29) + asmblyScintilla.GetName().Version.ToString());
            lstBoxProducts.Items.Add("Scintilla".PadRight(29) + "1.60");
            lstBoxProducts.Items.Add("DockPanel Suite".PadRight(29) + asmblyWinFormsUI.GetName().Version.ToString());
            lstBoxProducts.Items.Add("Npgsql".PadRight(29) + GetAssemblyVersion("Npgsql", "1.0.0.0"));
            lstBoxProducts.Items.Add("Firebird .Net Data Provider".PadRight(29) + GetAssemblyVersion("FirebirdSql.Data.Firebird", "1.7.1.0"));
            lstBoxProducts.Items.Add("System.Data.SQLite".PadRight(29) + GetAssemblyVersion("System.Data.SQLite", "1.0.38.0"));
#if !IGNORE_VISTA
            lstBoxProducts.Items.Add("VistaDB 2.0 ADO.NET Provider".PadRight(29) + "2.0.16");
#else
            lstBoxProducts.Items.Add(""); // number of items must match
#endif
            lstBoxProducts.Items.Add("Dnp.Utils".PadRight(29) + GetAssemblyVersion("Dnp.Utils", "1.0.0.0"));

            foreach (string pluginName in MyMeta.dbRoot.Plugins.Keys)
            {
                IMyMetaPlugin plugin = dbRoot.Plugins[pluginName] as IMyMetaPlugin;
                int           index  = lstBoxProducts.Items.Add(plugin.ProviderName.PadRight(29) + plugin.GetType().Assembly.GetName().Version.ToString());
                plugins[index] = plugin;
            }

            foreach (string pluginName in PluginManager.ContentManagers.Keys)
            {
                IContentManager plugin = PluginManager.ContentManagers[pluginName] as IContentManager;
                int             index  = lstBoxProducts.Items.Add(plugin.Name.PadRight(29) + plugin.GetType().Assembly.GetName().Version.ToString());
                cmPlugins[index] = plugin;
            }

            foreach (string pluginName in PluginManager.SimplePluginManagers.Keys)
            {
                ISimplePluginManager plugin = PluginManager.SimplePluginManagers[pluginName] as ISimplePluginManager;
                int index = lstBoxProducts.Items.Add(plugin.Name.PadRight(29) + plugin.GetType().Assembly.GetName().Version.ToString());
                smPlugins[index] = plugin;
            }

            foreach (string pluginName in PluginManager.EditorManagers.Keys)
            {
                IEditorManager plugin = PluginManager.EditorManagers[pluginName] as IEditorManager;
                int            index  = lstBoxProducts.Items.Add(plugin.Name.PadRight(29) + plugin.GetType().Assembly.GetName().Version.ToString());
                emPlugins[index] = plugin;
            }

            lstBoxProducts.SelectedIndex = 0;
        }
Пример #2
0
        private void AboutBox_OnLoading(object sender, System.EventArgs e)
        {
            _aboutBoxLogo.Start();
            Assembly asmblyMyGen      = Assembly.GetEntryAssembly();
            Assembly asmblyZeus       = Assembly.GetAssembly(typeof(Zeus.ZeusTemplate));
            Assembly asmblyPlugins    = Assembly.GetAssembly(typeof(Zeus.IZeusCodeSegment));
            Assembly asmblyMyMeta     = Assembly.GetAssembly(typeof(MyMeta.Database));
            Assembly asmblyScintilla  = Assembly.GetAssembly(typeof(Scintilla.ScintillaControl));
            Assembly asmblyWinFormsUI = Assembly.GetAssembly(typeof(DockContent));

            _productsListBox.Items.Add("MyGeneration".PadRight(29) + asmblyMyGen.GetName().Version);
            _productsListBox.Items.Add("MyMeta".PadRight(29) + asmblyMyMeta.GetName().Version);
            _productsListBox.Items.Add("Zeus Parser".PadRight(29) + asmblyZeus.GetName().Version);
            _productsListBox.Items.Add("Plug-in Interface".PadRight(29) + asmblyPlugins.GetName().Version);
            _productsListBox.Items.Add("ScintillaNet".PadRight(29) + asmblyScintilla.GetName().Version);
            _productsListBox.Items.Add("Scintilla".PadRight(29) + "1.60");
            _productsListBox.Items.Add("DockPanel Suite".PadRight(29) + asmblyWinFormsUI.GetName().Version);
            _productsListBox.Items.Add("Npgsql".PadRight(29) + GetAssemblyVersion("Npgsql", "1.0.0.0"));
            _productsListBox.Items.Add("Firebird .Net Data Provider".PadRight(29) + GetAssemblyVersion("FirebirdSql.Data.Firebird", "1.7.1.0"));
            _productsListBox.Items.Add("System.Data.SQLite".PadRight(29) + GetAssemblyVersion("System.Data.SQLite", "1.0.38.0"));
            _productsListBox.Items.Add("VistaDB 2.0 ADO.NET Provider".PadRight(29) + "2.0.16");
            _productsListBox.Items.Add("Dnp.Utils".PadRight(29) + GetAssemblyVersion("Dnp.Utils", "1.0.0.0"));

            foreach (string pluginName in MyMeta.dbRoot.Plugins.Keys)
            {
                var plugin = dbRoot.Plugins[pluginName] as IMyMetaPlugin;
                var index  = _productsListBox.Items.Add(plugin.ProviderName.PadRight(29) + plugin.GetType().Assembly.GetName().Version);
                _myMetaPlugins[index] = plugin;
            }

            foreach (var pluginName in PluginManager.ContentManagers.Keys)
            {
                IContentManager plugin = PluginManager.ContentManagers[pluginName];
                var             index  = _productsListBox.Items.Add(plugin.Name.PadRight(29) + plugin.GetType().Assembly.GetName().Version);
                _contentManagerPlugins[index] = plugin;
            }

            foreach (var pluginName in PluginManager.SimplePluginManagers.Keys)
            {
                ISimplePluginManager plugin = PluginManager.SimplePluginManagers[pluginName];
                var index = _productsListBox.Items.Add(plugin.Name.PadRight(29) + plugin.GetType().Assembly.GetName().Version);
                _simplePluginManagers[index] = plugin;
            }

            foreach (var pluginName in PluginManager.EditorManagers.Keys)
            {
                IEditorManager plugin = PluginManager.EditorManagers[pluginName];
                var            index  = _productsListBox.Items.Add(plugin.Name.PadRight(29) + plugin.GetType().Assembly.GetName().Version);
                _editorManagerPlugins[index] = plugin;
            }

            _productsListBox.SelectedIndex = 0;
        }
Пример #3
0
        public static void LoadPlugins()
        {
            TemplateEditorManager tem = new TemplateEditorManager();
            ProjectEditorManager  pem = new ProjectEditorManager();

            editorManagers = new Dictionary <string, IEditorManager>();
            editorManagers.Add(tem.Name, tem);
            editorManagers.Add(pem.Name, pem);

            contentManagers = new Dictionary <string, IContentManager>();

            simplePluginManagers = new Dictionary <string, ISimplePluginManager>();

            FileInfo info = new FileInfo(Assembly.GetExecutingAssembly().Location);

            if (info.Exists)
            {
                foreach (FileInfo dllFile in info.Directory.GetFiles("MyGeneration.UI.Plugins.*.dll"))
                {
                    try
                    {
                        Assembly assembly = Assembly.LoadFile(dllFile.FullName);
                        foreach (Type type in assembly.GetTypes())
                        {
                            Type[] interfaces = type.GetInterfaces();
                            foreach (Type iface in interfaces)
                            {
                                if (iface == typeof(IEditorManager) ||
                                    iface == typeof(IContentManager) ||
                                    iface == typeof(ISimplePluginManager))
                                {
                                    try
                                    {
                                        ConstructorInfo[] constructors = type.GetConstructors();
                                        ConstructorInfo   constructor  = constructors[0];

                                        object plugin = constructor.Invoke(BindingFlags.CreateInstance, null, new object[] { }, null);
                                        if (plugin is IEditorManager)
                                        {
                                            IEditorManager em = plugin as IEditorManager;
                                            if (!editorManagers.ContainsKey(em.Name))
                                            {
                                                editorManagers[em.Name] = em;
                                            }
                                        }
                                        else if (plugin is IContentManager)
                                        {
                                            IContentManager cm = plugin as IContentManager;
                                            if (!contentManagers.ContainsKey(cm.Name))
                                            {
                                                contentManagers[cm.Name] = cm;
                                            }
                                        }
                                        else if (plugin is ISimplePluginManager)
                                        {
                                            ISimplePluginManager spm = plugin as ISimplePluginManager;
                                            if (!simplePluginManagers.ContainsKey(spm.Name))
                                            {
                                                simplePluginManagers[spm.Name] = spm;
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        pluginLoadErrors.Add(dllFile, ex);
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        pluginLoadErrors.Add(dllFile, ex);
                    }
                }
            }
        }