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 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); }
public static Dictionary <string, NetEntAPI.LiveCasinoTable> GetAll(long domainID) { ceDomainConfigEx domain; if (domainID == Constant.SystemDomainID) { domain = DomainManager.GetSysDomain(); } else { domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == domainID); } string cacheFile = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory() , string.Format(CultureInfo.InvariantCulture, CACHE_FILE_FORMAT, CRC64.ComputeAsUtf8String(domain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL))) ); Dictionary <string, NetEntAPI.LiveCasinoTable> dic = HttpRuntime.Cache[cacheFile] as Dictionary <string, NetEntAPI.LiveCasinoTable>; if (dic != null) { return(dic); } dic = ObjectHelper.BinaryDeserialize <Dictionary <string, NetEntAPI.LiveCasinoTable> >(cacheFile, new Dictionary <string, NetEntAPI.LiveCasinoTable>()); HttpRuntime.Cache[cacheFile] = dic; return(dic); }
public static string GetCachePrefixKey(long domainID) { ceDomainConfigEx domain; if (domainID == Constant.SystemDomainID) { domain = DomainManager.GetSysDomain(); } else { domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == domainID); } string cacheFile = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory() , string.Format(CultureInfo.InvariantCulture, CACHE_FILE_FORMAT, CRC64.ComputeAsUtf8String(domain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL))) ); return(cacheFile); }
public static Dictionary <string, NetEntAPI.LiveCasinoTable> ParseJson(long domainID, string urlFormat) { string cacheFile = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory() , string.Format(CultureInfo.InvariantCulture, CACHE_FILE_FORMAT, CRC64.ComputeAsUtf8String(urlFormat)) ); Dictionary <string, NetEntAPI.LiveCasinoTable> dic = new Dictionary <string, NetEntAPI.LiveCasinoTable>(StringComparer.InvariantCultureIgnoreCase); // first get the EUR currency data string url = string.Format(CultureInfo.InvariantCulture, urlFormat, "EUR"); RawNetEntLiveCasinoTable[] rawTables = RawNetEntLiveCasinoTable.Get(url); foreach (RawNetEntLiveCasinoTable rawTable in rawTables) { foreach (RawNetEntLiveCasinoGame rawGame in rawTable.Games) { string key = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", rawGame.GameID, rawTable.TableID); dic[key] = new NetEntAPI.LiveCasinoTable() { GameID = rawGame.GameID, TableID = rawTable.TableID.ToString(), }; dic[key].Limitation.Type = LiveCasinoTableLimitType.SpecificForEachCurrency; } } CurrencyData [] currencies = GamMatrixClient.GetSupportedCurrencies(); foreach (CurrencyData currency in currencies) { url = string.Format(CultureInfo.InvariantCulture, urlFormat, currency.ISO4217_Alpha); rawTables = RawNetEntLiveCasinoTable.Get(url); foreach (RawNetEntLiveCasinoTable rawTable in rawTables) { foreach (RawNetEntLiveCasinoGame rawGame in rawTable.Games) { if ([email protected]("MINBET") || [email protected]("MAXBET")) { continue; } decimal minBet, maxBet; if (!decimal.TryParse(rawGame.@params["MINBET"].ToString(), out minBet) || !decimal.TryParse(rawGame.@params["MAXBET"].ToString(), out maxBet) || minBet >= maxBet) { continue; } minBet /= 100.00M; maxBet /= 100.00M; string key = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", rawGame.GameID, rawTable.TableID); NetEntAPI.LiveCasinoTable table; if (dic.TryGetValue(key, out table)) { table.Limitation.CurrencyLimits[currency.ISO4217_Alpha] = new LimitAmount() { MinAmount = minBet, MaxAmount = maxBet, }; } } } } if (dic.Keys.Count > 0) { ObjectHelper.BinarySerialize <Dictionary <string, NetEntAPI.LiveCasinoTable> >(dic, cacheFile); HttpRuntime.Cache[cacheFile] = dic; } return(dic); }