Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Multiselect = true;
            fileDialog.Title       = "请选择文件";
            fileDialog.Filter      = "所有文件(*.*)|*.*";

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                string file = fileDialog.FileName;
                if (file.Contains("LoginServer.ini") || file.Contains("loginserver.ini"))
                {
                    txt_gameVerFile.Text = file;
                }
                else
                {
                    MessageBox.Show("错误的文件,请重新选择!");
                    txt_gameVerFile.Text = "请选择版本文件!";
                    return;
                }
            }
            else
            {
                return;
            }

            //读取版本号到vertxt
            string CurVer = CIniCtrl.ReadIniData("System", "Version", "", txt_gameVerFile.Text);

            txt_gameVer.Text = CurVer;

            //保存次路径到工具配置文件
            CIniCtrl.WriteIniData("Config", "gameVersionFile", txt_gameVerFile.Text, serverIni);
        }
Пример #2
0
        private void load_Soul_Conf()
        {
            //读取武魂设置
            string LoginServerFile = txt_svrForder.Text + "\\Login\\LoginServer.ini";

            if (!File.Exists(LoginServerFile))
            {
                return;
            }
            string tmp = "";

            tmp = CIniCtrl.ReadIniData("soul", "ticket_weekday", "", LoginServerFile);
            txt_soulticketwdy.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");

            tmp = CIniCtrl.ReadIniData("soul", "ticket_sell", "", LoginServerFile);
            txt_soulsellday.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");

            tmp = CIniCtrl.ReadIniData("soul", "battle_weekday", "", LoginServerFile);
            txt_soulbattlwdy.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");

            tmp = CIniCtrl.ReadIniData("soul", "battle_time", "", LoginServerFile);
            txt_soulbattltime.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");

            tmp = CIniCtrl.ReadIniData("soul", "battle_period", "", LoginServerFile);
            txt_soulbattlperiod.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");
        }
Пример #3
0
        public static string CmdGetVersion()
        {
            string ErrInfo = "";

            try
            {
                string versionIni = System.AppDomain.CurrentDomain.BaseDirectory + verIni;

                //找出传递过来的用户名和密码
                string ver  = "";
                string link = "111";
                ver = CIniCtrl.ReadIniData("Config", "loginVersion", "", versionIni);

                if (File.Exists("D:\\sgserver\\FtpRoot\\Update.zip"))
                {
                    System.IO.FileInfo f = new FileInfo("D:\\sgserver\\FtpRoot\\Update.zip");
                    ErrInfo = ver + "版本" + link + "长度" + f.Length.ToString();
                }
                else
                {
                    ErrInfo = ver + "版本" + link + "长度1";
                }

                LogHelper.WriteLog(System.AppDomain.CurrentDomain.BaseDirectory, ErrInfo, new StackTrace(new StackFrame(true)));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(System.AppDomain.CurrentDomain.BaseDirectory, ex.Message, new StackTrace(new StackFrame(true)));
                ErrInfo = "error";
            }

            return(ErrInfo);
        }
Пример #4
0
        private void btn_startQues_Click(object sender, EventArgs e)
        {
            if (!m_Active)
            {
                MessageBox.Show("软件尚未激活! 请联系软件发布人给予激活!");
                return;
            }
            m_SGExHandle.LoadLoginServerPtr("");
            if (txt_QusbankFile.Text == string.Empty)
            {
                MessageBox.Show("请选择题库!");
                return;
            }
            if (txt_TaskTime.Text == string.Empty || txt_AskNormalInterval.Text == string.Empty ||
                txt_AnswerVtId.Text == string.Empty || txt_AnswerVtName.Text == string.Empty ||
                txt_QuesInterval.Text == string.Empty || txt_MaxQuesNum.Text == string.Empty)
            {
                MessageBox.Show("请确保[开始时间][普通题间隔][奖励id][奖励名称][出题总数][问答间隔]均设置成功!");
                return;
            }
            //构建竞赛奖励字符串
            string normalReward = rbx_QANormalDetil.Text;
            string taskReward   = "";

            for (int i = 1; i <= 10; i++)
            {
                string key    = "m_TaskRecharge" + i;
                string reward = CIniCtrl.ReadIniData("Config", key, "", serverIni);
                if (reward != string.Empty && reward != "")
                {
                    taskReward += reward + "&";
                }
            }
            if (g_StopQues)
            {
                g_StopQues         = false;
                btn_startQues.Text = "停止";
                m_SleepCount       = m_AskNormalInterval = UInt32.Parse(txt_AskNormalInterval.Text);
                m_AnswerVtId       = UInt32.Parse(txt_AnswerVtId.Text);
                m_AnswerVtName     = txt_AnswerVtName.Text;

                m_SGExHandle.SetConfigPath(txt_gameVerFile.Text);
                m_SGExHandle.LoadAQBank(txt_QusbankFile.Text);
                m_SGExHandle.SetQADatVt(txt_svrForder.Text + "\\DataBase\\saves\\players.dat");
                m_SGExHandle.SetQAReward((int)m_AnswerVtId, m_AnswerVtName);
                m_SGExHandle.SetQANormalReward(normalReward);
                m_SGExHandle.SetQATaskReward(taskReward);
                m_SGExHandle.SetMaxQuesNum(g_MaxQuesNum);
                m_SGExHandle.SetNormalInterval((int)m_AskNormalInterval);
                m_SGExHandle.SetTaskTime(m_TaskDate, m_TaskTime);
                m_SGExHandle.StartQAThread();
            }
            else
            {
                g_StopQues         = true;
                btn_startQues.Text = "开始";
                m_SGExHandle.StopQAThread();
            }
        }
Пример #5
0
        private void DoRcgLevelSelectedIndexChanged(string rcgLevel)
        {
            string rcgConf  = CIniCtrl.ReadIniData(rcgLevel, "rcgConf", "", serverIni);
            string leftNum  = CIniCtrl.ReadIniData(rcgLevel, "leftNum", "", serverIni);
            string rightNum = CIniCtrl.ReadIniData(rcgLevel, "rightNum", "", serverIni);

            cbx_rcgConf.Text    = rcgConf;
            cbx_rcgConfNum.Text = rcgConf;
            txt_betmLeft.Text   = leftNum;
            txt_betmRight.Text  = rightNum;
        }
Пример #6
0
        private void OnHandleRcgConfNum_SelectedIndexChanged(string conf_num)
        {
            serverIni = System.AppDomain.CurrentDomain.BaseDirectory + "配置文件.ini";
            string id   = "";
            string name = "";
            string num  = "";

            //读取
            id   = CIniCtrl.ReadIniData("Recharge", conf_num + "_id1", "", serverIni);
            name = CIniCtrl.ReadIniData("Recharge", conf_num + "_name1", "", serverIni);
            num  = CIniCtrl.ReadIniData("Recharge", conf_num + "_num1", "", serverIni);
            //配置内容
            txt_confId1.Text   = id;
            txt_confName1.Text = name;
            txt_confNum1.Text  = num;

            //读取
            id   = CIniCtrl.ReadIniData("Recharge", conf_num + "_id2", "", serverIni);
            name = CIniCtrl.ReadIniData("Recharge", conf_num + "_name2", "", serverIni);
            num  = CIniCtrl.ReadIniData("Recharge", conf_num + "_num2", "", serverIni);
            //配置内容
            txt_confId2.Text   = id;
            txt_confName2.Text = name;
            txt_confNum2.Text  = num;

            //读取
            id   = CIniCtrl.ReadIniData("Recharge", conf_num + "_id3", "", serverIni);
            name = CIniCtrl.ReadIniData("Recharge", conf_num + "_name3", "", serverIni);
            num  = CIniCtrl.ReadIniData("Recharge", conf_num + "_num3", "", serverIni);
            //配置内容
            txt_confId3.Text   = id;
            txt_confName3.Text = name;
            txt_confNum3.Text  = num;

            //读取
            id   = CIniCtrl.ReadIniData("Recharge", conf_num + "_id4", "", serverIni);
            name = CIniCtrl.ReadIniData("Recharge", conf_num + "_name4", "", serverIni);
            num  = CIniCtrl.ReadIniData("Recharge", conf_num + "_num4", "", serverIni);
            //配置内容
            txt_confId4.Text   = id;
            txt_confName4.Text = name;
            txt_confNum4.Text  = num;

            //读取
            id   = CIniCtrl.ReadIniData("Recharge", conf_num + "_id5", "", serverIni);
            name = CIniCtrl.ReadIniData("Recharge", conf_num + "_name5", "", serverIni);
            num  = CIniCtrl.ReadIniData("Recharge", conf_num + "_num5", "", serverIni);
            //配置内容
            txt_confId5.Text   = id;
            txt_confName5.Text = name;
            txt_confNum5.Text  = num;
        }
Пример #7
0
        private void cbx_xbconf_SelectedIndexChanged(object sender, EventArgs e)
        {
            clear_xbConfItems();
            xbconf_SelectedIndex = cbx_xbconf.SelectedIndex;
            string xbconfCap  = "xbconfCap" + cbx_xbconf.SelectedIndex;
            string xbconfDesc = "xbconfDesc" + cbx_xbconf.SelectedIndex;

            txt_xbconfCap.Text = CIniCtrl.ReadIniData("XbConf", xbconfCap, "", serverIni);
            rbx_confDesc.Text  = CIniCtrl.ReadIniData("XbConf", xbconfDesc, "", serverIni);

            //读取
            string tmp = "xbconfItemsId" + cbx_xbconf.SelectedIndex;
            string ret = CIniCtrl.ReadIniData("XbConf", tmp, "", serverIni);
            var    Ids = ret.Split(',');

            for (int i = 0; i < Ids.Length; i++)
            {
                string  ctrlName = "txt_xbId" + (i + 1);
                Control col      = this.groupBox17.Controls.Find(ctrlName, true)[0];
                TextBox txt      = col as TextBox;//转为TextBox
                txt.Text = Ids[i];
            }
            tmp = "xbconfItemsName" + cbx_xbconf.SelectedIndex;
            ret = CIniCtrl.ReadIniData("XbConf", tmp, "", serverIni);
            var Names = ret.Split(',');

            for (int i = 0; i < Names.Length; i++)
            {
                string  ctrlName = "txt_xbName" + (i + 1);
                Control col      = this.groupBox17.Controls.Find(ctrlName, true)[0];
                TextBox txt      = col as TextBox;//转为TextBox
                txt.Text = Names[i];
            }

            tmp = "xbconfItemsCount" + cbx_xbconf.SelectedIndex;
            ret = CIniCtrl.ReadIniData("XbConf", tmp, "", serverIni);
            var Counts = ret.Split(',');

            for (int i = 0; i < Counts.Length; i++)
            {
                string  ctrlName = "txt_xbCount" + (i + 1);
                Control col      = this.groupBox17.Controls.Find(ctrlName, true)[0];
                TextBox txt      = col as TextBox;//转为TextBox
                txt.Text = Counts[i];
            }

            tmp             = "xbconfDb" + cbx_xbconf.SelectedIndex;
            ret             = CIniCtrl.ReadIniData("XbConf", tmp, "", serverIni);
            txt_dbSend.Text = ret;
        }
Пример #8
0
 private void LoadXbMould()
 {
     for (int i = 0; i < cbx_xbconf.Items.Count; i++)
     {
         string xbconfCap  = "xbconfCap" + i;
         string xbconfDesc = "xbconfDesc" + i;
         string cap        = CIniCtrl.ReadIniData("XbConf", xbconfCap, "", serverIni);
         if (!string.IsNullOrEmpty(cap) && cap != "")
         {
             cbx_xbconf.Items[i] = cap;
         }
     }
     cbx_xbconf.SelectedIndex = 0;
     xbconf_SelectedIndex     = 0;
     txt_xbconfCap.Text       = CIniCtrl.ReadIniData("XbConf", "xbconfCap0", "", serverIni);
     rbx_confDesc.Text        = CIniCtrl.ReadIniData("XbConf", "xbconfDesc0", "", serverIni);
 }
Пример #9
0
 private void load_Process_Conf()
 {
     txt_ps1.Text  = CIniCtrl.ReadIniData("Prosess", "ps1", "", serverIni);
     txt_ps2.Text  = CIniCtrl.ReadIniData("Prosess", "ps2", "", serverIni);
     txt_ps3.Text  = CIniCtrl.ReadIniData("Prosess", "ps3", "", serverIni);
     txt_ps4.Text  = CIniCtrl.ReadIniData("Prosess", "ps4", "", serverIni);
     txt_ps5.Text  = CIniCtrl.ReadIniData("Prosess", "ps5", "", serverIni);
     txt_ps6.Text  = CIniCtrl.ReadIniData("Prosess", "ps6", "", serverIni);
     txt_ps7.Text  = CIniCtrl.ReadIniData("Prosess", "ps7", "", serverIni);
     txt_ps8.Text  = CIniCtrl.ReadIniData("Prosess", "ps8", "", serverIni);
     txt_ps9.Text  = CIniCtrl.ReadIniData("Prosess", "ps9", "", serverIni);
     txt_ps10.Text = CIniCtrl.ReadIniData("Prosess", "ps10", "", serverIni);
     txt_ps11.Text = CIniCtrl.ReadIniData("Prosess", "ps11", "", serverIni);
     txt_ps12.Text = CIniCtrl.ReadIniData("Prosess", "ps12", "", serverIni);
     txt_ps13.Text = CIniCtrl.ReadIniData("Prosess", "ps13", "", serverIni);
     txt_ps14.Text = CIniCtrl.ReadIniData("Prosess", "ps14", "", serverIni);
     txt_ps15.Text = CIniCtrl.ReadIniData("Prosess", "ps15", "", serverIni);
 }
Пример #10
0
        private void load_War_Conf()
        {
            //读取国战设置
            string LoginServerFile = txt_svrForder.Text + "\\Login\\LoginServer.ini";

            if (!File.Exists(LoginServerFile))
            {
                return;
            }
            string tmp = "";

            tmp = CIniCtrl.ReadIniData("System", "country_war_date", "", LoginServerFile);
            txt_wardate.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");

            tmp = CIniCtrl.ReadIniData("System", "country_war_time", "", LoginServerFile);
            txt_wartime.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");

            tmp = CIniCtrl.ReadIniData("System", "country_war_period", "", LoginServerFile);
            txt_warperiod.Text = tmp.Split(';')[0].Replace("\t", "").Replace(" ", "");
        }
Пример #11
0
        private void load_ServerPort_Conf()
        {
            //读取 //soldata/Server.ini
            string ServerFile = txt_svrForder.Text + "\\soldata\\Server.ini";

            if (!File.Exists(ServerFile))
            {
                return;
            }
            string loginPort = CIniCtrl.ReadIniData("LoginServer", "port", "", ServerFile);

            txt_loginPort.Text = loginPort;

            string DBPort = CIniCtrl.ReadIniData("DBServer", "port", "", ServerFile);

            txt_dbPort.Text = DBPort;

            string logPort = CIniCtrl.ReadIniData("LogServer", "port", "", ServerFile);

            txt_logPort.Text = logPort;

            string accountPort = CIniCtrl.ReadIniData("AccountServer", "port", "", ServerFile);

            txt_accountPort.Text = accountPort;

            string VTPort = CIniCtrl.ReadIniData("VTServer", "port", "", ServerFile);

            txt_VTPort.Text = VTPort;

            //map
            //string mapPort = "";
            //var list = CIniCtrlComm.ReadValues(ServerFile);
            //foreach (var item in list)
            //{
            //    if (item.Section == "MapServer")
            //    {
            //        mapPort += item.GetComment("port") + ",";
            //    }
            //}
            //txt_mapPort.Text = mapPort;

            string       mapPort = "";
            FileStream   rdfs    = new FileStream(ServerFile, FileMode.Open, FileAccess.Read);
            StreamReader rd      = new StreamReader(rdfs, Encoding.ASCII);

            rd.BaseStream.Seek(0, SeekOrigin.Begin);

            rd.DiscardBufferedData();
            rd.BaseStream.Seek(0, SeekOrigin.Begin);
            rd.BaseStream.Position = 0;

            string strLine = "";

            strLine = "";
            strLine = rd.ReadLine();
            string map_session = "";

            do
            {
                if (strLine.Contains("[MapServer]"))
                {
                    map_session = "MapServer";
                }
                if (strLine.Contains("port") && map_session == "MapServer")
                {
                    string map_port = strLine.Split('=')[1];
                    mapPort    += map_port + ",";
                    map_session = "";
                }

                strLine = "";
                strLine = rd.ReadLine();
            } while (strLine != null);
            rd.Close();
            rdfs.Close();

            txt_mapPort.Text = mapPort.Replace(" ", "");
        }
Пример #12
0
        private void cbc_QATaskIndex_SelectedIndexChanged(object sender, EventArgs e)
        {
            string key = "m_TaskRecharge" + cbc_QATaskIndex.Text;

            rbx_QATaskDetil.Text = CIniCtrl.ReadIniData("Config", key, "", serverIni);
        }
Пример #13
0
        private void LoadIniConf()
        {
            #region //sgserver信息
            string srvAddr = CIniCtrl.ReadIniData("Server", "ServerIP", "", serverIni);
            if (srvAddr != "")
            {
                sql_srvAddr     = srvAddr;
                txt_sqlsvr.Text = sql_srvAddr;
            }

            string srvPort = CIniCtrl.ReadIniData("Server", "SqlPort", "", serverIni);
            if (srvPort == "")
            {
                CIniCtrl.WriteIniData("Server", "SqlPort", "1433", serverIni);
            }
            else
            {
                sql_srvPort      = srvPort;
                txt_sqlPort.Text = sql_srvPort;
            }

            string srvUser = CIniCtrl.ReadIniData("Server", "SqlAccount", "", serverIni);
            if (srvUser != "")
            {
                sql_srvUser     = srvUser;
                txt_sqlAcc.Text = sql_srvUser;
            }

            string srvPwd = CIniCtrl.ReadIniData("Server", "SqlPasswd", "", serverIni);
            if (srvPwd != "")
            {
                sql_srvPwd      = srvPwd;
                txt_sqlPwd.Text = sql_srvPwd;
            }

            string mrgPort = CIniCtrl.ReadIniData("Server", "ListenPort", "", serverIni);
            if (mrgPort != "")
            {
                accMrgPort          = mrgPort;
                txt_accMrgPort.Text = accMrgPort;
            }

            string sqlAccount = CIniCtrl.ReadIniData("Server", "AccountName", "", serverIni);
            if (sqlAccount != "")
            {
                sqlAccountName          = sqlAccount;
                txt_sqlAccountName.Text = sqlAccountName;
            }
            string sqlSanvt = CIniCtrl.ReadIniData("Server", "SanvtName", "", serverIni);
            if (sqlSanvt != "")
            {
                sqlSanvtName          = sqlSanvt;
                txt_sqlSanvtName.Text = sqlSanvtName;
            }
            string sqlLog = CIniCtrl.ReadIniData("Server", "LogName", "", serverIni);
            if (sqlLog != "")
            {
                sqlLogName          = sqlLog;
                txt_sqlLogName.Text = sqlLogName;
            }
            #endregion
            #region //版本管理
            string gameVersionFile = CIniCtrl.ReadIniData("Config", "gameVersionFile", "", serverIni);
            if (gameVersionFile != "")
            {
                if (gameVersionFile.Contains("LoginServer.ini") || gameVersionFile.Contains("loginserver.ini"))
                {
                    txt_gameVerFile.Text = gameVersionFile;

                    //读取版本号到vertxt
                    string CurVer = CIniCtrl.ReadIniData("System", "Version", "", txt_gameVerFile.Text);
                    txt_gameVer.Text = CurVer;
                    m_SGExHandle.SetConfigPath(txt_gameVerFile.Text);
                }
                else
                {
                    txt_gameVerFile.Text = "请选择版本文件!";
                }
            }

            string loginVersion = CIniCtrl.ReadIniData("Config", "loginVersion", "", serverIni);
            if (loginVersion != "")
            {
                txt_loginVer.Text = loginVersion;
            }

            string gameServerFolder = CIniCtrl.ReadIniData("Config", "gameServerFolder", "", serverIni);
            if (gameServerFolder != "")
            {
                txt_svrForder.Text = gameServerFolder;
            }
            string gServerIp = CIniCtrl.ReadIniData("Server", "GServerIP", "", serverIni);
            if (gServerIp != "")
            {
                txt_GServerIP.Text = gServerIp;
            }

            string gameFreezeFilter = CIniCtrl.ReadIniData("Config", "FreezeFilter", "", serverIni);
            if (gameFreezeFilter != "")
            {
                rtb_FreezeFilter.Text = gameFreezeFilter;
                m_FreezeFilterList    = rtb_FreezeFilter.Text.Split(',');
            }
            #endregion
            #region //外挂检测
            string gameAutoFreeze = CIniCtrl.ReadIniData("Config", "AutoFreeze", "", serverIni);
            if (gameServerFolder != "" && gameAutoFreeze == "Enable")
            {
                cbx_AutoFreeze.Checked = true;
                btn_startListen_Click(null, null);
            }
            else
            {
                cbx_AutoFreeze.Checked = false;
            }
            #endregion
            #region //在线答题
            FillQAItemsView();
            rbx_QANormalDetil.Text = CIniCtrl.ReadIniData("Config", "m_NormalRecharge", "", serverIni);
            rbx_QATaskDetil.Text   = CIniCtrl.ReadIniData("Config", "m_TaskRecharge1", "", serverIni);

            string quesBankFile = CIniCtrl.ReadIniData("Config", "QuesBankFile", "", serverIni);
            txt_QusbankFile.Text = quesBankFile;


            txt_TaskDate.Text = CIniCtrl.ReadIniData("Config", "TaskDate", "", serverIni);
            if (txt_TaskDate.Text != string.Empty)
            {
                var dates = txt_TaskDate.Text.Split(',');
                m_TaskDate.Clear();
                foreach (var date in dates)
                {
                    m_TaskDate.Add(int.Parse(date));
                }
            }
            txt_TaskTime.Text = CIniCtrl.ReadIniData("Config", "TaskTime", "", serverIni);
            if (txt_TaskTime.Text != string.Empty)
            {
                var times = txt_TaskTime.Text.Split(';');
                m_TaskTime.Clear();
                foreach (var time in times)
                {
                    m_TaskTime.Add(time);
                }
            }

            string maxQuesNum = CIniCtrl.ReadIniData("Config", "MaxQuesNum", "", serverIni);
            if (maxQuesNum != string.Empty)
            {
                txt_MaxQuesNum.Text = maxQuesNum;
                g_MaxQuesNum        = int.Parse(maxQuesNum);
            }

            string quesInterval = CIniCtrl.ReadIniData("Config", "QuesInterval", "", serverIni);
            if (quesInterval != string.Empty)
            {
                txt_QuesInterval.Text = quesInterval;
                g_QuesInterval        = int.Parse(quesInterval);
            }

            string _AskNormalInterval = CIniCtrl.ReadIniData("Config", "m_AskNormalInterval", "", serverIni);
            if (_AskNormalInterval != string.Empty)
            {
                txt_AskNormalInterval.Text = _AskNormalInterval;
                m_AskNormalInterval        = UInt32.Parse(_AskNormalInterval);
            }

            string _AnswerVtId = CIniCtrl.ReadIniData("Config", "m_AnswerVtId", "", serverIni);
            if (_AskNormalInterval != string.Empty)
            {
                txt_AnswerVtId.Text = _AnswerVtId;
                m_AnswerVtId        = UInt32.Parse(_AnswerVtId);
            }

            string _AnswerVtName = CIniCtrl.ReadIniData("Config", "m_AnswerVtName", "", serverIni);
            m_AnswerVtName        = _AnswerVtName;
            txt_AnswerVtName.Text = _AnswerVtName;

            string gameAutoStartQues = CIniCtrl.ReadIniData("Config", "AutoStartQues", "", serverIni);
            if (gameAutoStartQues != "" && gameAutoStartQues == "Enable")
            {
                cbx_AutoStartQues.Checked = true;
                btn_startQues_Click(null, null);
            }
            else
            {
                cbx_AutoStartQues.Checked = false;
            }
            #endregion
            #region //加持公告
            string _15SrchInterval = CIniCtrl.ReadIniData("Config", "15SrchInterval", "", serverIni);
            if (_15SrchInterval != string.Empty)
            {
                g_15SrchInterval        = int.Parse(_15SrchInterval);
                txt_15srchInterval.Text = _15SrchInterval;
            }

            string _15MaxAnn = CIniCtrl.ReadIniData("Config", "15MaxAnn", "", serverIni);
            if (_15MaxAnn != string.Empty)
            {
                g_15MaxAnn        = _15MaxAnn;
                txt_15MaxAnn.Text = _15MaxAnn;
            }

            string _AnnItemsFile = CIniCtrl.ReadIniData("Config", "AnnItemsFile", "", serverIni);
            if (_AnnItemsFile != string.Empty)
            {
                txt_AnnItemsFile.Text = _AnnItemsFile;
                if (File.Exists(txt_AnnItemsFile.Text))
                {
                    rbx_DorpTalkItems.Text = File.ReadAllText(txt_AnnItemsFile.Text, Encoding.Default);
                }
            }

            string _15NameFilter = CIniCtrl.ReadIniData("Config", "15NameFilter", "", serverIni);
            g_15NameFilter        = _15NameFilter;
            rbx_15NameFilter.Text = _15NameFilter;

            string game15TalkAutoStart = CIniCtrl.ReadIniData("Config", "15TalkAutoStart", "", serverIni);
            if (game15TalkAutoStart != "" && game15TalkAutoStart == "Enable")
            {
                cbx_AutoStart15Talk.Checked = true;
                btn_15Talk_Click(null, null);
            }
            else
            {
                cbx_AutoStart15Talk.Checked = false;
            }

            #endregion
            #region //系统公告
            string liststring = CIniCtrl.ReadIniData("Config", "WorldWordsList", "", serverIni);
            if (liststring != string.Empty)
            {
                var list = liststring.Split(';');
                listBox1.Items.Clear();
                foreach (var it in list)
                {
                    listBox1.Items.Add(it);
                }
                listBox1.Update();
            }
            #endregion
        }
Пример #14
0
        private void btn_rcgInit_Click(object sender, EventArgs e)
        {
            if (btn_sql.Text == "连接数据库")
            {
                MessageBox.Show("请先连接数据库!");
                return;
            }

            //加载设定的配置
            Recharge_Conf[] conf = new Recharge_Conf[7];
            for (int i = 0; i < 7; i++)
            {
                string rcgLevel = "档位:" + (i + 1);
                string rcgConf  = CIniCtrl.ReadIniData(rcgLevel, "rcgConf", "", serverIni);
                string leftNum  = CIniCtrl.ReadIniData(rcgLevel, "leftNum", "", serverIni);
                string rightNum = CIniCtrl.ReadIniData(rcgLevel, "rightNum", "", serverIni);

                string id   = "";
                string name = "";
                string num  = "";
                //读取
                id   = CIniCtrl.ReadIniData("Recharge", rcgConf + "_id1", "", serverIni);
                name = CIniCtrl.ReadIniData("Recharge", rcgConf + "_name1", "", serverIni);
                num  = CIniCtrl.ReadIniData("Recharge", rcgConf + "_num1", "", serverIni);
                //配置内容
                conf[i].id1   = id == "" ? "0" : id;
                conf[i].name1 = name == "" ? "空" : name;
                conf[i].num1  = num == "" ? "0" : num;

                //读取
                id   = CIniCtrl.ReadIniData("Recharge", rcgConf + "_id2", "", serverIni);
                name = CIniCtrl.ReadIniData("Recharge", rcgConf + "_name2", "", serverIni);
                num  = CIniCtrl.ReadIniData("Recharge", rcgConf + "_num2", "", serverIni);
                //配置内容
                conf[i].id2   = id == "" ? "0" : id;
                conf[i].name2 = name == "" ? "空" : name;
                conf[i].num2  = num == "" ? "0" : num;

                //读取
                id   = CIniCtrl.ReadIniData("Recharge", rcgConf + "_id3", "", serverIni);
                name = CIniCtrl.ReadIniData("Recharge", rcgConf + "_name3", "", serverIni);
                num  = CIniCtrl.ReadIniData("Recharge", rcgConf + "_num3", "", serverIni);
                //配置内容
                conf[i].id3   = id == "" ? "0" : id;
                conf[i].name3 = name == "" ? "空" : name;
                conf[i].num3  = num == "" ? "0" : num;

                //读取
                id   = CIniCtrl.ReadIniData("Recharge", rcgConf + "_id4", "", serverIni);
                name = CIniCtrl.ReadIniData("Recharge", rcgConf + "_name4", "", serverIni);
                num  = CIniCtrl.ReadIniData("Recharge", rcgConf + "_num4", "", serverIni);
                //配置内容
                conf[i].id4   = id == "" ? "0" : id;
                conf[i].name4 = name == "" ? "空" : name;
                conf[i].num4  = num == "" ? "0" : num;

                //读取
                id   = CIniCtrl.ReadIniData("Recharge", rcgConf + "_id5", "", serverIni);
                name = CIniCtrl.ReadIniData("Recharge", rcgConf + "_name5", "", serverIni);
                num  = CIniCtrl.ReadIniData("Recharge", rcgConf + "_num5", "", serverIni);
                //配置内容
                conf[i].id5   = id == "" ? "0" : id;
                conf[i].name5 = name == "" ? "空" : name;
                conf[i].num5  = num == "" ? "0" : num;

                leftNum  = leftNum == "" ? "0" : leftNum;
                rightNum = rightNum == "" ? "-1" : rightNum;
                if (Int32.Parse(leftNum) >= Int32.Parse(rightNum))
                {
                    conf[i].leftNum  = "0";
                    conf[i].rightNum = "-1";
                }
                else
                {
                    conf[i].leftNum  = leftNum;
                    conf[i].rightNum = rightNum;
                }
            }

            string cmd = "";
            string ret = "";

            //删除[recharge_history]表
            cmd = @"DROP TABLE recharge_history";
            ret = CSGHelper.SqlCommand(cmd);
            if (ret != "success")
            {
                MessageBox.Show("删除[recharge_history]表失败!");
                //return;
            }
            //删除game_acc 的 Account_Insert触发器
            cmd = @"drop trigger Account_Insert ";
            ret = CSGHelper.SqlCommand(cmd);
            if (ret != "success")
            {
                MessageBox.Show("删除game_acc 的 Account_Insert触发器失败!");
                //return;
            }
            //创建[recharge_history]表
            cmd =
                @"create table [recharge_history]
(
account varchar(21) PRIMARY KEY,
point int default 0,
time datetime
)";
            ret = CSGHelper.SqlCommand(cmd);
            if (ret != "success")
            {
                MessageBox.Show("创建[recharge_history]表失败!");
                return;
            }
            //同步账户名
            cmd =
                @"insert INTO recharge_history(account,point)
SELECT account,point
FROM game_acc";
            ret = CSGHelper.SqlCommand(cmd);
            if (ret != "success")
            {
                MessageBox.Show("同步game_acc账户名和point到recharge_history失败!");
                return;
            }
            //创建game_acc 的 Account_Insert触发器,game_acc有插入时同样插入信息到recharge_history
            cmd =
                @"CREATE TRIGGER Account_Insert ON dbo.game_acc 
FOR INSERT 
AS 
DECLARE @account varchar(21)
Select @account=account from inserted 
insert INTO recharge_history(account,point) values (@account,0)";
            ret = CSGHelper.SqlCommand(cmd);
            if (ret != "success")
            {
                MessageBox.Show("创建game_acc 的 Account_Insert触发器失败!");
                return;
            }
            //创建recharge_history 的 Recharge_Update触发器,充值更新point,触发更新game_acc的point
            cmd =
                @"CREATE TRIGGER Recharge_Update ON dbo.recharge_history 
FOR UPDATE 
AS 
DECLARE @account varchar(21)
DECLARE @point int
DECLARE @old_point int
DECLARE @add_point int
DECLARE @old_point_acc int
DECLARE @new_point_acc int
Select @account=account from inserted 
Select @point=point from inserted 
SELECT @old_point=point FROM DELETED
SET @add_point = @point - @old_point

Select @old_point_acc=point from dbo.game_acc where account = @account
set @new_point_acc = @old_point_acc + @add_point
Update dbo.game_acc set point = @new_point_acc where account = @account

DECLARE @cardid varchar(100)
DECLARE @dtDate datetime
set @dtDate = getdate()
SET @cardid = CONVERT(varchar(100), GETDATE(), 21)
PRINT @cardid

DECLARE @DataID1 int
DECLARE @Number1 int
DECLARE @DataID2 int
DECLARE @Number2 int
DECLARE @DataID3 int
DECLARE @Number3 int
DECLARE @DataID4 int
DECLARE @Number4 int
DECLARE @DataID5 int
DECLARE @Number5 int

set @DataID1 = 0
set @Number1 = 0
set @DataID2 = 0
set @Number2 = 0
set @DataID3 = 0
set @Number3 = 0
set @DataID4 = 0
set @Number4 = 0
set @DataID5 = 0
set @Number5 = 0

if (@add_point >= " + conf[0].leftNum + " AND @add_point < " + conf[0].rightNum + @")
	begin
	set @DataID1 = "     + conf[0].id1 + @"
	set @Number1 = "     + conf[0].num1 + @"
	set @DataID2 = "     + conf[0].id2 + @"
	set @Number2 = "     + conf[0].num2 + @"
	set @DataID3 = "     + conf[0].id3 + @"
	set @Number3 = "     + conf[0].num3 + @"
	set @DataID4 = "     + conf[0].id4 + @"
	set @Number4 = "     + conf[0].num4 + @"
	set @DataID5 = "     + conf[0].id5 + @"
	set @Number5 = "     + conf[0].num5 + @"
	end
else if (@add_point >= " + conf[1].leftNum + " AND @add_point < " + conf[1].rightNum + @")
	begin
	set @DataID1 = "     + conf[1].id1 + @"
	set @Number1 = "     + conf[1].num1 + @"
	set @DataID2 = "     + conf[1].id2 + @"
	set @Number2 = "     + conf[1].num2 + @"
	set @DataID3 = "     + conf[1].id3 + @"
	set @Number3 = "     + conf[1].num3 + @"
	set @DataID4 = "     + conf[1].id4 + @"
	set @Number4 = "     + conf[1].num4 + @"
	set @DataID5 = "     + conf[1].id5 + @"
	set @Number5 = "     + conf[1].num5 + @"
	end
else if (@add_point >= " + conf[2].leftNum + " AND @add_point < " + conf[2].rightNum + @")
	begin
	set @DataID1 = "     + conf[2].id1 + @"
	set @Number1 = "     + conf[2].num1 + @"
	set @DataID2 = "     + conf[2].id2 + @"
	set @Number2 = "     + conf[2].num2 + @"
	set @DataID3 = "     + conf[2].id3 + @"
	set @Number3 = "     + conf[2].num3 + @"
	set @DataID4 = "     + conf[2].id4 + @"
	set @Number4 = "     + conf[2].num4 + @"
	set @DataID5 = "     + conf[2].id5 + @"
	set @Number5 = "     + conf[2].num5 + @"
	end
else if (@add_point >= " + conf[3].leftNum + " AND @add_point < " + conf[3].rightNum + @")
	begin
	set @DataID1 = "     + conf[3].id1 + @"
	set @Number1 = "     + conf[3].num1 + @"
	set @DataID2 = "     + conf[3].id2 + @"
	set @Number2 = "     + conf[3].num2 + @"
	set @DataID3 = "     + conf[3].id3 + @"
	set @Number3 = "     + conf[3].num3 + @"
	set @DataID4 = "     + conf[3].id4 + @"
	set @Number4 = "     + conf[3].num4 + @"
	set @DataID5 = "     + conf[3].id5 + @"
	set @Number5 = "     + conf[3].num5 + @"
	end
else if (@add_point >= " + conf[4].leftNum + " AND @add_point < " + conf[4].rightNum + @")
	begin
	set @DataID1 = "     + conf[4].id1 + @"
	set @Number1 = "     + conf[4].num1 + @"
	set @DataID2 = "     + conf[4].id2 + @"
	set @Number2 = "     + conf[4].num2 + @"
	set @DataID3 = "     + conf[4].id3 + @"
	set @Number3 = "     + conf[4].num3 + @"
	set @DataID4 = "     + conf[4].id4 + @"
	set @Number4 = "     + conf[4].num4 + @"
	set @DataID5 = "     + conf[4].id5 + @"
	set @Number5 = "     + conf[4].num5 + @"
	end
else if (@add_point >= " + conf[5].leftNum + " AND @add_point < " + conf[5].rightNum + @")
	begin
	set @DataID1 = "     + conf[5].id1 + @"
	set @Number1 = "     + conf[5].num1 + @"
	set @DataID2 = "     + conf[5].id2 + @"
	set @Number2 = "     + conf[5].num2 + @"
	set @DataID3 = "     + conf[5].id3 + @"
	set @Number3 = "     + conf[5].num3 + @"
	set @DataID4 = "     + conf[5].id4 + @"
	set @Number4 = "     + conf[5].num4 + @"
	set @DataID5 = "     + conf[5].id5 + @"
	set @Number5 = "     + conf[5].num5 + @"
	end
else if (@add_point >= " + conf[6].leftNum + " AND @add_point < " + conf[6].rightNum + @")
	begin
	set @DataID1 = "     + conf[6].id1 + @"
	set @Number1 = "     + conf[6].num1 + @"
	set @DataID2 = "     + conf[6].id2 + @"
	set @Number2 = "     + conf[6].num2 + @"
	set @DataID3 = "     + conf[6].id3 + @"
	set @Number3 = "     + conf[6].num3 + @"
	set @DataID4 = "     + conf[6].id4 + @"
	set @Number4 = "     + conf[6].num4 + @"
	set @DataID5 = "     + conf[6].id5 + @"
	set @Number5 = "     + conf[6].num5 + @"
	end

INSERT INTO " + txt_sanvtName.Text + @".dbo.vitem (Account,Disable,Card,Login_time,Get_time,SName,CharName,Type,
DataID1,Number1,DataID2,Number2,DataID3,Number3,DataID4,Number4,DataID5,Number5)
values (@account,0,@cardid,@dtDate,@dtDate,0,0,0,
@DataID1,@Number1,@DataID2,@Number2,@DataID3,@Number3,@DataID4,@Number4,@DataID5,@Number5)";
            ret = CSGHelper.SqlCommand(cmd);

            if (ret == "success")
            {
                string msg = @"当前设定如下:

本服不设定非固定充值,非以下固定充值将以第三方设置比例结算。

(1)范围:" + conf[0].leftNum + "-" + conf[0].rightNum + "额外获得:" + conf[0].name1 + "*" + conf[0].num1 + ";" + conf[0].name2 + "*" + conf[0].num2 + ";" + conf[0].name3 + "*" + conf[0].num3 + ";" + conf[0].name4 + "*" + conf[0].num4 + ";" + conf[0].name5 + "*" + conf[0].num5 + @";

(2)范围:" + conf[1].leftNum + "-" + conf[1].rightNum + "额外获得:" + conf[1].name1 + "*" + conf[1].num1 + ";" + conf[1].name2 + "*" + conf[1].num2 + ";" + conf[1].name3 + "*" + conf[1].num3 + ";" + conf[1].name4 + "*" + conf[1].num4 + ";" + conf[1].name5 + "*" + conf[1].num5 + @";

(3)范围:" + conf[2].leftNum + "-" + conf[2].rightNum + "额外获得:" + conf[2].name1 + "*" + conf[2].num1 + ";" + conf[2].name2 + "*" + conf[2].num2 + ";" + conf[2].name3 + "*" + conf[2].num3 + ";" + conf[2].name4 + "*" + conf[2].num4 + ";" + conf[2].name5 + "*" + conf[2].num5 + @";

(4)范围:" + conf[3].leftNum + "-" + conf[3].rightNum + "额外获得:" + conf[3].name1 + "*" + conf[3].num1 + ";" + conf[3].name2 + "*" + conf[3].num2 + ";" + conf[3].name3 + "*" + conf[3].num3 + ";" + conf[3].name4 + "*" + conf[3].num4 + ";" + conf[3].name5 + "*" + conf[3].num5 + @";

(5)范围:" + conf[4].leftNum + "-" + conf[4].rightNum + "额外获得:" + conf[4].name1 + "*" + conf[4].num1 + ";" + conf[4].name2 + "*" + conf[4].num2 + ";" + conf[4].name3 + "*" + conf[4].num3 + ";" + conf[4].name4 + "*" + conf[4].num4 + ";" + conf[4].name5 + "*" + conf[4].num5 + @";

(6)范围:" + conf[5].leftNum + "-" + conf[5].rightNum + "额外获得:" + conf[5].name1 + "*" + conf[5].num1 + ";" + conf[5].name2 + "*" + conf[5].num2 + ";" + conf[5].name3 + "*" + conf[5].num3 + ";" + conf[5].name4 + "*" + conf[5].num4 + ";" + conf[5].name5 + "*" + conf[5].num5 + @";

(6)范围:" + conf[6].leftNum + "-" + conf[6].rightNum + "额外获得:" + conf[6].name1 + "*" + conf[6].num1 + ";" + conf[6].name2 + "*" + conf[6].num2 + ";" + conf[6].name3 + "*" + conf[6].num3 + ";" + conf[6].name4 + "*" + conf[6].num4 + ";" + conf[6].name5 + "*" + conf[6].num5 + @";";
                MessageBox.Show(msg);
            }
            else
            {
                MessageBox.Show("创建recharge_history 的 Recharge_Update触发器失败!");
                return;
            }
        }