public static Dictionary <string, ISoftBetIntegration.Game> GetFlashGames(ceDomainConfigEx domain, string lang) { string url = domain.GetCfg(CE.DomainConfig.ISoftBet.FlashGameFeedsURL); url = string.Format(url, domain.GetCfg(CE.DomainConfig.ISoftBet.TargetServer), lang); string xml = GetRawXmlFeeds(url); return(null); }
private static ISoftBetIntegration.GameModel AnalyzeXML(XElement element, GameModel game, ceDomainConfigEx domain, bool isHtmlGame, string lang, params string[] countryCodes) { game = new GameModel(); game.PresentationType = isHtmlGame ? PresentationType.Html : PresentationType.Flash; game.ID = element.GetAttributeValue("i"); game.Identifier = element.GetAttributeValue("i"); game.GameID = element.GetAttributeValue("id"); game.Name = element.GetAttributeValue("n"); game.Image = element.GetAttributeValue("img"); game.FunModel = string.Equals(element.GetAttributeValue("fa"), "1", StringComparison.InvariantCultureIgnoreCase); game.RealModel = string.Equals(element.GetAttributeValue("ra"), "1", StringComparison.InvariantCultureIgnoreCase); game.TestFunMode = string.Equals(element.GetAttributeValue("tfa"), "1", StringComparison.InvariantCultureIgnoreCase); game.TestRealMode = string.Equals(element.GetAttributeValue("tra"), "1", StringComparison.InvariantCultureIgnoreCase); game.MainCategory = element.GetElementValue("main_cat"); game.UserIDs = element.GetAttributeValue("ta").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); string strCoins = element.GetAttributeValue("c"); if (!string.IsNullOrWhiteSpace(strCoins)) { string[] coins = strCoins.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (coins != null && coins.Length > 0) { game.Coins = new decimal[coins.Length]; for (int i = 0; i < coins.Length; i++) { decimal.TryParse(coins[i], out game.Coins[i]); } } } game.Translated = element.GetAttributeValue("translated") == "1"; game.Description = element.GetElementValue("d"); string url = string.Format(domain.GetCfg(CE.DomainConfig.ISoftBet.GameInfoUrl) , TargetServer , game.Identifier); string gameXml = GetRawXmlFeeds(url); if (!string.IsNullOrWhiteSpace(gameXml)) { XDocument xGameDoc = XDocument.Parse(gameXml); XElement gInfoEle = xGameDoc.Element("game"); game.SkinID = gInfoEle.GetElementValue("skin_id"); game.WMode = gInfoEle.GetElementValue("wmode"); decimal coin; if (decimal.TryParse(gInfoEle.GetElementValue("coin_min"), out coin)) { game.MinCoin = coin; } if (decimal.TryParse(gInfoEle.GetElementValue("coin_max"), out coin)) { game.MaxCoin = coin; } } return(game); }
public static string GetFeedsIdentifier(ceDomainConfigEx domain) { if (domain != null) { return(CRC64.ComputeAsUtf8String(domain.GetCfg(CE.DomainConfig.ISoftBet.FlashGameFeedsURL) + domain.GetCfg(CE.DomainConfig.ISoftBet.HTML5GameFeedsURL)).ToString()); } return(null); }
private static void ParseNetEntLiveCasinoTableList(ceDomainConfigEx domain) { try { string urlFormat = domain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL); if (string.IsNullOrWhiteSpace(urlFormat)) { return; } NetEntAPI.LiveCasinoTable.ParseJson(domain.DomainID, urlFormat); } catch (Exception ex) { Logger.Exception(ex); } }
public static Dictionary <string, JackpotInfo> GetPlaynGOJackpots(long domainID, string customUrl = null) { string filepath = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory() , string.Format("PlaynGOJackpotsFeeds.{0}.cache", domainID) ); Dictionary <string, JackpotInfo> cached = HttpRuntime.Cache[filepath] as Dictionary <string, JackpotInfo>; if (cached != null && string.IsNullOrEmpty(customUrl)) { return(cached); } Func <Dictionary <string, JackpotInfo> > func = () => { string url = null; try { Dictionary <string, JackpotInfo> jackpots = new Dictionary <string, JackpotInfo>(StringComparer.InvariantCultureIgnoreCase); DomainConfigAccessor dca = DomainConfigAccessor.CreateInstance <DomainConfigAccessor>(); ceDomainConfigEx config = dca.GetByDomainID(domainID); if (config != null) { url = customUrl ?? string.Format(PlaynGO_URL, config.GetCfg(PlaynGO.PID).DefaultIfNullOrEmpty("71")); PlaynGOJackpot[] objects = null; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Timeout = 50000; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader sr = new StreamReader(stream)) { string json = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); objects = jss.Deserialize <PlaynGOJackpot[]>(json); } if (objects != null) { foreach (PlaynGOJackpot obj in objects) { JackpotInfo jackpot = new JackpotInfo() { ID = obj.JackpotId.ToString(), Name = obj.Description, VendorID = VendorID.PlaynGO, }; // Only 1 IGT jackpot Dictionary <string, CurrencyExchangeRateRec> currencies = GamMatrixClient.GetCurrencyRates(Constant.SystemDomainID); string currency = obj.Currency; decimal amout = obj.BaseAmount; foreach (string key in currencies.Keys) { jackpot.Amounts[key] = GamMatrixClient.TransformCurrency(currency, key, amout); } jackpots[jackpot.ID] = jackpot; } } } if (jackpots.Count > 0 && string.IsNullOrEmpty(customUrl)) { ObjectHelper.BinarySerialize <Dictionary <string, JackpotInfo> >(jackpots, filepath); } return(jackpots); } catch (Exception ex) { Logger.Exception(ex, string.Format(@" PlaynGO - Jackpots URL : {0}", url)); throw; } }; if (!string.IsNullOrEmpty(customUrl)) { cached = func(); } else if (!DelayUpdateCache <Dictionary <string, JackpotInfo> > .TryGetValue(filepath, out cached, func, 120)) { cached = ObjectHelper.BinaryDeserialize <Dictionary <string, JackpotInfo> >(filepath, new Dictionary <string, JackpotInfo>()); } return(cached); }
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); }
private static bool ReloadNetentOriginalFeeds() { try { ulong netentFeedURLHash = 0; Dictionary <ulong, bool> dicNetentFeedURLHash = new Dictionary <ulong, bool>(); ceDomainConfigEx systemDomain = new ceDomainConfigEx() { DomainID = Constant.SystemDomainID, }; ParseNetEntLiveCasinoTableList(systemDomain); netentFeedURLHash = CRC64.ComputeAsUtf8String(systemDomain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL)); dicNetentFeedURLHash.Add(netentFeedURLHash, true); List <ceDomainConfigEx> domains = DomainManager.GetDomains(); CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); ChangeNotificationAccessor cna = ChangeNotificationAccessor.CreateInstance <ChangeNotificationAccessor>(); foreach (ceDomainConfigEx domain in domains) { if (domain.DomainID == Constant.SystemDomainID) { continue; } List <VendorID> vendors = cva.GetLiveCasinoVendors(domain.DomainID); if (!vendors.Exists(v => v == VendorID.NetEnt)) { continue; } long hash1 = (long)CRC64.ComputeAsUtf8String(VendorID.NetEnt.ToString()); long hash2 = 0L; netentFeedURLHash = CRC64.ComputeAsUtf8String(domain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL)); if (!dicNetentFeedURLHash.Keys.Contains(netentFeedURLHash)) { dicNetentFeedURLHash.Add(netentFeedURLHash, true); ParseNetEntLiveCasinoTableList(domain); hash2 = domain.DomainID; } if (hash1 > 0L || hash2 > 0L) { ceChangeNotification notification = cna.GetLastSuccessfulChangeNotification(domain.DomainID , ChangeType.LiveCasinoTableList.ToString() , DateTime.Now.AddHours(-1) ); if (notification != null && notification.HashValue1 == hash1 && notification.HashValue2 == hash2) { continue; } string error; bool success = Send(domain, ChangeType.LiveCasinoTableList, out error); SqlQuery <ceChangeNotification> query = new SqlQuery <ceChangeNotification>(); notification = new ceChangeNotification(); notification.Ins = DateTime.Now; notification.DomainID = domain.DomainID; notification.Succeeded = success; notification.Type = ChangeType.LiveCasinoTableList.ToString(); notification.HashValue1 = hash1; notification.HashValue2 = hash2; query.Insert(notification); } } } catch (Exception ex) { Logger.Exception(ex); return(false); } return(true); }