📄 stylemanage.aspx.cs
字号:
if (!FileSystemObject.IsExist(str4, FsoMethod.File))
{
FileSystemObject.Move(oldFile, str4, FsoMethod.File);
AdminPage.WriteSuccessMsg("重命名文件成功", this.m_UrlReferrer);
}
else
{
AdminPage.WriteErrMsg("<li>重命目标文件名已经存在。</li>", this.m_UrlReferrer);
}
}
}
catch (FileNotFoundException)
{
AdminPage.WriteErrMsg("文件未找到", this.m_UrlReferrer);
}
catch (UnauthorizedAccessException)
{
AdminPage.WriteErrMsg("<li>重命名文件夹或文件失败!检查您的服务器是否给风格文件夹写入权限。</li>", this.m_UrlReferrer);
}
}
}
protected void EBtnNewDir_Click(object sender, EventArgs e)
{
if (this.Page.IsValid)
{
try
{
DirectoryInfo info = new DirectoryInfo(this.currentDirectory + @"\" + this.TxtNewDir.Text);
if (info.Exists)
{
AdminPage.WriteErrMsg("新建的目录已经存在", this.m_UrlReferrer);
}
FileSystemObject.Create(this.currentDirectory + @"\" + this.TxtNewDir.Text, FsoMethod.Folder);
base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
AdminPage.WriteSuccessMsg("新建目录成功", this.m_UrlReferrer);
}
catch (FileNotFoundException)
{
AdminPage.WriteErrMsg("文件未找到", this.m_UrlReferrer);
}
catch (UnauthorizedAccessException)
{
AdminPage.WriteErrMsg("<li>新建目录失败!检查您的服务器是否给风格文件夹写入权限。</li>", this.m_UrlReferrer);
}
}
}
protected void EgvFiles_RowCommand(object sender, CommandEventArgs e)
{
try
{
string str;
string commandName = e.CommandName;
if (commandName != null)
{
if (!(commandName == "DelFiles"))
{
if (commandName == "DelDir")
{
goto Label_0082;
}
if (commandName == "CopyDir")
{
goto Label_00C3;
}
if (commandName == "CopyFiles")
{
goto Label_01A7;
}
}
else
{
FileSystemObject.Delete(this.currentDirectory + e.CommandArgument.ToString(), FsoMethod.File);
AdminPage.WriteSuccessMsg("<li>删除文件成功。</li>", this.m_UrlReferrer);
}
}
return;
Label_0082:
base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
FileSystemObject.Delete(this.currentDirectory + e.CommandArgument.ToString(), FsoMethod.Folder);
AdminPage.WriteSuccessMsg("<li>删除目录成功。</li>", this.m_UrlReferrer);
return;
Label_00C3:
if (!FileSystemObject.IsExist(this.currentDirectory + "复件" + e.CommandArgument.ToString(), FsoMethod.Folder))
{
base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
FileSystemObject.CopyDirectory(this.currentDirectory + e.CommandArgument.ToString(), this.currentDirectory + "复件" + e.CommandArgument.ToString());
AdminPage.WriteSuccessMsg("<li>复制目录成功。</li>", this.m_UrlReferrer);
}
else
{
this.HdnCopyDir.Value = e.CommandArgument.ToString();
this.LblCopyDir.Text = "复件" + e.CommandArgument.ToString();
this.TxtCopyDir.Text = "复件" + e.CommandArgument.ToString();
this.MpeCopyDir.Show();
}
return;
Label_01A7:
str = e.CommandArgument.ToString();
if (!string.IsNullOrEmpty(str))
{
string[] strArray = str.Split(new string[] { @"\" }, StringSplitOptions.RemoveEmptyEntries);
string newValue = "复件" + strArray[strArray.Length - 1];
string str3 = str.Replace(strArray[strArray.Length - 1], newValue);
if (!FileSystemObject.IsExist(this.currentDirectory + str3, FsoMethod.File))
{
FileSystemObject.CopyFile(this.currentDirectory + e.CommandArgument.ToString(), this.currentDirectory + str3);
AdminPage.WriteSuccessMsg("<li>复制文件成功。</li>", this.m_UrlReferrer);
}
else
{
this.HdnCopyFile.Value = e.CommandArgument.ToString();
this.LblCopyFile.Text = str3;
this.TxtCopyFile.Text = str3;
this.MpeCopyFile.Show();
}
}
}
catch (FileNotFoundException)
{
AdminPage.WriteErrMsg("<li>文件未找到!</li>", this.m_UrlReferrer);
}
catch (UnauthorizedAccessException)
{
AdminPage.WriteErrMsg("<li>访问文件夹或文件时失败!检查您的服务器是否给风格文件夹写入权限。</li>", this.m_UrlReferrer);
}
}
protected void EgvFiles_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int num = DataConverter.CLng(DataBinder.Eval(e.Row.DataItem, "type"));
string str = "";
if (num == 1)
{
str = "StyleManage.aspx?Dir=" + base.Server.UrlEncode(base.Request.QueryString["Dir"] + "/" + DataBinder.Eval(e.Row.DataItem, "name").ToString());
e.Row.Attributes.Add("ondblclick", "RowDblclick('" + str + "');");
}
else if (this.IsEdit(DataBinder.Eval(e.Row.DataItem, "type").ToString(), DataBinder.Eval(e.Row.DataItem, "content_type").ToString()))
{
str = "StyleSheets.aspx?Action=Modify&Dir=" + base.Server.UrlEncode(base.Request.QueryString["Dir"] + "/" + DataBinder.Eval(e.Row.DataItem, "name").ToString());
e.Row.Attributes.Add("ondblclick", "RowDblclick('" + str + "');");
}
}
}
protected string GetSize(string size)
{
return FileSystemObject.ConvertSizeToShow(DataConverter.CLng(size));
}
protected void InitPage()
{
this.ValeTxtNewDir.ValidationExpression = "^[^\\/ :*?\"<>|.]+";
this.ValeTxtFileName.ValidationExpression = "^[^\\/ :*?\"<>|.]+\\.css$";
this.ValeTxtDirName.ValidationExpression = "^[^\\/ :*?\"<>|.]+";
this.ValeTxtCopyDir.ValidationExpression = "^[^\\/ :*?\"<>|.]+";
this.ValeTxtCopyFile.ValidationExpression = "^[^\\/ :*?\"<>|.]+\\.css$";
string skinStyleDir = this.skinStyleDir;
if (!string.IsNullOrEmpty(skinStyleDir))
{
if (!this.Page.IsPostBack)
{
DirectoryInfo info = new DirectoryInfo(base.Request.PhysicalApplicationPath + skinStyleDir);
if (info.Exists)
{
foreach (DirectoryInfo info2 in info.GetDirectories("*", SearchOption.AllDirectories))
{
if (!info2.FullName.Contains("标签库") && !info2.FullName.Contains("分页标签库"))
{
string text = (info2.FullName.Remove(0, info.FullName.Length) + "/").Replace(@"\", "/");
this.DrpMove.Items.Add(new ListItem(text, text));
}
}
}
}
string str4 = BasePage.RequestString("Dir");
if (!string.IsNullOrEmpty(str4))
{
this.LblCurrentDir.Text = str4;
if (str4.LastIndexOf("/") > 0)
{
this.parentDir = str4.Remove(str4.LastIndexOf("/"), str4.Length - str4.LastIndexOf("/"));
}
}
else
{
this.LblCurrentDir.Text = "/" + str4;
}
this.currentDirectory = base.Request.PhysicalApplicationPath + skinStyleDir + str4 + "/";
this.currentDirectory = this.currentDirectory.Replace("/", @"\");
this.currentDirectory = this.currentDirectory.Replace(@"\\", @"\");
if (!this.Page.IsPostBack)
{
DirectoryInfo info3 = new DirectoryInfo(this.currentDirectory);
if (info3.Exists)
{
this.BindData();
}
}
}
else
{
this.PanButton.Visible = false;
this.LitMessageText.Text = "请到网站配置中配置风格方案文件夹!";
this.LitMessageText.Visible = true;
}
if (!string.IsNullOrEmpty(BasePage.RequestString("Dir")))
{
this.LitParentDirLink.Text = "<a href=\"StyleManage.aspx?Dir=" + this.parentDir + "\">返回上一级</a>";
this.LitParentDirButton.Text = " <input id=\"Button1\" type=\"button\" class=\"inputbutton\" value=\"返回上一级\" onclick=\"javascript:location.href='StyleManage.aspx?Dir=" + this.parentDir + "';\" />";
}
else
{
this.LitParentDirLink.Text = "<a disabled='disabled'>返回上一级</a>";
this.LitParentDirButton.Text = " <input id=\"Button1\" type=\"button\" class=\"inputbutton\" value=\"返回上一级\" disabled='disabled' />";
}
}
protected bool IsEdit(string type, string content_type)
{
return (!(type == "1") && !(content_type != "css"));
}
protected void Page_Load(object sender, EventArgs e)
{
this.skinStyleDir = "/Skin";
this.m_UrlReferrer = "StyleManage.aspx?Dir=" + base.Server.UrlEncode(BasePage.RequestString("Dir"));
this.SmpNavigator.CurrentNode = "<a href=\"StyleManage.aspx\">风格管理</a>";
string str = BasePage.RequestString("Dir");
if (!string.IsNullOrEmpty(str))
{
StringBuilder builder = new StringBuilder();
string[] strArray = str.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < strArray.Length; i++)
{
StringBuilder builder2 = new StringBuilder();
for (int j = 0; j <= i; j++)
{
builder2.Append("/" + strArray[j]);
}
if (builder.Length > 0)
{
builder.Append(" >> ");
}
builder.Append("<a href=\"StyleManage.aspx?Dir=" + base.Server.UrlEncode(builder2.ToString()) + "\">" + strArray[i] + "</a>");
}
this.SmpNavigator.AdditionalNode = builder.ToString();
}
this.InitPage();
}
protected void Pager_PageChanged(object src, PageChangedEventArgs e)
{
this.Pager.CurrentPageIndex = e.NewPageIndex;
this.BindData();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -