Exemplo n.º 1
0
        /// <summary>
        /// Adds the hand information to the RAM database
        /// </summary>
        /// <param name="currentPokerHandInfo"></param>
        protected void HandlePokerHandInfoItemRAMOnly(PokerHandInfo currentPokerHandInfo)
        {
            //Add the holeCards
            lock (holeCardLocker)
            {
                holeCards.Add(currentPokerHandInfo.pokerHand.HandId, new Dictionary <long, databaseCache.holeCard>());

                //Add the holeCards
                foreach (databaseCache.holeCard cardSet in currentPokerHandInfo.holeCards)
                {
                    holeCards[currentPokerHandInfo.pokerHand.HandId].Add(cardSet.PlayerId, cardSet);
                }
            }

            //Add the handActions
            lock (actionLocker)
                handActions.Add(currentPokerHandInfo.pokerHand.HandId, currentPokerHandInfo.handActions);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Rather than take holeCards and actions one at a time we can optimize by just taking them once at the end of the hand
        /// </summary>
        /// <param name="holeCards"></param>
        /// <param name="handActions"></param>
        public void EndHand(databaseCache.pokerHand pokerHand, List <databaseCache.holeCard> holeCards, List <databaseCache.handAction> handActions)
        {
            databaseChangesSinceLastSnapshot = true;
            PokerHandInfo handInfo = new PokerHandInfo(pokerHand, holeCards, handActions);

            //So that we can keep an easy count on the number of current commit tasks we increment here
            lock (runningSubmitLocker)
                runningSubmitCounter++;

            //We use tasks to do the heavy lifting
            if (ConcurrencyMode.Concurrency == ConcurrencyMode.ConcurencyModel.MultiCore)
            {
                Task.Factory.StartNew(HandlePokerHandInfoItem, handInfo);
            }
            else
            {
                HandlePokerHandInfoItem(handInfo);
            }
        }