⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xml.aspx.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 2 页
字号:
            else
            {
                Str_TempFileStr = Str_TempFileStr + Str_TrStart;
                Str_TempFileStr = Str_TempFileStr + "<td class=\"list_link\" align=\"left\"><a href=\"javascript:DelFile('" + TempParentPath + "','" + arr_dirinfo1[i].ToString() + "')\"><img src=../../sysimages/folder/del.gif border=\"0\"  alt=\"删除\" /></a><img src=\"../../sysImages/FileIcon/" + GetFileIco(arr_fileinfo[i].ToString()) + "\">&nbsp;<a class=\"list_link\" href=\"javascript:sFiles('" + str_dirFile + Request.QueryString["subdirpath"] + "/" + arr_dirinfo1[i].ToString() + "');\" ondblclick=\"ReturnValue(document.Templetslist.sUrl.value);\">" + arr_dirinfo1[i].ToString() + "</a></td>";
                Str_TempFileStr = Str_TempFileStr + Str_TrEnd;
            }
        }
        string url = "xml.aspx?Path=" + Request.QueryString["Path"] + "&FileType=" + Request.QueryString["FileType"] + "&pathtype=" + Request.QueryString["pathtype"] + "&subdirpath=" + Request.QueryString["subdirpath"] + "&parentdirpath=" + Request.QueryString["parentdirpath"] + "&page=";
        Str_TempFileStr = Str_TempFileStr + Str_TrStart;
        Str_TempFileStr = Str_TempFileStr + "<td class=\"list_link\" align=\"right\" colspan=\"2\">" + ShowPage(page, pageSize, Cnt, url, pageCount) + "</td>";
        Str_TempFileStr = Str_TempFileStr + Str_TrEnd;
        Str_TempFileStr = Str_TempFileStr + "</table>";
        return Str_TempFileStr;
    }
    string PathPre()
    {
        string path_ = Request.Form["Path"];
        if (path_ != null)
        {
            int i, j;
            i = path_.LastIndexOf(str_dirFile);
            j = path_.Length - i;
            path_ = path_.Substring(i, j);
        }
        else
        {
            path_ = str_dirFile;
        }
        return path_;
    }

    protected bool SelectFile(string Extension, string str_char)
    {
        bool value = false;
        switch (Extension.ToLower())
        {
            case ".xml":
                value = true;
                break;
        }
        return value;
    }

    protected string GetFileIco(string type)
    {
        string Str_ImgPath;
        switch (type.ToLower())
        {
            case ".xml":
                Str_ImgPath = "xml.gif";
                break;
           default:
                Str_ImgPath = "unknown.gif";
                break;
        }
        return Str_ImgPath;
    }

    //=================================================
    protected void EidtDirName(string path)
    {
        string Str_OldName = Request.QueryString["OldFileName"];
        string Str_NewName = Request.QueryString["NewFileName"];
        if (Directory.Exists(path + "\\" + Str_OldName))
        {
            if (Str_OldName == "" || Str_OldName == null || Str_OldName == string.Empty || Str_NewName == "" || Str_NewName == null || Str_NewName == string.Empty)
            {
                PageError("参数传递错误!", "");
            }
            else
            {
                try
                {
                    string rdir = path + "\\" + Str_OldName;
                    string rpath = path + "\\";
                    Directory.Move(rdir.Replace("\\\\", "\\"), rpath.Replace("\\\\", "\\") + Str_NewName.Replace(".", ""));
                }
                catch (Exception e)
                {
                    PageError(e.ToString(), "");
                }
                PageRight("更改文件夹名成功!", "00");
            }
        }
        else
        {
            PageError("参数传递错误!", "00");
        }
    }

    protected void EidtFileName(string path)
    {
        string Str_OldName = Request.QueryString["OldFileName"];
        string Str_NewName = Request.QueryString["NewFileName"];
        if (File.Exists(path + "\\" + Str_OldName))
        {
            if (Str_OldName == "" || Str_OldName == null || Str_OldName == string.Empty || Str_NewName == "" || Str_NewName == null || Str_NewName == string.Empty)
            {
                PageError("参数传递错误!", "00");
            }
            else
            {
                try
                {
                    File.Move(path + "\\" + Str_OldName, path + "\\" + Str_NewName);
                }

                catch (Exception es)
                {
                    PageError("错误:" + es.ToString() + "!", "");
                }
                PageRight("更改文件名成功!", "00");
            }
        }
        else
        {
            PageError("参数传递错误.可能是您的文件名有敏感字符!", "00");
        }
    }
    //----------------------------------------------修改文件名称结束-----------------------------------------------------

    //----------------------------------------------删除文件夹-----------------------------------------------------------
    protected void DelDir(string path)
    {
        if (Directory.Exists(path))                 //判断此文件夹是否存在
        {
            try
            {
                Directory.Delete(path, true);
                PageRight("删除文件夹成功!", "00");
            }
            catch (IOException e)
            {
                PageError(e.ToString(), "00");
            }
        }
        else
        {
            PageError("参数错误!", "00");
        }
    }
    //----------------------------------------------删除文件夹结束-------------------------------------------------------
    //----------------------------------------------删除文件-----------------------------------------------------------
    protected void DelFile(string path)
    {
        string Str_FileName = Request.QueryString["filename"];
        if (File.Exists(path + "\\" + Str_FileName))                 //判断此文件是否存在
        {
            FileInfo fso = new FileInfo(path + "\\" + Str_FileName);
            try
            {
                fso.Delete();
            }
            catch (Exception e)
            {
                PageError(e.ToString(), "00");
            }
            PageRight("删除文件成功!", "00");
        }
        else
        {
            PageError("参数错误!", "00");
        }
    }
    //----------------------------------------------删除文件结束-------------------------------------------------------
    //----------------------------------------------添加文件夹---------------------------------------------------------
    protected void AddDir(string path)
    {
        string Str_DirName = Request.QueryString["NewFileName"];
        if (Directory.Exists(path + "\\" + Str_DirName) == false)        //判断此文件夹是否已存在
        {
            try
            {
                Directory.CreateDirectory(path + "\\" + Str_DirName.Replace(".", ""));
            }
            catch (Exception e)
            {
                PageError(e.ToString(), "");
            }
            PageRight("添加文件夹成功!", "00");
        }
        else
        {
            PageError("此文件夹已存在!", "00");
        }
    }
    //----------------------------------------------添加文件夹结束-----------------------------------------------------
    protected string ShowPage(int page, int pageSize, int Cnt, string url, int pageCount)
    {
        string urlstr = "共" + Cnt.ToString() + "条记录,共" + pageCount.ToString() + "页,当前第" + page.ToString() + "页   ";
        urlstr = urlstr + "<a href=\"" + url + "1\" title=\"首页\" class=\"list_link\">首页</a> ";
        if ((page - 1) < 1)
        {
            urlstr = urlstr + " <a href=\"" + url + "1\" title=\"上一页\" class=\"list_link\">上一页</a> ";
        }
        else
        {
            urlstr = urlstr + " <a href=\"" + url + (page - 1) + "\" title=\"上一页\" class=\"list_link\">上一页</a> ";
        }
        if ((page + 1) < pageCount)
        {
            urlstr = urlstr + " <a href=\"" + url + (page + 1) + "\" title=\"下一页\" class=\"list_link\">下一页</a> ";
        }
        else
        {
            urlstr = urlstr + " <a href=\"" + url + pageCount + "\" title=\"下一页\" class=\"list_link\">下一页</a> ";
        }
        urlstr = urlstr + " <a href=\"" + url + pageCount + "\" title=\"尾页\" class=\"list_link\">尾页</a> ";
        return urlstr;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -