Пример #1
0
        private List <string> ParseHands(SiteName site, string handText, ref int parsedHands, ref int thrownOutHands)
        {
            List <string> messages = new List <string>();
            // Each poker site has its own parser so we use a factory to get the right parser.
            IHandHistoryParserFactory handHistoryParserFactory = new HandHistoryParserFactoryImpl();

            // Get the correct parser from the factory.
            IHandHistoryParser handHistoryParser = handHistoryParserFactory.GetFullHandHistoryParser(site);

            try
            {
                List <string> hands = new List <string>();
                hands = handHistoryParser.SplitUpMultipleHands(handText).ToList();
                db.Configuration.AutoDetectChangesEnabled = false;
                foreach (string hand in hands)
                {
                    try
                    {
                        // The true causes hand-parse errors to get thrown. If this is false, hand-errors will
                        // be silent and null will be returned.
                        HandHistory handHistory = handHistoryParser.ParseFullHandHistory(hand, true);

                        //handhistory can now be broken down to be put into the database

                        // Add to player table
                        Dictionary <string, player> playerDict = addPlayersToDB(handHistory);

                        // Add to table table
                        table dbTable = addTableToDB(handHistory);

                        db.SaveChanges();

                        //Add to hand table
                        hand dbHand = addHandToDB(handHistory, dbTable);

                        // Add to hand_action table
                        addHandActionToDB(handHistory, dbHand, playerDict);

                        // Add to plays table
                        addPlaysToDB(handHistory, playerDict);

                        db.SaveChanges();

                        parsedHands++;
                    }
                    catch (Exception ex)
                    {
                        messages.Add("Parsing Error: " + ex.Message);
                        thrownOutHands++;
                    }
                }
            }
            catch (Exception ex) // Catch hand-parsing exceptions
            {
                messages.Add("Parsing Error: " + ex.Message);
            }
            db.Configuration.AutoDetectChangesEnabled = true;
            return(messages);
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            IHandHistoryParserFactory handHistoryParserFactory = new HandHistoryParserFactoryImpl();

            // Get the correct parser from the factory.
            IHandHistoryParser handHistoryParser = handHistoryParserFactory.GetFullHandHistoryParser(HandHistories.Objects.GameDescription.SiteName.PokerStars);

            var handText = System.IO.File.ReadAllText("input.txt");

            try
            {
                // The true causes hand-parse errors to get thrown. If this is false, hand-errors will
                // be silent and null will be returned.
                HandHistory handHistory = handHistoryParser.ParseFullHandHistory(handText, true);
            }
            catch (Exception ex)                                     // Catch hand-parsing exceptions
            {
                Console.WriteLine("Parsing Error: {0}", ex.Message); // Example logging.
            }
        }
Пример #3
0
        public HandHistory ParseHand(SiteName site, string handText, ref int parsedHands, ref int thrownOutHands)
        {
            // Each poker site has its own parser so we use a factory to get the right parser.
            IHandHistoryParserFactory handHistoryParserFactory = new HandHistoryParserFactoryImpl();

            // Get the correct parser from the factory.
            IHandHistoryParser handHistoryParser = handHistoryParserFactory.GetFullHandHistoryParser(site);

            try
            {
                // The true causes hand-parse errors to get thrown. If this is false, hand-errors will
                // be silent and null will be returned.
                List <string> hands = new List <string>();
                hands = handHistoryParser.SplitUpMultipleHands(handText).ToList();
                foreach (string hand in hands)
                {
                    try
                    {
                        HandHistory handHistory = handHistoryParser.ParseFullHandHistory(hand, true);
                        Console.WriteLine(handHistory.HandId);
                        parsedHands++;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Parsing Error: {0}", ex.Message);                         // Example logging.
                        thrownOutHands++;
                    }
                }
                return(null);
            }
            catch (Exception ex)                                     // Catch hand-parsing exceptions
            {
                Console.WriteLine("Parsing Error: {0}", ex.Message); // Example logging.
                return(null);
            }
        }
Пример #4
0
        public void Initialize()
        {
            _parser    = new Poker888CashParser();
            _inputText = @"#Game No : 431598730
***** 888poker Hand History for Game 431598730 *****
0,01$/0,02$ Blinds No Limit Holdem - *** 15 12 2015 22:57:07
Table Canberra 9 Max (Real Money)
Seat 2 is the button
Total number of players : 7
Seat 1: DriveRaver ( 0,79$ )
Seat 2: newlad1972 ( 2,20$ )
Seat 3: dilasr ( 4,98$ )
Seat 4: suzie235 ( 0,43$ )
Seat 5: denisakov80 ( 2,45$ )
Seat 6: VipNeborak ( 1,20$ )
Seat 10: Hohoho274 ( 0,39$ )
dilasr posts small blind [0,01$]
suzie235 posts big blind [0,02$]
VipNeborak posts big blind [0,02$]
** Dealing down cards **
Dealt to VipNeborak [ 3d, 9d ]
denisakov80 folds
VipNeborak checks
Hohoho274 calls [0,02$]
DriveRaver folds
newlad1972 folds
dilasr folds
suzie235 checks
** Dealing flop ** [ Kh, 4d, 7c ]
suzie235 bets [0,02$]
VipNeborak folds
Hohoho274 folds
** Summary **
suzie235 collected [ 0,07$ ]



#Game No : 431598815
***** 888poker Hand History for Game 431598815 *****
0,01$/0,02$ Blinds No Limit Holdem - *** 15 12 2015 22:57:52
Table Canberra 9 Max (Real Money)
Seat 3 is the button
Total number of players : 6
Seat 1: DriveRaver ( 0,79$ )
Seat 2: newlad1972 ( 2,20$ )
Seat 3: dilasr ( 4,97$ )
Seat 4: suzie235 ( 0,48$ )
Seat 6: VipNeborak ( 1,18$ )
Seat 10: Hohoho274 ( 0,37$ )
suzie235 posts small blind [0,01$]
VipNeborak posts big blind [0,02$]
** Dealing down cards **
Dealt to VipNeborak [ 5h, 4c ]
Hohoho274 folds
DriveRaver folds
newlad1972 folds
dilasr raises [0,05$]
suzie235 folds
VipNeborak folds
** Summary **
dilasr collected [ 0,05$ ]";
            _games     = _parser.ParseGames(_inputText);
        }
Пример #5
0
 public void Add(IHandHistoryParser parser, Func <string, bool> filter)
 {
     Parsers.Add(new Tuple <Func <string, bool>, IHandHistoryParser>(filter, parser));
 }
Пример #6
0
        public void Initialize()
        {
            _parser = new Poker888CashParser();
            _inputText = @"#Game No : 431598730
            ***** 888poker Hand History for Game 431598730 *****
            0,01$/0,02$ Blinds No Limit Holdem - *** 15 12 2015 22:57:07
            Table Canberra 9 Max (Real Money)
            Seat 2 is the button
            Total number of players : 7
            Seat 1: DriveRaver ( 0,79$ )
            Seat 2: newlad1972 ( 2,20$ )
            Seat 3: dilasr ( 4,98$ )
            Seat 4: suzie235 ( 0,43$ )
            Seat 5: denisakov80 ( 2,45$ )
            Seat 6: VipNeborak ( 1,20$ )
            Seat 10: Hohoho274 ( 0,39$ )
            dilasr posts small blind [0,01$]
            suzie235 posts big blind [0,02$]
            VipNeborak posts big blind [0,02$]
            ** Dealing down cards **
            Dealt to VipNeborak [ 3d, 9d ]
            denisakov80 folds
            VipNeborak checks
            Hohoho274 calls [0,02$]
            DriveRaver folds
            newlad1972 folds
            dilasr folds
            suzie235 checks
            ** Dealing flop ** [ Kh, 4d, 7c ]
            suzie235 bets [0,02$]
            VipNeborak folds
            Hohoho274 folds
            ** Summary **
            suzie235 collected [ 0,07$ ]

            #Game No : 431598815
            ***** 888poker Hand History for Game 431598815 *****
            0,01$/0,02$ Blinds No Limit Holdem - *** 15 12 2015 22:57:52
            Table Canberra 9 Max (Real Money)
            Seat 3 is the button
            Total number of players : 6
            Seat 1: DriveRaver ( 0,79$ )
            Seat 2: newlad1972 ( 2,20$ )
            Seat 3: dilasr ( 4,97$ )
            Seat 4: suzie235 ( 0,48$ )
            Seat 6: VipNeborak ( 1,18$ )
            Seat 10: Hohoho274 ( 0,37$ )
            suzie235 posts small blind [0,01$]
            VipNeborak posts big blind [0,02$]
            ** Dealing down cards **
            Dealt to VipNeborak [ 5h, 4c ]
            Hohoho274 folds
            DriveRaver folds
            newlad1972 folds
            dilasr raises [0,05$]
            suzie235 folds
            VipNeborak folds
            ** Summary **
            dilasr collected [ 0,05$ ]";
            _games = _parser.ParseGames(_inputText);
        }