using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
using TopWinCMS.Common;
using TopWinCMS.Model;
using TopWinCMS.BLL;
namespace TopWinCMS.WebUI.Admin.Explorer
{
    public partial class FileEditor : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            RightsCheck.CheckWorkPower("P_2");
             
            if (!(IsPostBack))
            {
                try
                {
                    TB_File.Text = new FileIO().ReadFile(Request.QueryString["dir"]);
                    this.Title = Request.QueryString["dir"];
                }
                catch (Exception ex)
                {
                    Label1.Text = ex.Message;
                }
            }
        }

    

        protected void BT_Save_Click(object sender, EventArgs e)
        {
            try
            {
                new FileIO().WriterFile(Request.QueryString["dir"], TB_File.Text);

                MsgBox.Alert("保存成功！");
            }
            catch
            {
                MsgBox.Alert("文件为只读或者没有权限写入。");
            }
        }
    }
}
