/// <summary> /// 页面载入响应 /// </summary> protected void Page_Load(object sender, EventArgs e) { Response.ContentType = "application/x-msdownload"; string filename = "attachment; filename=" + "ServerList_" + ServerListConfig.GetData(0).Name + ".zip"; Response.AddHeader("Content-Disposition", filename); Response.BinaryWrite(CdnZip.PackServerList(Request.Params["version"])); }
/// <summary> /// 发送按钮点击响应 /// </summary> protected void sendButton_Click(object sender, EventArgs e) { /*if (string.IsNullOrEmpty(FTP.Site)) * { * this.outputLabel.Text = "FTP还没有配置"; * return; * } * * FTP ftp = new FTP(); * * string version; * if (string.IsNullOrEmpty(this.versionTextBox.Text)) * { * version = ""; * } * else * { * version = this.versionTextBox.Text + "/"; * ftp.MakeDirectory(this.versionTextBox.Text); * } * * StringBuilder builder = new StringBuilder(); * foreach (var data in ServerListConfig.DataList) * { * foreach (var channel in data.ChannelList) * { * builder.Append("channel:"); * string text = "#编号 #服务器名 #IP # 端口 #状态 #是否推荐 #大区ID #服务器名称ID;\r\n" + data.ServerList.GetText(); * if (ftp.Upload(version + "ServerList." + channel + ".txt", Encoding.UTF8.GetBytes(text))) * { * builder.Append("成功<br>"); * } * else * { * builder.Append("失败<br>"); * } * } * } * * this.outputLabel.Text = builder.ToString();*/ if (FTPManager.Upload("ServerList_" + ServerListConfig.DataList[0].Name + ".zip", CdnZip.PackServerList(this.versionTextBox.Text))) { this.outputLabel.Text = TableManager.GetGMTText(405); } else { this.outputLabel.Text = TableManager.GetGMTText(404); } }