public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            if (_fileName != null)
            {
                var isChanged = false;
                if (PathUtils.RemoveExtension(_fileName) != PathUtils.RemoveExtension(TbRelatedFileName.Text))//文件名改变
                {
                    var fileNames = DirectoryUtils.GetFileNames(_directoryPath);
                    foreach (var theFileName in fileNames)
                    {
                        var fileNameWithoutExtension = PathUtils.RemoveExtension(theFileName);
                        if (fileNameWithoutExtension == TbRelatedFileName.Text.ToLower())
                        {
                            FailMessage("包含文件修改失败,包含文件已存在!");
                            return;
                        }
                    }

                    isChanged = true;
                }

                if (PathUtils.GetExtension(_fileName) != LtlCreatedFileExtName.Text)//文件后缀改变
                {
                    isChanged = true;
                }

                var previousFileName = string.Empty;
                if (isChanged)
                {
                    previousFileName = _fileName;
                }

                var currentFileName = TbRelatedFileName.Text + LtlCreatedFileExtName.Text;
                var charset         = ECharsetUtils.GetEnumType(DdlCharset.SelectedValue);
                FileUtils.WriteText(PathUtils.Combine(_directoryPath, currentFileName), charset, TbContent.Text);
                if (!string.IsNullOrEmpty(previousFileName))
                {
                    FileUtils.DeleteFileIfExists(PathUtils.Combine(_directoryPath, previousFileName));
                }
                AuthRequest.AddSiteLog(SiteId, "修改包含文件", $"包含文件:{currentFileName}");
                SuccessMessage("包含文件修改成功!");
                AddWaitAndRedirectScript(PageTemplateInclude.GetRedirectUrl(SiteId));
            }
            else
            {
                var currentFileName = TbRelatedFileName.Text + LtlCreatedFileExtName.Text;

                var fileNames = DirectoryUtils.GetFileNames(_directoryPath);
                foreach (var theFileName in fileNames)
                {
                    if (StringUtils.EqualsIgnoreCase(theFileName, currentFileName))
                    {
                        FailMessage("包含文件添加失败,包含文件文件已存在!");
                        return;
                    }
                }

                var charset = ECharsetUtils.GetEnumType(DdlCharset.SelectedValue);
                FileUtils.WriteText(PathUtils.Combine(_directoryPath, currentFileName), charset, TbContent.Text);
                AuthRequest.AddSiteLog(SiteId, "添加包含文件", $"包含文件:{currentFileName}");
                SuccessMessage("包含文件添加成功!");
                AddWaitAndRedirectScript(PageTemplateInclude.GetRedirectUrl(SiteId));
            }
        }
 public void Return_OnClick(object sender, EventArgs e)
 {
     PageUtils.Redirect(PageTemplateInclude.GetRedirectUrl(SiteId));
 }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                if (fileName != null)
                {
                    var isChanged = false;
                    if (PathUtils.RemoveExtension(fileName) != PathUtils.RemoveExtension(RelatedFileName.Text))//文件名改变
                    {
                        var fileNames = DirectoryUtils.GetFileNames(directoryPath);
                        foreach (var theFileName in fileNames)
                        {
                            var fileNameWithoutExtension = PathUtils.RemoveExtension(theFileName);
                            if (fileNameWithoutExtension == RelatedFileName.Text.ToLower())
                            {
                                FailMessage("包含文件修改失败,包含文件已存在!");
                                return;
                            }
                        }

                        isChanged = true;
                    }

                    if (PathUtils.GetExtension(fileName) != ltlCreatedFileExtName.Text)//文件后缀改变
                    {
                        isChanged = true;
                    }

                    var previousFileName = string.Empty;
                    if (isChanged)
                    {
                        previousFileName = fileName;
                    }

                    var currentFileName = RelatedFileName.Text + ltlCreatedFileExtName.Text;
                    var charset         = ECharsetUtils.GetEnumType(Charset.SelectedValue);
                    try
                    {
                        FileUtils.WriteText(PathUtils.Combine(directoryPath, currentFileName), charset, Content.Text);
                        if (!string.IsNullOrEmpty(previousFileName))
                        {
                            FileUtils.DeleteFileIfExists(PathUtils.Combine(directoryPath, previousFileName));
                        }
                        Body.AddSiteLog(PublishmentSystemId, "修改包含文件", $"包含文件:{currentFileName}");
                        SuccessMessage("包含文件修改成功!");
                        AddWaitAndRedirectScript(PageTemplateInclude.GetRedirectUrl(PublishmentSystemId));
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "包含文件修改失败," + ex.Message);
                    }
                }
                else
                {
                    var currentFileName = RelatedFileName.Text + ltlCreatedFileExtName.Text;

                    var fileNames = DirectoryUtils.GetFileNames(directoryPath);
                    foreach (var theFileName in fileNames)
                    {
                        if (StringUtils.EqualsIgnoreCase(theFileName, currentFileName))
                        {
                            FailMessage("包含文件添加失败,包含文件文件已存在!");
                            return;
                        }
                    }

                    var charset = ECharsetUtils.GetEnumType(Charset.SelectedValue);
                    try
                    {
                        FileUtils.WriteText(PathUtils.Combine(directoryPath, currentFileName), charset, Content.Text);
                        Body.AddSiteLog(PublishmentSystemId, "添加包含文件", $"包含文件:{currentFileName}");
                        SuccessMessage("包含文件添加成功!");
                        AddWaitAndRedirectScript(PageTemplateInclude.GetRedirectUrl(PublishmentSystemId));
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "包含文件添加失败," + ex.Message);
                    }
                }
            }
        }