public void Set(string taskId, HandEnum handEnum) { try { if (handEnum == HandEnum.UPLOAD) { Log.WriteLog("Release semophore UPLOAD"); if (!_productSemaphore[taskId].WaitOne(0)) { _productSemaphore[taskId].Release(); } } else if (handEnum == HandEnum.LOAD) { Log.WriteLog("Release semophore Load"); if (!_customSemphore[taskId].WaitOne(0)) { _customSemphore[taskId].Release(); } } } catch (Exception ex) { Log.WriteLog("Release semophore:" + handEnum.ToString() + ex.ToString()); } }
private void dealSingleHand() { //Deal the hand gameDeck.shuffleDeck(); //shuffle the deck board.clearCommunityCards(); dealNextHand(); dealFlop(); dealTurn(); dealRiver(); clsEvaluateHand playerHandEvaluator = new clsEvaluateHand(testSeat.Hand, board); HandEnum playerHandValue = playerHandEvaluator.EvaluateHand(); handValue = playerHandValue.ToString(); int numericHandValue = determineNumbericHandValue(handValue); //create and add current hand object to the list clsHandEvalTest currentHandList = new clsHandEvalTest(pocketCard1, pocketCard2, boardCard1, boardCard2, boardCard3, boardCard4, boardCard5, handValue, numericHandValue); //create the hand object handsList.Add(currentHandList); }
private void btnCustomHand_Click(object sender, EventArgs e) { /* * //Deal the hand * gameDeck.shuffleDeck(); //shuffle the deck * board.clearCommunityCards(); * * dealNextHand(); * dealFlop(); * dealTurn(); * dealRiver(); */ //Must convert from pip input to numeric form which the HandEvaluator can work with string pocketCard1 = txtPC1.Text.ToString(); string pocketCard2 = txtPC2.Text.ToString(); string boardCard1 = txtBC1.Text.ToString(); string boardCard2 = txtBC2.Text.ToString(); string boardCard3 = txtBC3.Text.ToString(); string boardCard4 = txtBC4.Text.ToString(); string boardCard5 = txtBC5.Text.ToString(); int numPocketCard1 = clsCardDeck.convertPipToNumeric(pocketCard1); int numPocketCard2 = clsCardDeck.convertPipToNumeric(pocketCard2); int numBoardCard1 = clsCardDeck.convertPipToNumeric(boardCard1); int numBoardCard2 = clsCardDeck.convertPipToNumeric(boardCard2); int numBoardCard3 = clsCardDeck.convertPipToNumeric(boardCard3); int numBoardCard4 = clsCardDeck.convertPipToNumeric(boardCard4); int numBoardCard5 = clsCardDeck.convertPipToNumeric(boardCard5); //should be converted at this point //Now populate the seats and board with those values testSeat.Hand.Card1 = numPocketCard1; testSeat.Hand.Card2 = numPocketCard2; board.FirstCard = numBoardCard1; board.SecondCard = numBoardCard2; board.ThirdCard = numBoardCard3; board.FourthCard = numBoardCard4; board.FifthCard = numBoardCard5; board.setCommunityCardsToFive(); //required since flop, turn, and river increase community cards clsEvaluateHand playerHandEvaluator = new clsEvaluateHand(testSeat.Hand, board); HandEnum playerHandValue = playerHandEvaluator.EvaluateHand(); handValue = playerHandValue.ToString(); int numericHandValue = determineNumbericHandValue(handValue); //create and add current hand object to the list clsHandEvalTest currentHandList = new clsHandEvalTest(pocketCard1, pocketCard2, boardCard1, boardCard2, boardCard3, boardCard4, boardCard5, handValue, numericHandValue); //create the hand object handsList.Add(currentHandList); //send the datalist handsDataCounter = new clsHandsData(handsList); //print results of custom hand to grid printResultsToDataGridView(); updateRTBHandsData(handsDataCounter); }