コード例 #1
0
 private void delAcctBan_AcctDelBanSubmitted(object sender, DelAcctBan.DelBanSubmittedEventArgs e)
 {
     SendToServer(String.Format("{0} {1}", Constants.UnBanAccount, e.account));
 }
コード例 #2
0
        private void delAcctBanButtonItem_Click(object sender, EventArgs e)
        {
            Dictionary<string, List<string>> acctDict = mysql.ReadAll(Settings.Default.AuthDB, "account");

            var acctDictionary = new Dictionary<string, string>();

            if (acctDict.ContainsKey("id") && acctDict.ContainsKey("username"))
            {
                for (int i = 0; i < acctDict["id"].Count; i++)
                {
                    acctDictionary.Add(acctDict["id"][i], acctDict["username"][i]);
                }
            }

            Dictionary<string, List<string>> banDict = mysql.ReadAll(Settings.Default.AuthDB, "account_banned",
            new [] { "active" }, new [] { "1" });

            var banList = new List<string>();

            if (banDict.ContainsKey("id"))
            {
                for (int i = 0; i < banDict["id"].Count; i++)
                {
                    banList.Add(banDict["id"][i]);
                }
            }

            var bannedPlayers = new List<string>();

            for (int i = 0; i < banList.Count; i++)
            {
                if (acctDictionary.ContainsKey(banList[i]))
                    bannedPlayers.Add(acctDictionary[banList[i]]);
            }

            using (var delAcctBan = new DelAcctBan())
            {
                delAcctBan.AcctDelBanSubmitted += delAcctBan_AcctDelBanSubmitted;

                delAcctBan.acctList = bannedPlayers;

                delAcctBan.ShowDialog();
            }
        }