Exemplo n.º 1
0
 private void backgroundWorkerBtnOK_DoWork(object sender, DoWorkEventArgs e)
 {
     CEnum.Message_Body[] mMsg = (CEnum.Message_Body[])e.Argument;
     lock (typeof(C_Event.CSocketEvent))
     {
         if (mMsg.Length == 5)
         {
             e.Result = GMAdmin.ModuleAdd(this.m_ClientEvent, mMsg);
             try
             {
                 int iSrvCount = int.Parse(m_ClientEvent.GetInfo("ServersCount").ToString());
                 for (int iSrvIndex = 1; iSrvIndex <= iSrvCount; iSrvIndex++)
                 {
                     GMAdmin.ModuleAdd((CSocketEvent)m_ClientEvent.GetInfo("Server" + iSrvIndex), mMsg);
                 }
             }
             catch { }
         }
         else
         {
             e.Result = GMAdmin.ModuleModi(this.m_ClientEvent, mMsg);
             try
             {
                 int iSrvCount = int.Parse(m_ClientEvent.GetInfo("ServersCount").ToString());
                 for (int iSrvIndex = 1; iSrvIndex <= iSrvCount; iSrvIndex++)
                 {
                     GMAdmin.ModuleModi((CSocketEvent)m_ClientEvent.GetInfo("Server" + iSrvIndex), mMsg);
                 }
             }
             catch { }
         }
     }
 }
Exemplo n.º 2
0
        C_Global.CEnum.Message_Body[] requestMsgBody = null;            //编辑时传送过来的模块信息
        #endregion

        /// <summary>
        /// 创建/编辑模块
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, System.EventArgs e)
        {
            //创建
            if (!isModify)
            {
                C_Global.CEnum.Message_Body[] mMsg = new C_Global.CEnum.Message_Body[5];
                mMsg[0].eTag     = C_Global.CEnum.TagFormat.TLV_INTEGER;
                mMsg[0].eName    = C_Global.CEnum.TagName.UserByID;
                mMsg[0].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString());

                mMsg[1].eTag     = C_Global.CEnum.TagFormat.TLV_INTEGER;
                mMsg[1].eName    = C_Global.CEnum.TagName.GameID;
                mMsg[1].oContent = GMAdmin.GetContentID(mResult, comboBox1.SelectedItem.ToString());

                mMsg[2].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                mMsg[2].eName    = C_Global.CEnum.TagName.ModuleName;
                mMsg[2].oContent = textBox1.Text;

                mMsg[3].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                mMsg[3].eName    = C_Global.CEnum.TagName.ModuleClass;
                mMsg[3].oContent = textBox2.Text;

                mMsg[4].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                mMsg[4].eName    = C_Global.CEnum.TagName.ModuleContent;
                mMsg[4].oContent = textBox3.Text;

                C_Global.CEnum.Message_Body[,] mResultSave = GMAdmin.ModuleAdd(this.m_ClientEvent, mMsg);


                if (mResultSave[0, 0].oContent.Equals("SUCESS"))
                {
                    MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveOk"));
                    this.Close();
                }
                else
                {
                    MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveFailed"));
                }
            }
            else            //编辑
            {
                C_Global.CEnum.Message_Body[] mMsg = new C_Global.CEnum.Message_Body[6];


                mMsg[0].eTag     = C_Global.CEnum.TagFormat.TLV_INTEGER;
                mMsg[0].eName    = C_Global.CEnum.TagName.UserByID;
                mMsg[0].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString());

                mMsg[1].eTag     = C_Global.CEnum.TagFormat.TLV_INTEGER;
                mMsg[1].eName    = C_Global.CEnum.TagName.Module_ID;
                mMsg[1].oContent = int.Parse(requestMsgBody[0].oContent.ToString());

                mMsg[2].eTag     = C_Global.CEnum.TagFormat.TLV_INTEGER;
                mMsg[2].eName    = C_Global.CEnum.TagName.GameID;
                mMsg[2].oContent = GMAdmin.GetContentID(mResult, comboBox1.SelectedItem.ToString());

                mMsg[3].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                mMsg[3].eName    = C_Global.CEnum.TagName.ModuleName;
                mMsg[3].oContent = textBox1.Text;

                mMsg[4].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                mMsg[4].eName    = C_Global.CEnum.TagName.ModuleClass;
                mMsg[4].oContent = textBox2.Text;

                mMsg[5].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                mMsg[5].eName    = C_Global.CEnum.TagName.ModuleContent;
                mMsg[5].oContent = textBox3.Text;

                C_Global.CEnum.Message_Body[,] mResultSave = GMAdmin.ModuleModi(this.m_ClientEvent, mMsg);


                if (mResultSave[0, 0].oContent.Equals("SUCESS"))
                {
                    MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveOk"));
                    this.Close();
                }
                else
                {
                    MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveFailed"));
                }
            }
        }