Ejemplo n.º 1
0
        private IntPtr FindCashTableHandle(HandHistory handHistory)
        {
            if (handHistory.GameDescription.Limit == null ||
                string.IsNullOrEmpty(handHistory.TableName) || handHistory.TableName.Length < 2)
            {
                LogProvider.Log.Warn(this, $"Failed to find cash table because of null limit or empty table name. [{SiteString}]");
                return(IntPtr.Zero);
            }

            var isFreeroll = handHistory.GameDescription.Limit.Currency == Currency.PlayMoney;

            var cashTableKey = CashTableKey.From(handHistory.GameDescription.Limit.BigBlind,
                                                 handHistory.GameDescription.CashBuyInHigh,
                                                 handHistory.GameDescription.TableType.FirstOrDefault(),
                                                 handHistory.GameDescription.GameType, handHistory.GameDescription.SeatType.MaxPlayers);

            var tableName = string.Empty;

            if (isFreeroll)
            {
                if (!freerollTables.TryGetValue(cashTableKey, out tableName))
                {
                    LogProvider.Log.Warn(this, $"Failed to find predefined freeroll table for BB={cashTableKey.BigBlind}, GT={cashTableKey.GameType}, S={cashTableKey.TableTypeDescription}. [{SiteString}]");
                }
            }
            else
            {
                if (!ringTables.TryGetValue(cashTableKey, out tableName))
                {
                    LogProvider.Log.Warn(this, $"Failed to find predefined ring table for BB={cashTableKey.BigBlind}, GT={cashTableKey.GameType}, S={cashTableKey.TableTypeDescription}. [{SiteString}]");
                }
            }

            if (string.IsNullOrEmpty(tableName))
            {
                return(IntPtr.Zero);
            }

            var tableNumber = handHistory.TableName.Substring(handHistory.TableName.Length - 2);

            var possibleTableName = $"{tableName} - {tableNumber}";

            var openedTableKeyValue = openedTables.FirstOrDefault(x => x.Value.ContainsIgnoreCase(possibleTableName));

            return(openedTableKeyValue.Key);
        }
Ejemplo n.º 2
0
 protected bool Equals(CashTableKey cashTableKey)
 {
     return(cashTableKey != null && cashTableKey.BigBlind == BigBlind &&
            cashTableKey.GameType == GameType && cashTableKey.TableTypeDescription == TableTypeDescription &&
            cashTableKey.Seats == Seats && cashTableKey.Buyin == Buyin);
 }