Esempio n. 1
0
        private void InitPlugin()
        {
            List <PluginClass> plist  = new List <PluginClass>();
            List <PluginClass> plist2 = PluginSysManage.GetAllPlugin();

            plist.AddRange(plist2.FindAll(x => (x.plugintype == "WcfModulePlugin")));

            for (int i = 0; i < plist.Count; i++)
            {
                FileInfo finfo = new FileInfo(PluginSysManage.localpath + "\\" + plist[i].path);
                PluginXmlManage.pluginfile = finfo.FullName;
                pluginxmlClass plugin = PluginXmlManage.getpluginclass();
                plist[i].version = plugin.version;
                plist[i].author  = plugin.author;
            }
            gridlocal.DataSource = plist;
        }
Esempio n. 2
0
        private bool PluginSetup(string localzippath, out string pluginfile)
        {
            pluginfile = "";
            FileInfo fileinfo = new FileInfo(localzippath);

            if (fileinfo.Exists == false)
            {
                throw new Exception("插件包不存在!");
            }

            string temp_pluginpath = fileinfo.Directory.FullName + "\\" + fileinfo.Name.Replace(fileinfo.Extension, "");

            FastZipHelper.decompress(temp_pluginpath, localzippath);
            PluginXmlManage.pluginfile = temp_pluginpath + "\\plugin.xml";
            pluginxmlClass plugin = PluginXmlManage.getpluginclass();

            string pluginpath = "";
            //string pluginsyspath = "";
            //string dbconfig = "";
            string plugintype = "";
            string ptype      = plugin.plugintype.ToLower();

            bool ishave = false;

            switch (ptype)
            {
            case "wcf":
                //pluginsyspath = PluginSysManage.localpath + "\\Config\\pluginsys.xml";
                //dbconfig = PluginSysManage.localpath + "\\Config\\EntLib.config";
                plugintype = "WcfModulePlugin";
                pluginpath = PluginSysManage.localpath + "\\ModulePlugin\\" + plugin.name;
                //PluginSysManage.pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                if (PluginSysManage.ContainsPlugin("WcfModulePlugin", plugin.name))
                {
                    ishave = true;
                }
                break;
            }

            //先判断此插件本地是否存在
            if (ishave == true)
            {
                MessageBox.Show("你选择的插件本地已安装!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }



            //移动到插件目录
            if (temp_pluginpath != pluginpath)
            {
                new DirectoryInfo(temp_pluginpath).MoveTo(pluginpath);
            }

            pluginfile = pluginpath + "\\plugin.xml";
            //pluginsys.xml
            //PluginSysManage.pluginsysFile = pluginsyspath;
            PluginSysManage.AddPlugin(plugintype, plugin.name, "ModulePlugin/" + plugin.name + "/plugin.xml", plugin.title, "0");

            return(true);
        }