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 UUN;
using System.Data.SqlClient;
using System.IO;

public partial class Admin_FuWu_ZaiXianShengJi : System.Web.UI.Page
{
    private 访问 访问;
    protected void Page_Load(object sender, EventArgs e)
    {
        访问 = new 访问(this.Context);
        访问.开始处理("在线升级", "网站后台", "在线升级", new 访问.回调委托(ZhiXing));
        访问.关闭连接();
    }

    private void ZhiXing()
    {
        访问.验证管理员();
        访问.验证权限("56");

        Response.Write("<style type=\"text/css\">div{font-size:12px}</style>");
        Response.Write("<div>");

        if (UUNSoft.是否可升级())
        {
            Response.Write("正在下载升级包...<br/>");
            Response.Flush();
            常用.下载文件(UUNSoft.官方网站 + "/update.aspx?v=" + UUNSoft.程序版本 + "&Act=download", Server.MapPath("~/update/update.rar"));
            Response.Write("下载文件成功..<br/>");
            Response.Flush();

            Response.Write("正在解压缩...<br/>");
            Response.Flush();
            String 解压位置 = 程序.安装位置+"update/" + 常用.随机字符(8) + "/";
            ZipC.UnZip(Server.MapPath("~/update/update.rar"), Server.MapPath(解压位置), "");
            Response.Write("解压缩成功..<br/>");
            Response.Flush();

            File.Delete(Server.MapPath("~/update/update.rar"));
            Response.Write("执行升级..");
            Response.Write("<script type=\"text/javascript\">location.href='");
            Response.Write(解压位置 + "default.aspx?folder=" + Server.UrlEncode(解压位置));
            Response.Write("';</script>");
        }
        else
            Response.Redirect("../Main.aspx");

        Response.Write("</div>");
    }
}
