📄 selectfiles.aspx.cs
字号:
break;
case ".asf":
value = true;
break;
case ".flv":
value = true;
break;
case ".avi":
value = true;
break;
case ".mpg":
value = true;
break;
case ".wmv":
value = true;
break;
case ".swf":
value = true;
break;
default:
value = false;
break;
}
}
else
{
switch (Extension.ToLower())
{
case ".gif":
value = true;
break;
case ".jpg":
value = true;
break;
case ".jpeg":
value = true;
break;
case ".ico":
value = true;
break;
case ".png":
value = true;
break;
case ".bmp":
value = true;
break;
case ".swf":
value = true;
break;
case ".fla":
value = true;
break;
case ".psd":
value = true;
break;
case ".tif":
value = true;
break;
case ".flv":
value = true;
break;
case ".rar":
value = true;
break;
case ".zip":
value = true;
break;
case ".exe":
value = true;
break;
case ".doc":
value = true;
break;
case ".rm":
value = true;
break;
case ".rmvb":
value = true;
break;
case ".mp3":
value = true;
break;
case ".wma":
value = true;
break;
case ".asf":
value = true;
break;
case ".avi":
value = true;
break;
case ".mpg":
value = true;
break;
case ".wmv":
value = true;
break;
default:
value = false;
break;
}
}
return value;
}
/// <summary>
/// 获取文件图标
/// </summary>
/// <param name="type">文件后缀名</param>
/// <returns>返回与文件后缀名相匹配的ICO图标</returns>
/// Code By DengXi
protected string GetFileIco(string type)
{
string Str_ImgPath;
switch (type.ToLower())
{
case ".htm":
Str_ImgPath = "html.gif";
break;
case ".html":
Str_ImgPath = "html.gif";
break;
case ".aspx":
Str_ImgPath = "aspx.gif";
break;
case ".cs":
Str_ImgPath = "c.gif";
break;
case ".asp":
Str_ImgPath = "asp.gif";
break;
case ".doc":
Str_ImgPath = "doc.gif";
break;
case ".exe":
Str_ImgPath = "exe.gif";
break;
case ".swf":
Str_ImgPath = "flash.gif";
break;
case ".gif":
Str_ImgPath = "gif.gif";
break;
case ".jpg":
Str_ImgPath = "jpg.gif";
break;
case ".jpeg":
Str_ImgPath = "jpg.gif";
break;
case ".js":
Str_ImgPath = "script.gif";
break;
case ".txt":
Str_ImgPath = "txt.gif";
break;
case ".xml":
Str_ImgPath = "xml.gif";
break;
case ".zip":
Str_ImgPath = "zip.gif";
break;
case ".rar":
Str_ImgPath = "zip.gif";
break;
default:
Str_ImgPath = "unknown.gif";
break;
}
return Str_ImgPath;
}
/// <summary>
/// 修改文件夹名称
/// </summary>
/// <param name="path">文件夹路径</param>
/// <returns>修改文件夹名称</returns>
/// Code By DengXi
protected void EidtDirName(string path)
{
string str_OldName = Request.Form["OldFileName"];
string str_NewName = Request.Form["NewFileName"];
if (str_OldName == "" || str_OldName == null || str_OldName == string.Empty || str_NewName == "" || str_NewName == null || str_NewName == string.Empty)
PageError("参数传递错误!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
int result = tpClass.EidtName(path, str_OldName, str_NewName, 0);
if (result == 1)
PageRight("更改文件夹名成功!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
else
PageError("参数传递错误!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
}
/// <summary>
/// 修改文件名称
/// </summary>
/// <param name="path">文件路径</param>
/// <returns>修改文件名称</returns>
/// Code By DengXi
protected void EidtFileName(string path)
{
string str_OldName = Request.Form["OldFileName"];
string str_NewName = Request.Form["NewFileName"];
if (str_OldName == "" || str_OldName == null || str_OldName == string.Empty || str_NewName == "" || str_NewName == null || str_NewName == string.Empty)
PageError("参数传递错误!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
int result = tpClass.EidtName(path, str_OldName, str_NewName, 1);
if (result == 1)
PageRight("更改文件名成功!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
else
PageError("参数传递错误!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
}
/// <summary>
/// 删除文件夹
/// </summary>
/// <param name="path">文件夹路径</param>
/// <returns>删除文件夹</returns>
/// Code By DengXi
protected void DelDir(string path)
{
int result = 0;
NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
result = tpClass.Del(path, "", 0);
if (result == 1)
PageRight("删除文件夹成功!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
else
PageError("参数错误!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
}
/// <summary>
/// 删除文件
/// </summary>
/// <param name="path">文件路径</param>
/// <returns>删除文件</returns>
/// Code By DengXi
protected void DelFile(string path)
{
string str_FileName = Request.Form["filename"];
int result = 0;
NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
result = tpClass.Del(path, str_FileName, 1);
if (result == 1)
PageRight("删除文件成功!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
else
PageError("参数错误!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
}
/// <summary>
/// 添加文件夹
/// </summary>
/// <param name="path">文件夹路径</param>
/// <returns>添加文件夹</returns>
/// Code By DengXi
protected void AddDir(string path)
{
string str_DirName = Request.Form["filename"];
int result = 0;
NetCMS.Content.Templet.Templet tpClass = new NetCMS.Content.Templet.Templet();
result = tpClass.AddDir(path, str_DirName);
if (result == 1)
PageRight("添加文件夹成功!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
else
PageError("未知错误!", "selectFiles.aspx?FileType=" + Request.QueryString["FileType"]);
}
/// <summary>
/// 显示导入文件,创建目录
/// </summary>
/// <param name="path">文件路径</param>
/// <returns>返回操作区域</returns>
/// Code By DengXi
protected void ShowAddfiledir(string path)
{
string str_Addfiledir = "<span style=\"padding-left:10px;\">";
str_Addfiledir += "<a href=\"javascript:AddDir('" + path + "');\" class=\"topnavichar\">创建目录</a> <a href=\"javascript:void(0);\" onclick=\"UpFile('" + path + "','" + Request.QueryString["FileType"] + "','" + Request.Form["ParentPath"] + "');\" class=\"topnavichar\"><span style=\"color:red;\">上传文件</span></a>";
str_Addfiledir += "</span>";
addfiledir.InnerHtml = str_Addfiledir;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -