コード例 #1
0
        /// <summary>
        /// 发送ZIP包按钮点击响应
        /// </summary>
        protected void sendButton0_Click(object sender, EventArgs e)
        {
            if (ServerListConfig.DataList.Count == 0)
            {
                this.errorLabel.Text = TableManager.GMTDescTable[657].desc;
                return;
            }

            FTPManager.Upload("updateex_" + ServerListConfig.DataList[0].Name + ".zip", CdnZip.PackTable(this.versionTextBox.Text));
        }
コード例 #2
0
        /// <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);
            }
        }
コード例 #3
0
        //上传公告
        protected void uploadButton_Click(object sender, EventArgs e)
        {
            //foreach (var data in ServerListConfig.DataList)
            //{
            //string versiotn = GmModify.Version;
            //string NoticePath = versiotn + "/updateex/" + data.Name + "/ClientProto/";
            //string NoticePath = versiotn + "/updateex/";
            string NoticePath = "/update/Notice/";
            string content    = this.Noticetxt.Text;

            byte[] buffer = null;
            buffer = System.Text.UnicodeEncoding.UTF8.GetBytes(content);
            if (!FTPManager.Upload(NoticePath + "NoticeList.txt", buffer))
            {
                this.OutputLable.Text = TableManager.GetGMTText(821);
                return;
            }

            this.OutputLable.Text = TableManager.GetGMTText(822);

            //}
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        /// <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);
        }