/// <summary> /// 直接发送问按钮点击响应 /// </summary> protected void sendFileButton_Click(object sender, EventArgs e) { string version = this.versionTextBox.Text; // 服务器列表 if (!string.IsNullOrEmpty(version) && version[version.Length - 1] != '/') { version = version + '/'; FTPManager.MakeDirectory(version); } foreach (var data in ServerListConfig.DataList) { foreach (var channel in data.ChannelList) { string text = string.Format("#{0} #{1} #{2} #{3} #{4} #{5} #{6} #{7} #{8};\r\n" , TableManager.GetGMTText(203) , TableManager.GetGMTText(204) , TableManager.GetGMTText(205) , TableManager.GetGMTText(206) , TableManager.GetGMTText(207) , TableManager.GetGMTText(401) , TableManager.GetGMTText(402) , TableManager.GetGMTText(403) , TableManager.GetGMTText(910)) + data.ServerList.GetText() + data.Name; if (!FTPManager.Upload(version + "ServerList." + channel + ".txt", Encoding.UTF8.GetBytes(text))) { this.outputLabel.Text = TableManager.GetGMTText(404); return; } } } this.outputLabel.Text = TableManager.GetGMTText(405); }
/// <summary> /// 发送表格 /// </summary> /// <param name="version">版本号</param> /// <returns>是否成功</returns> public static bool SendTable(string version) { byte[] buffer = null; errorText = ""; foreach (var data in ServerListConfig.DataList) { string md5Path = version + "/updateex/" + data.Name + "/"; string tablePath = md5Path + TableManager.Directory; FTPManager.MakeDirectory(version + "/"); FTPManager.MakeDirectory(version + "/updateex/"); FTPManager.MakeDirectory(version + "/updateex/" + data.Name); FTPManager.MakeDirectory(tablePath); TableManager.ClearMD5Record(); // 活动 List <mw.ActivityConfig> Updateactivitytable = GMTActivityMananger.GetTableActivity().Values.ToList(); buffer = TableManager.Serialize(Updateactivitytable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.ActivityConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.ActivityConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } List <mw.AchieveConfig> Updateachievetable = GMTActivityMananger.GetTableAchieve().Values.ToList(); buffer = TableManager.Serialize(Updateachievetable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.AchieveConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.AchieveConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } List <mw.RewardConfig> Updaterewardtable = GMTActivityMananger.GetTableReward().Values.ToList(); buffer = TableManager.Serialize(Updaterewardtable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.RewardConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.RewardConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } //编辑礼包 List <mw.GiftConfig> UpdatereGiftTable = new List <mw.GiftConfig>(); UpdatereGiftTable = GiftManager.addgiftconfig; buffer = TableManager.Serialize(UpdatereGiftTable); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.GiftConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.GiftConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } // 文本 buffer = TableManager.Serialize(TextManager.GetConfigList()); TableManager.UpdateMD5(buffer, TableManager.Directory + tableNameDictionary[typeof(mw.UIDescConfig)][0]); if (!FTPManager.Upload(tablePath + tableNameDictionary[typeof(mw.UIDescConfig)][0], buffer)) { errorText += FTPManager.GetLastError(); } buffer = Encoding.UTF8.GetBytes(TableManager.GetMD5Text()); if (!FTPManager.Upload(md5Path + "md5.txt", buffer)) { errorText += FTPManager.GetLastError(); } } if (string.IsNullOrEmpty(errorText)) { return(true); } return(false); }