Exemple #1
0
        /// <summary>
        /// 获得一套随机可用卡牌
        /// </summary>
        public static Stack <String> GetRandomCardStack(int Seed)
        {
            Stack <String> Ramdom = new Stack <string>();

            try
            {
                var cards = new List <String>();
                foreach (var CardSN in CardUtility.ReadyCardDic.Keys)
                {
                    if (CardSN.Substring(1, 1) == "0")
                    {
                        cards.Add(CardSN);
                    }
                }
                var newList = CardUtility.RandomSort <String>(cards.ToArray(), Seed);
                for (int i = 0; i < Math.Min(MaxCards, newList.Length); i++)
                {
                    Ramdom.Push(newList[i]);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
            return(Ramdom);
        }
Exemple #2
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            if (!CheckCardSN(CardSN))
            {
                //remove   comment
                //
                MsgBox.Show("卡号错误!" + Environment.NewLine +
                            "卡号长度必须为16位,并且只能由数字或 A - F 的字母组成!");
                return;
            }
            bool snExist;

            snExist = XGDB.CheckCardSNExist(CardSN.Trim(), _editId);
            if (snExist)
            {
                MsgBox.Show("卡号已经存在!");
                return;
            }
            DialogResult = DialogResult.OK;
            Close();
        }