示例#1
0
        public static ISoftBetIntegration.Game Get(ceDomainConfigEx domain, string gameID, bool funMode, bool isHtmlGame, string lang, params string[] countryCodes)
        {
            if (!SupportedLanguages.Contains(lang.ToLowerInvariant()))
            {
                lang = DEFAULT_LANGUAGE;
            }

            ISoftBetIntegration.Game game = null;

            string url = domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.TargetServer, countryCodes);

            if (isHtmlGame)
            {
                url = string.Format(domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.HTML5GameFeedsURL, countryCodes)
                                    , url
                                    , lang);
            }
            else
            {
                url = string.Format(domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.FlashGameFeedsURL, countryCodes)
                                    , url
                                    , lang);
            }

            string xml = GetRawXmlFeeds(url);

            XDocument xDoc = XDocument.Parse(xml);
            IEnumerable <XElement> elements = xDoc.Root.Element("games").Elements("c");

            foreach (XElement element in elements)
            {
                string cid = element.GetAttributeValue("id");

                var cels = from x in element.Elements("g")
                           where string.Equals(x.Attribute("i").Value, gameID) select x;

                if (cels != null && cels.Count() > 0)
                {
                    string targetServer = funMode ? domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.TargetServer, countryCodes) :
                                          domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.RealModeTargetServer, countryCodes);

                    game = isHtmlGame ? AnalyzeElementForHtmlGame(cels.First(), domain, cid, funMode, targetServer) :
                           AnalyzeElementForFlashGame(cels.First(), domain, cid, funMode, targetServer);

                    game = InitGameInfo(domain, game, funMode, countryCodes);

                    break;
                }
            }

            return(game);
        }
示例#2
0
        private static ISoftBetIntegration.GameModel GetFromXmlFeeds(ceDomainConfigEx domain, string gameID, bool isHtmlGame, string lang, params string[] countryCodes)
        {
            if (!SupportedLanguages.Contains(lang.ToLowerInvariant()))
            {
                lang = DEFAULT_LANGUAGE;
            }

            ISoftBetIntegration.GameModel game = null;

            TargetServer = domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.TargetServer, countryCodes);

            string url;

            if (isHtmlGame)
            {
                url = string.Format(domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.HTML5GameFeedsURL, countryCodes)
                                    , lang);
            }
            else
            {
                url = string.Format(domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.FlashGameFeedsURL, countryCodes)
                                    , lang);
            }

            string xml = GetRawXmlFeeds(url);

            XDocument xDoc = XDocument.Parse(xml);
            IEnumerable <XElement> elements = xDoc.Root.Element("games").Elements("c");

            foreach (XElement element in elements)
            {
                string cid = element.GetAttributeValue("id");

                var cels = from x in element.Elements("g")
                           where string.Equals(x.Attribute("i").Value, gameID)
                           select x;

                if (cels != null && cels.Count() > 0)
                {
                    game            = new GameModel();
                    game.CategoryID = cid;
                    game            = AnalyzeXML(cels.First(), game, domain, isHtmlGame, lang, countryCodes);
                    break;
                }
            }

            return(game);
        }
示例#3
0
        private static Game InitGameInfo(ceDomainConfigEx domain, Game g, bool funMode, params string[] countryCodes)
        {
            bool   loaded = false;
            string targetServer;
            string url;
            string gameXml;

            #region fun
            targetServer = domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.TargetServer, countryCodes);
            url          = string.Format(domain.GetCfg(CE.DomainConfig.ISoftBet.GameInfoUrl)
                                         , targetServer
                                         , g.Identifier);
            gameXml = GetRawXmlFeeds(url);

            if (!string.IsNullOrWhiteSpace(gameXml))
            {
                XDocument xGameDoc = XDocument.Parse(gameXml);
                XElement  gInfoEle = xGameDoc.Element("game");

                g.SkinID              = gInfoEle.GetElementValue("skin_id");
                g.URL                 = gInfoEle.GetElementValue("url");
                g.SwfRevision         = gInfoEle.GetElementValue("swf_revision");
                g.Host                = gInfoEle.GetElementValue("host");
                g.UseCustomLoader     = gInfoEle.GetElementValue("use_custom_loader") == "1";
                g.CustomLoader        = gInfoEle.GetElementValue("custom_loader");
                g.WMode               = gInfoEle.GetElementValue("wmode");
                g.Casino              = gInfoEle.GetElementValue("casino");
                g.RestrictedCountries = gInfoEle.GetElementValue("restricted_countries").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                g.CustomBackgrounds   = gInfoEle.GetElementValue("custom_backgrounds");
                g.Provider            = gInfoEle.GetElementValue("provider");
                g.MainCategory        = gInfoEle.GetElementValue("main_cat");

                decimal coin;
                if (decimal.TryParse(gInfoEle.GetElementValue("coin"), out coin))
                {
                    g.DefaultCoin = coin;
                }
                if (decimal.TryParse(gInfoEle.GetElementValue("coin_min"), out coin))
                {
                    g.MinCoin = coin;
                }
                if (decimal.TryParse(gInfoEle.GetElementValue("coin_max"), out coin))
                {
                    g.MaxCoin = coin;
                }

                loaded = true;
            }
            #endregion

            #region real
            targetServer = domain.GetCountrySpecificCfg(CE.DomainConfig.ISoftBet.RealModeTargetServer, countryCodes);
            url          = string.Format(domain.GetCfg(CE.DomainConfig.ISoftBet.GameInfoUrl)
                                         , targetServer
                                         , g.Identifier);
            gameXml = GetRawXmlFeeds(url);

            if (!string.IsNullOrWhiteSpace(gameXml))
            {
                XDocument xGameDoc = XDocument.Parse(gameXml);
                XElement  gInfoEle = xGameDoc.Element("game");

                g.SkinID                  = gInfoEle.GetElementValue("skin_id");
                g.RealModeURL             = gInfoEle.GetElementValue("url");
                g.RealModeSwfRevision     = gInfoEle.GetElementValue("swf_revision");
                g.RealModeHost            = gInfoEle.GetElementValue("host");
                g.RealModeUseCustomLoader = gInfoEle.GetElementValue("use_custom_loader") == "1";
                g.RealModeCustomLoader    = gInfoEle.GetElementValue("custom_loader");

                if (string.IsNullOrWhiteSpace(g.WMode))
                {
                    g.WMode = gInfoEle.GetElementValue("wmode");
                }
                if (string.IsNullOrWhiteSpace(g.Casino))
                {
                    g.Casino = gInfoEle.GetElementValue("casino");
                }
                if (g.RestrictedCountries == null || g.RestrictedCountries.Length == 0)
                {
                    g.RestrictedCountries = gInfoEle.GetElementValue("restricted_countries").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                }
                if (string.IsNullOrWhiteSpace(g.CustomBackgrounds))
                {
                    g.CustomBackgrounds = gInfoEle.GetElementValue("custom_backgrounds");
                }
                if (string.IsNullOrWhiteSpace(g.Provider))
                {
                    g.Provider = gInfoEle.GetElementValue("provider");
                }
                if (string.IsNullOrWhiteSpace(g.MainCategory))
                {
                    g.MainCategory = gInfoEle.GetElementValue("main_cat");
                }

                loaded = true;
            }
            #endregion

            if (!loaded)
            {
                return(null);
            }

            return(g);
        }