Esempio n. 1
0
        private XmlDocument GetHandHistoryXmlDocument(HandHistory handHistory)
        {
            var handHistoryXml = SerializeObject(handHistory, Encoding.UTF8);

            var handHistoryXmlDocument = new XmlDocument();

            handHistoryXmlDocument.PreserveWhitespace = true;
            handHistoryXmlDocument.LoadXml(handHistoryXml);

            return(handHistoryXmlDocument);
        }
Esempio n. 2
0
        public string Convert(HandHistories.Objects.Hand.HandHistory history)
        {
            try
            {
                var target = new HandHistory
                {
                    SessionCode = history.GameDescription.Identifier.ToString(),
                    General     = CreateGeneral(history),
                    Games       = new List <Game> {
                        CreateGame(history)
                    },
                };

                var handHistoryXml = SerializationHelper.SerializeObject(target, true);

                return(handHistoryXml);
            }
            catch (Exception e)
            {
                throw new DHInternalException(new NonLocalizableString("Failed to convert handhistory to IPoker format."), e);
            }
        }
Esempio n. 3
0
        private HandHistory CreateHandHistory(Game game)
        {
            if (game == null)
            {
                throw new ArgumentNullException("game");
            }

            var general = new General
            {
                Mode       = PokerConfiguration.DefaultMode,
                Site       = EnumPokerSites.Ignition,
                GameType   = GetGameType(),
                TableName  = GetTableName(),
                StartDate  = GetTableTimeUTC(),
                Duration   = PokerConfiguration.DefaultDuration,
                Nickname   = configuration.HeroName,
                BuyIn      = GetBuyIn(),
                Currency   = HandHistories.Objects.GameDescription.Currency.USD,
                TotalBuyIn = GetTotalBuyIn(),
                MaxPlayers = handModel.TableType
            };

            if (handModel.CashOrTournament == CashOrTournament.Tournament)
            {
                general.TournamentName = GetTournamentName();
                general.Place          = GetHeroPlace();
            }

            var handHistory = new HandHistory
            {
                SessionCode = handModel.Handle.ToInt32().ToString(),
                General     = general
            };

            return(handHistory);
        }