public ActionResult Help(long domainID, string id, string language) { List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!"; return(this.View("Error")); } Dictionary <string, ceCasinoGameBaseEx> games = CacheManager.GetGameDictionary(domain.DomainID); ceCasinoGameBaseEx game; if (!games.TryGetValue(id, out game)) { this.ViewData["ErrorMessage"] = "Error, cannot find the game!"; return(this.View("Error")); } if (game.VendorID == VendorID.NetEnt) { this.ViewData["Domain"] = domain; this.ViewData["Language"] = language; return(this.View("NetEntHelp", game)); } return(null); }
public static ceDomainConfigEx GetSysDomain() { ceDomainConfigEx domain = HttpRuntime.Cache[Constant.SysDomainCacheKey] as ceDomainConfigEx; if (domain != null) { return(domain); } lock (typeof(DomainManager)) { domain = HttpRuntime.Cache[Constant.SysDomainCacheKey] as ceDomainConfigEx; if (domain != null) { return(domain); } DomainConfigAccessor dca = DomainConfigAccessor.CreateInstance <DomainConfigAccessor>(); domain = dca.GetSys(); CacheManager.AddCache(Constant.SysDomainCacheKey, domain); } return(domain); }
public void ProcessRequest(HttpContext context) { if (string.IsNullOrWhiteSpace(context.Request.QueryString["domainid"]) || string.IsNullOrWhiteSpace(context.Request.QueryString["type"])) { return; } int domainID; if (!int.TryParse(context.Request.QueryString["domainid"], out domainID)) { return; } ceDomainConfigEx domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { return; } if (string.Equals(context.Request.QueryString["type"], "mobile", StringComparison.InvariantCultureIgnoreCase)) { context.Response.Redirect(domain.MobileLobbyUrl); } else { context.Response.Redirect(domain.LobbyUrl); } }
public static string GetCasinoGameRecentWinnersInternalSql(ceDomainConfigEx domain, bool isMobile) { using (DbManager db = new DbManager("Dw")) { DwAccessor da = DwAccessor.CreateInstance <DwAccessor>(db); List <string> countryCodes = da.GetCountryCodes(domain.RecentWinnersCountryFilterMode , domain.RecentWinnersCountryCodes ); return(string.Format(CultureInfo.InvariantCulture, @"EXEC [GetCasinoGameRecentWinners] @vendorIDs='{0}', @gameCodes='{1}', @domainIDs='{2}', @countryAlpha2Codes='{3}', @minWinInEUR={4:F2}, @IsUniqueUsersOnly={5}, @betFromTime='{6}', @betEndTime='{7}', @isMobile={8}" , domain.RecentWinnersFilteredVendorIDs , domain.RecentWinnersFilteredGameCodes , domain.RecentWinnersExcludeOtherOperators ? domain.DomainID.ToString() : null , string.Join(",", countryCodes.ToArray()) , domain.RecentWinnersMinAmount , domain.RecentWinnersReturnDistinctUserOnly ? 1 : 0 , DateTime.Now.AddDays(-12).ToString("yyyy-MM-dd HH:mm:ss") , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") , isMobile ? 1 : 0 )); } }
protected bool IsWhitelistedIPAddress(ceDomainConfigEx domain, string ip) { string[] allowedIPAddresses = domain.ApiWhitelistIP.Split(','); foreach (string ipAddress in allowedIPAddresses) { if (string.Equals(ipAddress, ip)) { return(true); } string regex = Regex.Replace(ipAddress , "." , new MatchEvaluator(delegate(Match m) { string x = m.ToString(); if (x != "*") { return(string.Format("\\x{0:X00}", (int)x[0])); } return(@"(\d+)"); }) , RegexOptions.ECMAScript | RegexOptions.Compiled ); if (Regex.IsMatch(ip, regex, RegexOptions.CultureInvariant | RegexOptions.Singleline | RegexOptions.Compiled)) { return(true); } } return(ip.Equals("85.9.28.130") || ip.StartsWith("109.205.9") || ip.StartsWith("78.133.") || ip.StartsWith("192.168.") || ip.StartsWith("10.0.") || string.Equals("127.0.0.1", ip) || string.Equals("::1", ip)); }
/* * A code defining the reason for going back to the lobby. * “0” = A normal game termination (the player selected to go to the lobby using the lobby button in the game) * “1” = The game was started from a bookmark; a login (real or for fun) is required to obtain a web session and play the game. * “2” = The game has been inactive for too long and requires pin code authentication. Note: This feature will not be available in first release of mobile games. * “4” = Play for real promotion has been displayed in-game, and the player wants to register and play for real money. * “5” = The player ran out of money when playing a game, and want to deposit more money. * “6” = The device is confirmed not supported. * “9” = An error occurred in the game and the player chose to go to the lobby. */ public ActionResult Return(long domainID, VendorID id, string gameId, string reason) { List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { throw new HttpException(404, "Invalid URL"); } switch (id) { case VendorID.NetEnt: { string postfix = string.Format("#{0}", reason); if (reason == "5") { return(this.Redirect(domain.MobileCashierUrl + postfix)); } if (reason == "10") { return(this.Redirect(domain.MobileAccountHistoryUrl + postfix)); } return(this.Redirect(domain.MobileLobbyUrl + postfix)); } default: throw new NotSupportedException(); } }
public void ProcessRequest(HttpContext context) { if (string.IsNullOrWhiteSpace(context.Request.QueryString["domainid"]) || string.IsNullOrWhiteSpace(context.Request.QueryString["vendor"]) || string.IsNullOrWhiteSpace(context.Request.QueryString["uid"]) || string.IsNullOrWhiteSpace(context.Request.QueryString["aid"]) || string.IsNullOrWhiteSpace(context.Request.QueryString["type"]) //|| string.IsNullOrWhiteSpace(context.Request.QueryString["realMoney"]) //|| string.IsNullOrWhiteSpace(context.Request.QueryString["bonusMoney"]) ) { return; } long domainID; VendorID vendorID; long uid; long aid; TransType transType; //decimal realMoney; //decimal bonusMoney; if (!long.TryParse(context.Request.QueryString["domainid"], out domainID)) { return; } if (!Enum.TryParse <VendorID>(context.Request.QueryString["vendor"], out vendorID)) { return; } if (!long.TryParse(context.Request.QueryString["uid"], out uid)) { return; } if (!long.TryParse(context.Request.QueryString["aid"], out aid)) { return; } if (!Enum.TryParse <TransType>(context.Request.QueryString["type"], out transType)) { return; } //if (!decimal.TryParse(context.Request.QueryString["realMoney"], out realMoney)) // return; //if (!decimal.TryParse(context.Request.QueryString["bonusMoney"], out bonusMoney)) // return; ceDomainConfigEx domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { return; } _redisClient.SetByUserID(uid, "reload_balance", "true").Wait(); context.Response.Write("OK"); }
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); }
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); }
// // GET: /Configuration/ public ActionResult Index() { if (DomainManager.CurrentDomainID > 0) { DomainConfigAccessor dca = DomainConfigAccessor.CreateInstance<DomainConfigAccessor>(); ceDomainConfigEx domain = dca.GetByDomainID(DomainManager.CurrentDomainID); return View(domain); } return View(); }
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); }
public static bool Send(ceDomainConfigEx domain, ChangeType changeType, out string error) { bool success = true; StringBuilder errorMessages = new StringBuilder(); try { if (!string.IsNullOrWhiteSpace(domain.GameListChangedNotificationUrl)) { List <string> urls = domain.GameListChangedNotificationUrl .Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries) .Where(u => u.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase) || u.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase) ).ToList(); foreach (string url in urls) { string urlWithParam = string.Format("{0}{1}ChangeType={2}" , url , url.IndexOf("?") > 0 ? "&" : "?" , changeType.ToString() ); try { using (WebClient webClient = new WebClient()) { webClient.DownloadData(urlWithParam); } } catch (HttpException hex) { errorMessages.AppendFormat("ERROR {0} - {1}\n", hex.ErrorCode, hex.Message); success = false; } } } } catch (Exception ex) { success = false; Logger.Exception(ex); } if (success) { error = "SUCCEED"; } else { error = errorMessages.ToString(); } return(success); }
private static ulong GetLiveCasinoTableStatusHash(ceDomainConfigEx domain) { StringBuilder sb = new StringBuilder(); List <ceLiveCasinoTableBaseEx> tables = LiveCasinoTableAccessor.GetDomainTables(domain.DomainID, null, true, true) .OrderBy(t => t.ID).ToList(); foreach (ceLiveCasinoTableBaseEx table in tables) { sb.AppendFormat("{0}-{1}\n", table.ID, table.IsOpen(domain.DomainID)); } return(CRC64.ComputeAsAsciiString(sb.ToString())); }
public ActionResult RealityCheckConfig(long domainId, string id, string realityCheckTimeout) { int limit = 0; if (!string.IsNullOrEmpty(realityCheckTimeout) && Int32.TryParse(realityCheckTimeout, out limit)) { ViewData["RealityCheckTimeout"] = limit; } List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainId); if (domain == null) { this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!"; return(this.View("Error")); } DomainManager.CurrentDomainID = domainId; ViewData["Domain"] = domain; int vendorId = Int32.Parse(id); if (vendorId == (int)VendorID.NetEnt) { return(View("NetEntRealityCheckConfig")); } if (vendorId == (int)VendorID.Realistic) { return(View("RealisticRealityCheckConfig")); } if (vendorId == (int)VendorID.Microgaming) { return(View("MicrogamingRealityCheckConfig")); } else if (vendorId == (int)VendorID.QuickSpin) { return(View("QuickSpinRealityCheckConfig")); } else if (vendorId == (int)VendorID.PlaynGO) { return(View("PlaynGORealityCheckConfig")); } this.ViewData["ErrorMessage"] = String.Format("Invalid Url Parameter(s)!. Unknown vendor '{0}'", vendorId); return(this.View("Error")); }
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); }
public ActionResult LobbyResolver(long domainId, string id) { List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainId); if (domain == null) { this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!"; return(this.View("Error")); } DomainManager.CurrentDomainID = domainId; ViewData["Domain"] = domain; return(View("LobbyResolver")); }
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 void Send(long domainID) { List <ceDomainConfigEx> domains = DomainManager.GetDomains(); if (domainID == Constant.SystemDomainID) { ceDomainConfigEx sysDomain = DomainManager.GetSysDomain(); Send(sysDomain); foreach (ceDomainConfigEx domain in domains) { Send(domain); } } else { ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainID); Send(domain); } }
private StringBuilder GetMetadataGameInfo(ceDomainConfigEx domain, ceCasinoGameBaseEx game, string lang) { var gameInformation = CasinoGame.GetGameInformation(domain, game.ID, string.IsNullOrWhiteSpace(lang) ? "en" : lang); if (string.IsNullOrWhiteSpace(gameInformation)) { return(null); } var md = new MarkdownDeep.Markdown { SafeMode = false, ExtraMode = true, AutoHeadingIDs = false, MarkdownInHtml = true, NewWindowForExternalLinks = true }; var html = md.Transform(gameInformation.Replace("<", "<").Replace(">", ">")); var sb = new StringBuilder(); sb.Append("<topics>"); sb.Append("<topic>"); sb.AppendFormat(CultureInfo.InvariantCulture, "<id>{0}</id>", game.ID); sb.AppendFormat(CultureInfo.InvariantCulture, "<description>{0}</description>", game.GameName.SafeHtmlEncode()); { sb.Append("<articles>"); sb.AppendFormat(CultureInfo.InvariantCulture, "<id>{0}</id>", game.ID); sb.AppendFormat(CultureInfo.InvariantCulture, "<title>{0}</title>", game.GameName.SafeHtmlEncode()); sb.AppendFormat(CultureInfo.InvariantCulture, "<content>{0}</content>", html.SafeHtmlEncode()); sb.Append("</articles>"); } sb.Append("</topic>"); sb.Append("</topics>"); return(sb); }
public static void Send(ceDomainConfigEx domain) { //Dictionary<string, ceCasinoGameBaseEx> games = CacheManager.GetGameDictionary(Constant.SystemDomainID); List <Translation> translations = new CasinoGameMgr(CasinoGameMgr.METADATA_DESCRIPTION).Get(domain, 1000); List <string> messages = new List <string>(); messages.Add(CreateMetadataChangeMessage(domain.TemplateID, "/casino/games")); foreach (Translation translation in translations) { if (translation.Code == ">") { continue; } messages.Add(CreateTranslationChangeMessage(domain.TemplateID, translation.Code)); } Broadcast(messages); }
private static ulong ParseXProLiveCasinoGameList(ceDomainConfigEx domain) { try { using (GamMatrixClient client = new GamMatrixClient()) { XProGamingAPIRequest request = new XProGamingAPIRequest() { GetGamesListWithLimits = true, GetGamesListWithLimitsGameType = (int)XProGaming.GameType.AllGames, GetGamesListWithLimitsOnlineOnly = 0, //GetGamesListWithLimitsUserName = "******" }; request = client.SingleRequest <XProGamingAPIRequest>(domain.DomainID, request); if (string.IsNullOrWhiteSpace(request.GetGamesListWithLimitsResponse)) { return(0L); } string xml = request.GetGamesListWithLimitsResponse; XProGaming.Game.ParseXml(domain.DomainID, xml); return(CRC64.ComputeAsAsciiString(xml)); } } catch (GmException gex) { if (gex.ReplyResponse.ErrorCode == "SYS_1008") { return(0L); } Logger.Exception(gex); } catch (Exception ex) { Logger.Exception(ex); } return(0L); }
private static Game AnalyzeElementForFlashGame(XElement element, ceDomainConfigEx domain, string cid, bool funMode, string targetServer, params string[] countryCodes) { ISoftBetIntegration.Game g = new ISoftBetIntegration.Game(); g.CategoryID = cid; g.PresentationType = PresentationType.Flash; //g.ID = gEle.GetAttributeValue("id"); g.ID = element.GetAttributeValue("i"); if (g.ID.ToLowerInvariant() == "heavy_metal_pmvc") { g.ID = g.ID; } g.Identifier = element.GetAttributeValue("i"); g.Name = element.GetAttributeValue("n"); g.Image = element.GetAttributeValue("img"); g.FunModel = string.Equals(element.GetAttributeValue("fa"), "1", StringComparison.InvariantCultureIgnoreCase); g.RealModel = string.Equals(element.GetAttributeValue("ra"), "1", StringComparison.InvariantCultureIgnoreCase); g.TestFunMode = string.Equals(element.GetAttributeValue("tfa"), "1", StringComparison.InvariantCultureIgnoreCase); g.TestRealMode = string.Equals(element.GetAttributeValue("tra"), "1", StringComparison.InvariantCultureIgnoreCase); g.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) { g.Coins = new decimal[coins.Length]; for (int i = 0; i < coins.Length; i++) { decimal.TryParse(coins[i], out g.Coins[i]); } } } g.Translated = element.GetAttributeValue("translated") == "1"; g.Description = element.GetElementValue("d"); return(g); }
public ActionResult Information(long domainID, string id, string language) { List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!"; return(this.View("Error")); } Dictionary <string, ceCasinoGameBaseEx> games = CacheManager.GetGameDictionary(domain.DomainID); ceCasinoGameBaseEx game = null; if (!games.TryGetValue(id, out game)) { this.ViewData["ErrorMessage"] = "Error, cannot find the game!"; return(this.View("Error")); } language = GetISO639LanguageCode(language); var gameInformation = CasinoGame.GetGameInformation(domain, game.ID, string.IsNullOrWhiteSpace(language) ? "en" : language); if (!string.IsNullOrWhiteSpace(gameInformation)) { var md = new MarkdownDeep.Markdown { SafeMode = false, ExtraMode = true, AutoHeadingIDs = false, MarkdownInHtml = true, NewWindowForExternalLinks = true }; var html = md.Transform(gameInformation.Replace("<", "<").Replace(">", ">")); this.ViewData["Domain"] = domain; this.ViewData["Language"] = language; this.ViewData["Html"] = html; return(this.View("MetadataInfo", game)); } switch (game.VendorID) { case VendorID.NetEnt: this.ViewData["Domain"] = domain; this.ViewData["Language"] = language; return(this.View("NetEntInfo", game)); case VendorID.GreenTube: try { //DomainManager.CurrentDomainID = domainID; //var sb = GetGreenTubeGameInfo(game, language); //var root = XDocument.Parse(sb.ToString()); //var descriptionElement = root.Elements("topics").Elements("topic").Elements("description").FirstOrDefault(); //var contentElement = root.Elements("topics").Elements("topic").Elements("articles").Elements("content").FirstOrDefault(); //if (descriptionElement == null || contentElement == null) // throw new Exception("The content is not available now"); //this.ViewData["Description"] = descriptionElement.Value; //this.ViewData["Content"] = contentElement.Value; this.ViewData["Domain"] = domain; this.ViewData["Language"] = language; return(this.View("GreenTubeInfo", game)); } catch { this.ViewData["ErrorMessage"] = "The content is not available now"; return(this.View("Error")); } default: this.ViewData["ErrorMessage"] = "The content is not available now"; return(this.View("Error")); } }
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 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); }
public ActionResult MicrogamingNanoXpro(long domainID, string id, string _sid) { List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!"; return(this.View("Error")); } Dictionary <string, ceCasinoGameBaseEx> games = CacheManager.GetGameDictionary(domainID); ceCasinoGameBaseEx game; if (!games.TryGetValue(id, out game)) { this.ViewData["ErrorMessage"] = "Error, cannot find the game!"; return(this.View("Error")); } SessionPayload session = null; if (!string.IsNullOrWhiteSpace(_sid)) { using (DbManager db = new DbManager()) { session = _agentClient.GetSessionByGuid(_sid); if (session == null || session.IsAuthenticated != true || session.DomainID != domainID) { this.ViewData["ErrorMessage"] = "Error, invalid session id!"; return(this.View("Error")); } } } MicrogamingNanoGameSessionInfo info = null; if (session != null) { string cacheKey = string.Format("MG_NANO_GAME_SESSION_{0}_{1}", domainID, session.Guid); info = HttpRuntime.Cache[cacheKey] as MicrogamingNanoGameSessionInfo; this.ViewData["HandlerUrl"] = this.Url.Action("SaveMicrogamingNanoGameSession" , new { @domainID = domainID, @id = id, @_sid = session.Guid } ); } this.ViewData["UserSession"] = session; this.ViewData["Domain"] = domain; this.ViewData["MicrogamingNanoGameSessionInfo"] = info; this.ViewData["UserSession"] = session; this.ViewData["VendorID"] = game.VendorID; this.ViewData["GameID"] = game.GameID; this.ViewData["CasinoBaseGameID"] = game.ID; this.ViewData["CasinoGameID"] = game.CasinoGameId; this.ViewData["GameCode"] = game.GameCode; Dictionary <int, ceCasinoVendor> vendors = CacheManager.GetVendorDictionary(domain.DomainID); this.ViewData["UseGmGaming"] = (vendors.ContainsKey((int)game.VendorID)) && vendors[(int)game.VendorID].EnableGmGamingAPI; this.ViewData["EnableLogging"] = (vendors.ContainsKey((int)game.VendorID)) && vendors[(int)game.VendorID].EnableLogging; return(this.View("MicrogamingNanoXpro", game)); }
private StringBuilder GetGameListXml(ceDomainConfigEx domain, List <ceCasinoGameBaseEx> games, bool includeMoreFields, bool allowCache = true, int gameType = 0) { StringBuilder data = new StringBuilder(); data.AppendLine("<gameList>"); CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); Dictionary <VendorID, string> dic = cva.GetRestrictedTerritoriesDictionary(DomainManager.CurrentDomainID); Dictionary <VendorID, string> dicLanguages = cva.GetLanguagesDictionary(DomainManager.CurrentDomainID); Dictionary <VendorID, string> dicCurrencies = cva.GetCurrenciesDictionary(DomainManager.CurrentDomainID); //Dictionary<long, List<dwGamePopularity>> popularities = GetGamePopularityV2(domain , allowCache, gameType); Dictionary <long, long> popularities = GetGamePopularity(domain); foreach (ceCasinoGameBaseEx game in games) { if (game.IsLiveCasinoGame()) { continue; } long popularity = 0L; popularities.TryGetValue(game.ID, out popularity); string loaderUrl = GetLoaderUrl(domain, game.ID, game.Slug, game.VendorID) + "/"; string helperUrl = GetHelpUrl(domain, game); string restrictedTerritories; dic.TryGetValue(game.VendorID, out restrictedTerritories); string vendorLanguages; dicLanguages.TryGetValue(game.VendorID, out vendorLanguages); string vendorCurrencies; dicCurrencies.TryGetValue(game.VendorID, out vendorCurrencies); data.AppendLine("\t<game>"); data.AppendFormat("\t\t<id>{0}</id>\n", game.ID); PopulateGameBasicProperties(data , domain , game , popularity , domain.EnableScalableThumbnail , includeMoreFields , restrictedTerritories , loaderUrl , helperUrl ); data.Append("\t\t<platforms>"); string[] platforms = game.ClientCompatibility.DefaultIfNullOrEmpty(string.Empty).Split(','); if (platforms.Contains("PC") && !platforms.Contains("Windows81")) { data.AppendFormat("<platform>Windows81</platform>"); } foreach (string platform in platforms) { if (!string.IsNullOrWhiteSpace(platform)) { data.AppendFormat("<platform>{0}</platform>", platform.SafeHtmlEncode()); } } data.Append("</platforms>\n"); data.Append("\t\t<languages>"); string[] languages = null; string strLanguages = game.Languages.DefaultIfNullOrEmpty(string.Empty); if ("All".Equals(strLanguages)) { strLanguages = Language.getAllLanguagesToString(); } else if (string.IsNullOrEmpty(strLanguages)) { strLanguages = vendorLanguages; } if (!string.IsNullOrWhiteSpace(strLanguages)) { languages = strLanguages.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string language in languages) { data.AppendFormat("<language>{0}</language>", language.SafeHtmlEncode()); } } data.Append("</languages>\n"); data.Append("\t\t<currencies>"); string[] currencies = null; string strCurrencies = vendorCurrencies.DefaultIfNullOrEmpty(string.Empty); if (!string.IsNullOrWhiteSpace(strCurrencies)) { currencies = strCurrencies.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string currency in currencies) { data.AppendFormat("<currency>{0}</currency>", currency.SafeHtmlEncode()); } } data.Append("</currencies>\n"); Dictionary <string, CasinoGameLimitAmount> items = GetCurrencyLimitAmountForGame(game); if (items.Count > 0) { data.Append("\t\t<limits>\n"); foreach (var item in items) { data.AppendFormat("\t\t\t<limit currency=\"{0}\">\n", item.Key.SafeHtmlEncode()); data.AppendFormat("\t\t\t\t<min>{0:0.##}</min>\n", item.Value.MinAmount); data.AppendFormat("\t\t\t\t<max>{0:0.##}</max>\n", item.Value.MaxAmount); data.Append("\t\t\t</limit>\n"); } data.Append("\t\t</limits>\n"); } data.AppendLine("\t</game>"); } data.AppendLine("</gameList>"); return(data); }
// GET: /Loader/ public ActionResult Start(long domainID, string id, string _sid, string _sid64, string language, bool?funMode, string tableID) { string userAgentInfo = Request.GetRealUserAddress() + Request.UserAgent; if (!string.IsNullOrEmpty(_sid)) { string sid64 = Encrypt(_sid, userAgentInfo, true); sid64 = Regex.Replace(sid64, @"(\+|\/|\=)", (Match match) => { switch (match.Value) { case "+": return("."); case "/": return("_"); case "=": return("-"); default: throw new NotSupportedException(); } }, RegexOptions.Compiled); RouteValueDictionary routeParams = new RouteValueDictionary(); foreach (string key in Request.QueryString.Keys) { routeParams.Add(key, Request.QueryString[key]); } routeParams["_sid64"] = sid64; routeParams["_sid"] = ""; return(RedirectToAction("Start", routeParams)); } else { if (!string.IsNullOrEmpty(_sid64)) { _sid64 = Regex.Replace(_sid64, @"(\.|_|\-)", (Match match) => { switch (match.Value) { case ".": return("+"); case "_": return("/"); case "-": return("="); default: throw new NotSupportedException(); } }, RegexOptions.Compiled); _sid = Decrypt(_sid64, userAgentInfo, true); } } funMode = CheckFunMode(funMode, _sid); //------- Domain Validation List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!"; return(this.View("Error")); } DomainManager.CurrentDomainID = domainID; //------- Game Validation Dictionary <string, ceCasinoGameBaseEx> games = CacheManager.GetGameDictionary(domain.DomainID); ceCasinoGameBaseEx game; if (!games.TryGetValue(id, out game)) { throw new CeException("Game [{0}] is not available!", id); } if (!GlobalConstant.AllVendors.Contains(game.VendorID)) { throw new Exception("Unsupported VendorID!"); } //------- Country and IP restrictions Validation string vendorRestrictedCountries = GetVendorRestrictedCountries(domainID, game.VendorID); IPLocation ipLocation = IPLocation.GetByIP(Request.GetRealUserAddress()); if (ipLocation.Found) { if (!string.IsNullOrWhiteSpace(game.RestrictedTerritories)) { if (game.RestrictedTerritories.IndexOf(ipLocation.CountryCode, StringComparison.InvariantCultureIgnoreCase) >= 0) { Logger.FailureAudit(string.Format("Accessing from {0}({1}) to game [{2}] is denied by game rules [{3}]." , Request.GetRealUserAddress() , ipLocation.CountryCode , game.GameName , game.RestrictedTerritories ) ); return(this.View("Error_RestrictedCountries")); } } if (!string.IsNullOrWhiteSpace(vendorRestrictedCountries)) { if (vendorRestrictedCountries.IndexOf(ipLocation.CountryCode, StringComparison.InvariantCultureIgnoreCase) >= 0) { Logger.FailureAudit(string.Format("Accessing from {0}({1}) to game [{2}] is denied by vendor rules [{3}]." , Request.GetRealUserAddress() , ipLocation.CountryCode , game.GameName , vendorRestrictedCountries ) ); return(this.View("Error_RestrictedCountries")); } } } SessionPayload session = null; if (!string.IsNullOrWhiteSpace(_sid)) { { session = _agentClient.GetSessionByGuid(_sid); if (session == null || session.IsAuthenticated != true || session.DomainID != domain.DomainID) { return(this.View("Error_InvalidSession")); } } if (!funMode.Value && session != null && session.IsEmailVerified != true) { return(this.View("Error_Inactive")); } if (session != null && session.Roles != null) { bool isExist = session.Roles.FirstOrDefault(r => string.Equals(r, "Withdraw only", StringComparison.InvariantCultureIgnoreCase)) != null; if (isExist) { return(this.View("Error_WithdrawOnly")); } } // verify the restricted countries if (!string.IsNullOrWhiteSpace(game.RestrictedTerritories) && !string.IsNullOrEmpty(session.UserCountryCode)) { if (game.RestrictedTerritories.IndexOf(session.UserCountryCode, StringComparison.InvariantCultureIgnoreCase) >= 0) { Logger.FailureAudit(string.Format("Accessing from {0}({1} - {2}) to game [{3}] is denied by game rules [{4}]." , session.UserID , session.Username , session.UserCountryCode , game.GameName , game.RestrictedTerritories ) ); return(this.View("Error_RestrictedCountries")); } } if (!string.IsNullOrWhiteSpace(vendorRestrictedCountries) && !string.IsNullOrEmpty(session.UserCountryCode)) { if (vendorRestrictedCountries.IndexOf(session.UserCountryCode, StringComparison.InvariantCultureIgnoreCase) >= 0) { Logger.FailureAudit(string.Format("Accessing from {0}({1} - {2}) to game [{3}] is denied by vendor rules [{4}]." , session.UserID , session.Username , session.UserCountryCode , game.GameName , vendorRestrictedCountries ) ); return(this.View("Error_RestrictedCountries")); } } if (game.AgeLimit) { if (session.BirthDate.AddYears(21) > DateTime.UtcNow.Date) { return(this.View("Error_AgeLimit")); } } } else if (!game.FunMode && !game.AnonymousFunMode) { return(this.View("Error_InvalidSession")); } //------- If All OK start game this.ViewData["UserSession"] = session; this.ViewData["Domain"] = domain; this.ViewData["VendorID"] = game.VendorID; this.ViewData["GameID"] = game.GameID; this.ViewData["CasinoBaseGameID"] = game.ID; this.ViewData["Slug"] = game.Slug; this.ViewData["CasinoGameID"] = game.CasinoGameId; this.ViewData["GameCode"] = game.GameCode; this.ViewData["Language"] = language; this.ViewData["FunMode"] = funMode.Value; this.ViewData["TableID"] = tableID; Dictionary <int, ceCasinoVendor> vendors = CacheManager.GetVendorDictionary(domain.DomainID); this.ViewData["UseGmGaming"] = (vendors.ContainsKey((int)game.VendorID)) && vendors[(int)game.VendorID].EnableGmGamingAPI; this.ViewData["EnableLogging"] = (vendors.ContainsKey((int)game.VendorID)) && vendors[(int)game.VendorID].EnableLogging; switch (game.VendorID) { case VendorID.NetEnt: { if (funMode.Value) { this.ViewData["_sid64"] = null; } else { this.ViewData["_sid64"] = _sid64; } if (game.GameCategories.IndexOf(",LIVEDEALER,", StringComparison.InvariantCultureIgnoreCase) >= 0) { return(View("NetEntLiveDealer", game)); } bool inclusionEnabled = ConfigurationManager.AppSettings["Netent.Launch.Inclusion.Enabled"].SafeParseToBool(false); if (inclusionEnabled) { return(View("NetEnt_Inclusion", game)); } else { if (game.GameID.EndsWith("_mobile_html_sw", StringComparison.InvariantCultureIgnoreCase)) { return(View("NetEntMobile", game)); } return(View("NetEnt", game)); } } case VendorID.Microgaming: { if (game.GameID.StartsWith("Nano", StringComparison.InvariantCultureIgnoreCase) || game.GameID.StartsWith("Mini", StringComparison.InvariantCultureIgnoreCase)) { return(View("MicrogamingNano", game)); } if (game.GameCode.StartsWith("MGS_LG-", StringComparison.InvariantCultureIgnoreCase)) { return(View("MicrogamingLiveDealer", game)); } return(View("Microgaming", game)); } case VendorID.GreenTube: { if (domain.Name.Equals("energycasino", StringComparison.OrdinalIgnoreCase) || Request.Url.Host.EndsWith("energycasino.com", StringComparison.InvariantCultureIgnoreCase)) { return(View("GreenTube_EnergyCasino", game)); } else { return(View("GreenTube", game)); } } case VendorID.ISoftBet: if (game.GameID.EndsWith("_html", StringComparison.InvariantCultureIgnoreCase) || game.GameID.EndsWith("_html5", StringComparison.InvariantCultureIgnoreCase)) { return(View("ISoftBetNew", game)); } return(View("ISoftBetNew", game)); default: return(View(game.VendorID.ToString(), game)); } }
private StringBuilder GetLiveCasinoTableListXml(ceDomainConfigEx domain, List <ceCasinoGameBaseEx> games, bool includeMoreFields) { StringBuilder data = new StringBuilder(); data.AppendLine("<tableList>"); CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); Dictionary <VendorID, string> dic = cva.GetRestrictedTerritoriesDictionary(DomainManager.CurrentDomainID); List <ceLiveCasinoTableBaseEx> allTables = LiveCasinoTableAccessor.GetDomainTables(domain.DomainID, null, true, true); Dictionary <long, long> popularities = GetGamePopularity(domain); foreach (ceCasinoGameBaseEx game in games) { List <ceLiveCasinoTableBaseEx> tables = allTables.Where(t => t.CasinoGameBaseID == game.ID && t.Enabled).ToList(); if (tables.Count == 0) { continue; } long popularity = 0L; popularities.TryGetValue(game.ID, out popularity); string helperUrl = GetHelpUrl(domain, game); string restrictedTerritories; dic.TryGetValue(game.VendorID, out restrictedTerritories); foreach (ceLiveCasinoTableBaseEx table in tables) { string loaderUrl = string.Format(CultureInfo.InvariantCulture, "{0}/?tableID={1:D}" , GetLoaderUrl(domain, game.ID, game.Slug, game.VendorID) , table.ID ); data.AppendLine("\t<table>"); bool isOpen = table.IsOpen(domain.DomainID); if (!string.IsNullOrWhiteSpace(table.TableName)) { game.GameName = table.TableName; game.ShortName = table.TableName; } game.Thumbnail = table.Thumbnail; data.AppendFormat("\t\t<id>{0:D}</id>\n", table.ID); data.AppendFormat("\t\t<category>{0}</category>\n", table.Category.SafeHtmlEncode()); data.AppendFormat("\t\t<gameId>{0}</gameId>\n", game.ID); data.AppendFormat("\t\t<isOpen>{0}</isOpen>\n", isOpen ? "true" : "false"); data.AppendFormat("\t\t<vipTable>{0}</vipTable>\n", table.VIPTable ? "true" : "false"); data.AppendFormat("\t\t<newTable>{0}</newTable>\n", (table.NewTable && table.NewTableExpirationDate > DateTime.Now.Date) ? "true" : "false"); data.AppendFormat("\t\t<turkishTable>{0}</turkishTable>\n", table.TurkishTable ? "true" : "false"); data.AppendFormat("\t\t<betBehindAvailable>{0}</betBehindAvailable>\n", table.BetBehindAvailable ? "true" : "false"); data.AppendFormat("\t\t<excludeFromRandomLaunch>{0}</excludeFromRandomLaunch>\n", table.ExcludeFromRandomLaunch ? "true" : "false"); data.AppendFormat("\t\t<seatsUnlimited>{0}</seatsUnlimited>\n", table.SeatsUnlimited ? "true" : "false"); data.AppendFormat("\t\t<dealerGender>{0}</dealerGender>\n", table.DealerGender); data.AppendFormat("\t\t<dealerOrigin>{0}</dealerOrigin>\n", table.DealerOrigin); if (!string.IsNullOrWhiteSpace(table.OpenHoursTimeZone)) { data.Append("\t\t<openingTime>\n"); if (table.OpenHoursStart != table.OpenHoursEnd) { data.Append("\t\t\t<is24HoursOpen>false</is24HoursOpen>\n"); data.AppendFormat("\t\t\t<timeZone>{0}</timeZone>\n", table.OpenHoursTimeZone.SafeHtmlEncode()); data.AppendFormat("\t\t\t<startTime>{0:D2}:{1:D2}</startTime>\n", table.OpenHoursStart / 60, table.OpenHoursStart % 60); data.AppendFormat("\t\t\t<endTime>{0:D2}:{1:D2}</endTime>\n", table.OpenHoursEnd / 60, table.OpenHoursEnd % 60); } else { data.Append("\t\t\t<is24HoursOpen>true</is24HoursOpen>\n"); } data.Append("\t\t</openingTime>\n"); } if (table.Limit.Type != LiveCasinoTableLimitType.None) { Dictionary <string, LimitAmount> items = GetCurrencyLimitAmount(table); if (items.Count > 0) { data.Append("\t\t<limits>\n"); foreach (var item in items) { data.AppendFormat("\t\t\t<limit currency=\"{0}\">\n", item.Key.SafeHtmlEncode()); data.AppendFormat("\t\t\t\t<min>{0:0.##}</min>\n", item.Value.MinAmount); data.AppendFormat("\t\t\t\t<max>{0:0.##}</max>\n", item.Value.MaxAmount); data.Append("\t\t\t</limit>\n"); } data.Append("\t\t</limits>\n"); } } data.Append("\t\t<platforms>"); string[] platforms = (table.ClientCompatibility ?? string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (platforms == null || platforms.Length == 0) { platforms = (game.ClientCompatibility ?? string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } foreach (string platform in platforms) { if (!string.IsNullOrWhiteSpace(platform)) { data.AppendFormat("<platform>{0}</platform>", platform.SafeHtmlEncode()); } } data.Append("</platforms>\n"); PopulateGameBasicProperties(data , domain , game , popularity , false , includeMoreFields , restrictedTerritories , loaderUrl , helperUrl ); data.AppendLine("\t</table>"); } } data.AppendLine("</tableList>"); return(data); }
// PopulateGameBasicProperties private void PopulateGameBasicPropertiesV2(StringBuilder data , ceDomainConfigEx domain , ceCasinoGameBaseEx game , List <dwGamePopularity> popularity , bool enableScalableThumbnail , bool includeMoreFields , string restrictedTerritories , string loaderUrl , string helpUrl ) { data.AppendFormat("\t\t<vendor>{0}</vendor>\n", Enum.GetName(typeof(VendorID), game.VendorID).SafeHtmlEncode()); VendorID originalVendorID = game.OriginalVendorID; if (originalVendorID == VendorID.Unknown) { originalVendorID = game.VendorID; } data.AppendFormat("\t\t<originalVendor>{0}</originalVendor>\n", Enum.GetName(typeof(VendorID), originalVendorID).SafeHtmlEncode()); if (game.ContentProviderID > 0 && ContentProviders.Exists(p => p.ID == game.ContentProviderID)) { ceContentProviderBase provider = ContentProviders.FirstOrDefault(p => p.ID == game.ContentProviderID); data.AppendFormat("\t\t<contentProvider>{0}</contentProvider>\n", provider.Identifying.SafeHtmlEncode()); //data.AppendFormat("\t\t<contentProviderLogo>"); //if (!string.IsNullOrWhiteSpace(provider.Logo)) // data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, provider.Logo).SafeHtmlEncode()); //data.Append("</contentProviderLogo>\n"); } else { data.AppendFormat("\t\t<contentProvider>{0}</contentProvider>\n", Enum.GetName(typeof(VendorID), game.VendorID).SafeHtmlEncode()); } data.AppendFormat("\t\t<name>{0}</name>\n", game.GameName.SafeHtmlEncode()); if (!string.IsNullOrEmpty(game.Slug)) { data.AppendFormat("\t\t<slug>{0}</slug>\n", game.Slug.SafeHtmlEncode()); } data.AppendFormat("\t\t<shortName>{0}</shortName>\n", game.ShortName.SafeHtmlEncode()); data.AppendFormat("\t\t<description>{0}</description>\n", game.Description.SafeHtmlEncode()); data.AppendFormat("\t\t<anonymousFunMode>{0}</anonymousFunMode>\n", game.AnonymousFunMode.ToString().ToLowerInvariant()); data.AppendFormat("\t\t<funMode>{0}</funMode>\n", game.FunMode.ToString().ToLowerInvariant()); data.AppendFormat("\t\t<realMode>{0}</realMode>\n", game.RealMode.ToString().ToLowerInvariant()); data.AppendFormat("\t\t<newGame>{0}</newGame>\n", (game.NewGame && game.NewGameExpirationDate > DateTime.Now.Date).ToString().ToLowerInvariant()); data.AppendFormat("\t\t<license>{0}</license>\n", game.License.ToString().ToLowerInvariant()); //data.AppendFormat("\t\t<popularity>{0}</popularity>\n", (popularity + 1) * game.PopularityCoefficient); if ((popularity != null && popularity.Count > 0 && game != null)) { data.AppendFormat("\t\t<popularity>{0}</popularity>\n", (popularity.Sum(p => p.Popularity) + 1) * game.PopularityCoefficient); } else { data.AppendFormat("\t\t<popularity>{0}</popularity>\n", "1"); //data.Append("\t\t<popularityDetails/>\n"); } if (game.Width > 0 && game.Height > 0) { data.AppendFormat("\t\t<width>{0}</width>\n", game.Width); data.AppendFormat("\t\t<height>{0}</height>\n", game.Height); } data.AppendFormat("\t\t<thumbnail>"); if (!enableScalableThumbnail) { if (!string.IsNullOrWhiteSpace(game.Thumbnail)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.Thumbnail).SafeHtmlEncode()); } } else { if (!string.IsNullOrWhiteSpace(game.ScalableThumbnailPath)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.ScalableThumbnailPath).SafeHtmlEncode()); } } data.Append("</thumbnail>\n"); data.AppendFormat("\t\t<logo>"); if (!string.IsNullOrWhiteSpace(game.Logo)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.Logo).SafeHtmlEncode()); } data.Append("</logo>\n"); data.AppendFormat("\t\t<backgroundImage>"); if (!string.IsNullOrWhiteSpace(game.BackgroundImage)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.BackgroundImage).SafeHtmlEncode()); } data.Append("</backgroundImage>\n"); if (!string.IsNullOrEmpty(game.Icon)) { data.AppendFormat("\t\t<icons format=\"//{0}{1}\">\n" , domain.GameResourceDomain , game.Icon.SafeHtmlEncode() ); int[] sizes = new int[] { 114, 88, 72, 57, 44, 22 }; foreach (int size in sizes) { data.AppendFormat("\t\t\t<icon size=\"{2}\">//{0}{1}</icon>" , domain.GameResourceDomain , string.Format(game.Icon, size).SafeHtmlEncode() , size ); } data.AppendLine("\t\t</icons>"); } data.AppendFormat("\t\t<url>{0}</url>\n", loaderUrl.SafeHtmlEncode()); if (!string.IsNullOrEmpty(helpUrl)) { data.AppendFormat("\t\t<helpUrl>{0}/</helpUrl>\n", helpUrl.SafeHtmlEncode()); } data.Append("\t\t<categories>"); string[] categories = game.GameCategories.DefaultIfNullOrEmpty(string.Empty).Split(','); foreach (string category in categories) { if (!string.IsNullOrWhiteSpace(category)) { data.AppendFormat("<category>{0}</category>", category.SafeHtmlEncode()); } } data.Append("</categories>\n"); data.Append("\t\t<tags>"); string[] tags = game.Tags.DefaultIfNullOrEmpty(string.Empty).Split(','); foreach (string tag in tags) { if (!string.IsNullOrWhiteSpace(tag)) { data.AppendFormat("<tag>{0}</tag>", tag.SafeHtmlEncode()); } } data.Append("</tags>\n"); data.Append("\t\t<restrictedTerritories>"); { string[] vendorTerritories = null; if (!string.IsNullOrWhiteSpace(restrictedTerritories)) { vendorTerritories = restrictedTerritories.Split(','); foreach (string territory in vendorTerritories) { if (!string.IsNullOrWhiteSpace(territory)) { data.AppendFormat("<restrictedTerritory>{0}</restrictedTerritory>", territory.SafeHtmlEncode()); } } } if (!string.IsNullOrWhiteSpace(game.RestrictedTerritories)) { string[] gameTerritories = game.RestrictedTerritories.Split(',').Where(t => !string.IsNullOrWhiteSpace(t)).ToArray(); foreach (string territory in gameTerritories) { if (vendorTerritories != null && vendorTerritories.Contains(territory)) { continue; } data.AppendFormat("<restrictedTerritory>{0}</restrictedTerritory>", territory.SafeHtmlEncode()); } } } data.Append("</restrictedTerritories>\n"); if (includeMoreFields) { data.AppendFormat("\t\t<thirdPartyFee>{0:f5}</thirdPartyFee>\n", game.ThirdPartyFee); data.AppendFormat("\t\t<theoreticalPayOut>{0:f5}</theoreticalPayOut>\n", game.TheoreticalPayOut); data.AppendFormat("\t\t<bonusContribution>{0:f5}</bonusContribution>\n", game.BonusContribution); data.AppendFormat("\t\t<jackpotContribution>{0:f5}</jackpotContribution>\n", game.JackpotContribution); data.AppendFormat("\t\t<fpp>{0:f5}</fpp>\n", game.FPP); data.AppendFormat("\t\t<reportCategory>{0}</reportCategory>\n", game.ReportCategory.SafeHtmlEncode()); data.AppendFormat("\t\t<invoicingGroup>{0:f}</invoicingGroup>\n", game.InvoicingGroup.SafeHtmlEncode()); } }// PopulateGameBasicProperties