Exemple #1
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (gridlocal.CurrentCell == null)
            {
                return;
            }

            if (MessageBox.Show("是否卸载此插件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
            {
                return;
            }

            List <PluginClass> plist = gridlocal.DataSource as List <PluginClass>;
            PluginClass        pc    = plist[gridlocal.CurrentCell.RowIndex];
            FileInfo           finfo = null;

            if (pc.plugintype == "WcfModulePlugin")
            {
                //1.卸载插件
                EFWCoreLib.CoreFrame.Init.AppPluginManage.RemovePlugin(pc.name);
                //2.删除插件的相关文件
                finfo = new FileInfo(PluginSysManage.localpath + "\\" + pc.path);
                if (finfo.Exists)
                {
                    PluginSysManage.DeletePlugin(pc.plugintype, pc.name);
                    if (finfo.Directory.Exists)
                    {
                        finfo.Directory.Delete(true);
                    }
                    //MessageBox.Show("此插件卸载成功,必须重启WCF服务主机!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
                }
            }

            InitPlugin();
        }
Exemple #2
0
        private void 查看配置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (gridlocal.CurrentCell == null)
            {
                return;
            }
            List <PluginClass> plist = gridlocal.DataSource as List <PluginClass>;
            PluginClass        pc    = plist[gridlocal.CurrentCell.RowIndex];

            WCFHosting.PluginManage.FrmPluginXML xml = new PluginManage.FrmPluginXML(PluginSysManage.localpath + "\\ModulePlugin\\" + pc.name + "\\plugin.xml");
            xml.ShowDialog();
        }
Exemple #3
0
        private void 内存加载ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (gridlocal.CurrentCell == null)
            {
                return;
            }
            List <PluginClass> plist = gridlocal.DataSource as List <PluginClass>;
            PluginClass        pc    = plist[gridlocal.CurrentCell.RowIndex];

            // EFWCoreLib.CoreFrame.Init.AppPluginManage.RemovePlugin(pc.name);
            EFWCoreLib.CoreFrame.Init.AppPluginManage.AddPlugin(PluginSysManage.localpath + "\\ModulePlugin\\" + pc.name + "\\plugin.xml");
            MessageBox.Show("内存加载插件完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemple #4
0
        public static List <PluginClass> GetAllPlugin()
        {
            if (xmlDoc == null)
            {
                InitConfig();
            }
            List <PluginClass> plist = new List <PluginClass>();
            XmlNodeList        nl    = null;

            nl = xmlDoc.DocumentElement.SelectNodes("WebModulePlugin/Plugin");
            foreach (XmlNode n in nl)
            {
                PluginClass plugin = new PluginClass();
                plugin.plugintype    = "WebModulePlugin";
                plugin.name          = n.Attributes["name"].Value;
                plugin.title         = n.Attributes["title"].Value;
                plugin.path          = n.Attributes["path"].Value;
                plugin.isdevelopment = n.Attributes["isdevelopment"].Value;
                plist.Add(plugin);
            }
            nl = xmlDoc.DocumentElement.SelectNodes("WinformModulePlugin/Plugin");
            foreach (XmlNode n in nl)
            {
                PluginClass plugin = new PluginClass();
                plugin.plugintype    = "WinformModulePlugin";
                plugin.name          = n.Attributes["name"].Value;
                plugin.title         = n.Attributes["title"].Value;
                plugin.path          = n.Attributes["path"].Value;
                plugin.isdevelopment = n.Attributes["isdevelopment"].Value;
                plist.Add(plugin);
            }
            nl = xmlDoc.DocumentElement.SelectNodes("WcfModulePlugin/Plugin");
            foreach (XmlNode n in nl)
            {
                PluginClass plugin = new PluginClass();
                plugin.plugintype    = "WcfModulePlugin";
                plugin.name          = n.Attributes["name"].Value;
                plugin.title         = n.Attributes["title"].Value;
                plugin.path          = n.Attributes["path"].Value;
                plugin.isdevelopment = n.Attributes["isdevelopment"].Value;
                plist.Add(plugin);
            }
            return(plist);
        }
Exemple #5
0
        public static PluginClass GetPlugin(string pluginType, string name)
        {
            if (xmlDoc == null)
            {
                InitConfig();
            }
            XmlNodeList nl = xmlDoc.DocumentElement.SelectSingleNode(pluginType).SelectNodes("Plugin");

            foreach (XmlNode n in nl)
            {
                if (n.Attributes["name"].Value == name)
                {
                    PluginClass plugin = new PluginClass();
                    plugin.plugintype    = pluginType;
                    plugin.name          = n.Attributes["name"].Value;
                    plugin.title         = n.Attributes["title"].Value;
                    plugin.path          = n.Attributes["path"].Value;
                    plugin.isdevelopment = n.Attributes["isdevelopment"].Value;
                    return(plugin);
                }
            }
            return(null);
        }