Пример #1
0
        protected void lbtnInstall_Click(object sender, EventArgs e)
        {
            this.ChkAdminLevel("sys_plugin_config", DTEnums.ActionEnum.Instal.ToString());
            string mapPath1 = Utils.GetMapPath("../../plugins/");

            Rain.BLL.plugin plugin = new Rain.BLL.plugin();
            for (int index = 0; index < this.rptList.Items.Count; ++index)
            {
                string str = ((HiddenField)this.rptList.Items[index].FindControl("hidDirName")).Value;
                if (((CheckBox)this.rptList.Items[index].FindControl("chkId")).Checked && plugin.GetInfo(mapPath1 + str + "\\").isload == 0)
                {
                    string path = mapPath1 + str + "\\bin\\";
                    if (Directory.Exists(path))
                    {
                        foreach (string file in Directory.GetFiles(path))
                        {
                            FileInfo fileInfo = new FileInfo(file);
                            if (fileInfo.Extension.ToLower() == ".dll")
                            {
                                string mapPath2 = Utils.GetMapPath(this.siteConfig.webpath + "bin\\" + fileInfo.Name);
                                File.Copy(fileInfo.FullName, mapPath2, true);
                            }
                        }
                    }
                    plugin.ExeSqlStr(mapPath1 + str + "\\", "plugin/install");
                    plugin.AppendNodes(mapPath1 + str + "\\", "plugin/urls");
                    plugin.AppendMenuNodes(string.Format("{0}plugins/{1}/", (object)this.siteConfig.webpath, (object)str), mapPath1 + str + "\\", "plugin/menu", "sys_plugin_manage");
                    plugin.MarkTemplet(this.siteConfig.webpath, "plugins/" + str, "templet", mapPath1 + str + "\\", "plugin/urls");
                    plugin.UpdateNodeValue(mapPath1 + str + "\\", "plugin/isload", "1");
                }
            }
            this.AddAdminLog(DTEnums.ActionEnum.Instal.ToString(), "安装插件");
            this.JscriptMsg("插件安装成功!", "plugin_list.aspx", "parent.loadMenuTree");
        }
Пример #2
0
        protected void lbtnUnInstall_Click(object sender, EventArgs e)
        {
            this.ChkAdminLevel("sys_plugin_config", DTEnums.ActionEnum.UnLoad.ToString());
            string mapPath1 = Utils.GetMapPath("../../plugins/");

            Rain.BLL.plugin plugin = new Rain.BLL.plugin();
            for (int index = 0; index < this.rptList.Items.Count; ++index)
            {
                string dirName = ((HiddenField)this.rptList.Items[index].FindControl("hidDirName")).Value;
                if (((CheckBox)this.rptList.Items[index].FindControl("chkId")).Checked && plugin.GetInfo(mapPath1 + dirName + "\\").isload == 1)
                {
                    string path = mapPath1 + dirName + "/bin/";
                    if (Directory.Exists(path))
                    {
                        foreach (string file in Directory.GetFiles(path))
                        {
                            FileInfo fileInfo = new FileInfo(file);
                            if (fileInfo.Extension.ToLower() == ".dll")
                            {
                                string mapPath2 = Utils.GetMapPath(this.siteConfig.webpath + "bin/" + fileInfo.Name);
                                if (File.Exists(mapPath2))
                                {
                                    File.Delete(mapPath2);
                                }
                            }
                        }
                    }
                    plugin.ExeSqlStr(mapPath1 + dirName + "\\", "plugin/uninstall");
                    plugin.RemoveNodes(mapPath1 + dirName + "\\", "plugin/urls");
                    plugin.RemoveMenuNodes(mapPath1 + dirName + "\\", "plugin/menu");
                    this.RemoveTemplates(dirName);
                    plugin.UpdateNodeValue(mapPath1 + dirName + "\\", "plugin/isload", "0");
                }
            }
            this.AddAdminLog(DTEnums.ActionEnum.UnLoad.ToString(), "卸载插件");
            this.JscriptMsg("插件卸载成功!", "plugin_list.aspx", "parent.loadMenuTree");
        }
Пример #3
0
        protected void lbtnRemark_Click(object sender, EventArgs e)
        {
            this.ChkAdminLevel("sys_plugin_config", DTEnums.ActionEnum.Build.ToString());
            string mapPath = Utils.GetMapPath("../../plugins/");

            Rain.BLL.plugin plugin = new Rain.BLL.plugin();
            for (int index = 0; index < this.rptList.Items.Count; ++index)
            {
                string str = ((HiddenField)this.rptList.Items[index].FindControl("hidDirName")).Value;
                if (((CheckBox)this.rptList.Items[index].FindControl("chkId")).Checked)
                {
                    if (plugin.GetInfo(mapPath + str + "\\").isload == 1)
                    {
                        plugin.MarkTemplet(this.siteConfig.webpath, "plugins/" + str, "templet", mapPath + str + "\\", "plugin/urls");
                    }
                    else
                    {
                        this.JscriptMsg("该插件尚未安装!", "plugin_list.aspx");
                    }
                }
            }
            this.AddAdminLog(DTEnums.ActionEnum.Build.ToString(), "生成插件模板");
            this.JscriptMsg("生成模板成功!", "plugin_list.aspx");
        }