Exemple #1
0
        public static XProGaming.Game Get(long domainID, string gameID)
        {
            XProGaming.Game game = null;
            Dictionary <string, XProGaming.Game> games = GetAll(domainID);

            if (games.TryGetValue(gameID, out game))
            {
                return(game);
            }
            return(null);
        }
        public bool IsOpen(long domainID)
        {
            switch (this.VendorID)
            {
            case VendorID.XProGaming:
            {
                XProGaming.Game g = XProGaming.Game.Get(domainID, this.GameID);
                return(g == null || g.IsOpen);
            }

            case VendorID.Microgaming:
            case VendorID.EvolutionGaming:
            {
                if (!string.IsNullOrWhiteSpace(this.OpenHoursTimeZone) &&
                    this.OpenHoursStart != this.OpenHoursEnd)
                {
                    TimeZoneInfo timeZone = TimeZoneInfo.GetSystemTimeZones().FirstOrDefault(t => string.Equals(t.StandardName, this.OpenHoursTimeZone, StringComparison.InvariantCultureIgnoreCase));
                    if (timeZone != null)
                    {
                        DateTime now     = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZone);
                        int      minutes = now.Hour * 60 + now.Minute;
                        if (this.OpenHoursStart < this.OpenHoursEnd)
                        {
                            return(minutes >= this.OpenHoursStart &&
                                   minutes < this.OpenHoursEnd);
                        }
                        else
                        {
                            return(minutes >= this.OpenHoursStart ||
                                   minutes < this.OpenHoursEnd);
                        }
                    }
                }
                return(true);
            }

            default:
                return(true);
            }
        }
Exemple #3
0
        public static Dictionary <string, XProGaming.Game> ParseXml(long domainID, string inputXml)
        {
            Dictionary <string, XProGaming.Game> dic = new Dictionary <string, XProGaming.Game>(StringComparer.InvariantCultureIgnoreCase);

            XElement   root = XElement.Parse(inputXml);
            XNamespace ns   = root.GetDefaultNamespace();

            if (root.Element(ns + "errorCode").Value != "0")
            {
                throw new Exception(root.Element(ns + "description").Value);
            }

            IEnumerable <XElement> games = root.Element(ns + "gamesList").Elements(ns + "game");

            foreach (XElement game in games)
            {
                XProGaming.Game gameToAdd = new XProGaming.Game()
                {
                    GameID         = game.Element(ns + "gameID").Value,
                    GameType       = (XProGaming.GameType) int.Parse(game.Element(ns + "gameType").Value, CultureInfo.InvariantCulture),
                    GameName       = game.Element(ns + "gameName").Value,
                    ConnectionUrl  = game.Element(ns + "connectionUrl").Value,
                    WindowParams   = game.Element(ns + "winParams").Value,
                    OpenHour       = game.Element(ns + "openHour").Value,
                    CloseHour      = game.Element(ns + "closeHour").Value,
                    DealerName     = game.Element(ns + "dealerName").Value,
                    DealerImageUrl = game.Element(ns + "dealerImageUrl").Value,
                    IsOpen         = string.Equals(game.Element(ns + "isOpen").Value, "1", StringComparison.InvariantCultureIgnoreCase),
                };

                IEnumerable <XElement> limitSets = game.Element(ns + "limitSetList").Elements(ns + "limitSet");
                foreach (XElement limitSet in limitSets)
                {
                    XProGaming.LimitSet limitSetToAdd = new XProGaming.LimitSet();

                    decimal temp;
                    limitSetToAdd.ID = limitSet.Element(ns + "limitSetID").Value;
                    if (limitSet.Element(ns + "minBet") != null && decimal.TryParse(limitSet.Element(ns + "minBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MinBet = temp;
                    }
                    if (limitSet.Element(ns + "maxBet") != null && decimal.TryParse(limitSet.Element(ns + "maxBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MaxBet = temp;
                    }
                    if (limitSet.Element(ns + "minInsideBet") != null && decimal.TryParse(limitSet.Element(ns + "minInsideBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MinInsideBet = temp;
                    }
                    if (limitSet.Element(ns + "maxInsideBet") != null && decimal.TryParse(limitSet.Element(ns + "maxInsideBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MaxInsideBet = temp;
                    }
                    if (limitSet.Element(ns + "minOutsideBet") != null && decimal.TryParse(limitSet.Element(ns + "minOutsideBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MinOutsideBet = temp;
                    }
                    if (limitSet.Element(ns + "maxOutsideBet") != null && decimal.TryParse(limitSet.Element(ns + "maxOutsideBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MaxOutsideBet = temp;
                    }
                    if (limitSet.Element(ns + "minPlayerBet") != null && decimal.TryParse(limitSet.Element(ns + "minPlayerBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MinPlayerBet = temp;
                    }
                    if (limitSet.Element(ns + "maxPlayerBet") != null && decimal.TryParse(limitSet.Element(ns + "maxPlayerBet").Value, NumberStyles.Number | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out temp))
                    {
                        limitSetToAdd.MaxPlayerBet = temp;
                    }

                    gameToAdd.LimitSets.Add(limitSetToAdd);
                }


                dic[gameToAdd.GameID] = gameToAdd;
            }

            string cacheFile = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory()
                                            , string.Format(CultureInfo.InvariantCulture, CACHE_FILE_FORMAT, domainID)
                                            );

            ObjectHelper.BinarySerialize <Dictionary <string, XProGaming.Game> >(dic, cacheFile);
            HttpRuntime.Cache[cacheFile] = dic;
            return(dic);
        }