Esempio n. 1
0
        /// <summary>
        /// 应用程序启动
        /// </summary>
        protected void Application_Start(object sender, EventArgs e)
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 100;

            Init();

            UserManager.Init();

            gmt.Server.Load();
            gmt.Server.newLoad();

            Log.Start();
            Network.Start();
            FTPManager.Load();
            TableManager.Start();
            TextManager.Load();
            RevolvingManager.Start();
            NoticeManager.Load();

            ActivityManger.Start();
            ServerListConfig.Load();
            GMTActivityMananger.start();
            GiftTable.Start();
            TimedMailSender.Init();
            RevolvingManager.UpdateService();
            PayType.LoadPayType();
        }
Esempio n. 2
0
        /// <summary>
        /// 页面载入响应
        /// </summary>
        protected override void OnGmPageLoad()
        {
            if (!this.IsPostBack)
            {
                List <int> ftpList = new List <int>();
                for (int i = 0; i < FTPManager.Count; ++i)
                {
                    FTP ftp = FTPManager.GetFTP(i);
                    if (null == ftp)
                    {
                        continue;
                    }

                    addFTP(i, ftp);
                    ftpList.Add(i);
                }
                ViewState["ftpList"] = ftpList;
                m_curIdx             = ftpList.Count;
            }
            else if (null != ViewState["ftpList"])
            {
                List <int> ftpList = (List <int>)ViewState["ftpList"];
                for (int i = 0; i < ftpList.Count; ++i)
                {
                    addFTP(ftpList[i], FTPManager.GetFTP(ftpList[i]));
                }
                int nIncIdx = 0;
                if (ftpList.Count != 0)
                {
                    nIncIdx = ftpList.Max();
                }
                m_curIdx = nIncIdx + 1;
            }
        }
        /// <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));
        }
        /// <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);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 保存按钮点击响应
        /// </summary>
        protected void saveButton_Click(object sender, EventArgs e)
        {
            int i = 0;

            FTPManager.Clear();
            foreach (TableRow Row in ftpTable.Rows)
            {
                FTP ftp = new FTP("", "", "");
                foreach (Control ctrl in Row.Controls)
                {
                    foreach (Control subCtrl in ctrl.Controls)
                    {
                        if (subCtrl.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
                        {
                            string name = ((TextBox)subCtrl).ID.Split('_')[0];
                            if (name == "tbFTP")
                            {
                                string textSite = ((TextBox)subCtrl).Text;
                                if (textSite.Length != 0 &&
                                    textSite[textSite.Length - 1] != '/')
                                {
                                    textSite += '/';
                                }

                                ftp.ftpSite = textSite;
                            }
                            else if (name == "tbUser")
                            {
                                ftp.ftpUser = ((TextBox)subCtrl).Text;
                            }
                            else if (name == "tbPWD")
                            {
                                ftp.ftpPassword = ((TextBox)subCtrl).Text;
                                ((TextBox)subCtrl).Attributes.Add("value", ftp.ftpPassword);
                            }
                        }
                    }
                }

                FTPManager.AddFTP(i, ftp);
                ++i;
            }

            FTPManager.Save();
        }
        //上传公告
        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);

            //}
        }
        /// <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);
        }