public static GamesLibraryModel CreateModelFromGame(Game game)//, List<LibraryDataGDBLink> links) { /* * if (links == null) * links = LibraryDataGDBLink.GetLibraryData().ToList(); */ GamesLibraryModel d = new GamesLibraryModel(); d.ID = game.gameId; // check for subsystem if (game.subSystemId != null && game.subSystemId > 0) { string subName = GSystem.GetSubSystemName(game.subSystemId.Value); d.System = subName; } else { d.System = GSystem.GetSystemName(game.systemId); } d.LastPlayed = DbEF.FormatDate(game.gameLastPlayed); d.Favorite = game.isFavorite; d.Country = game.Country; if (game.romNameFromDAT != null) { /* * if (game.romNameFromDAT.Contains("(USA)")) * d.Country = "USA"; * if (game.romNameFromDAT.Contains("(Europe)")) * d.Country = "EUR"; * if (game.romNameFromDAT.Contains("(Japan)")) * d.Country = "JPN"; */ } d.Flags = game.OtherFlags; d.Language = game.Language; d.Publisher = game.Publisher; d.Developer = game.Developer; d.Year = game.Year; d.Coop = game.Coop; d.ESRB = game.ESRB; d.Players = game.Players; d.Year = game.Year; if (game.ManualEditSet == true) { if (game.gameNameEdited != null && game.gameNameEdited != "") { d.Game = game.gameNameEdited; } } else { if (game.gameNameFromDAT != null && game.gameNameFromDAT != "") { d.Game = game.gameNameFromDAT; } else { d.Game = game.gameName; } } //d.Game = game.gameName; /* * if (game.gameNameFromDAT != null && game.gameNameFromDAT != "") * d.Game = game.gameNameFromDAT; * else * d.Game = game.gameName; */ //d.DatName = game.gameNameFromDAT; d.DatRom = game.romNameFromDAT; /* * if (game.gdbId != null && game.gdbId > 0) * { * var link = links.Where(x => x.GDBId == game.gdbId).SingleOrDefault(); // LibraryDataGDBLink.GetLibraryData(game.gdbId.Value); * if (link != null) * { * if (link.Publisher != null && link.Publisher != "") * d.Publisher = link.Publisher; * * d.Developer = link.Developer; * * if (link.Year != null && link.Year != "") * d.Year = DbEF.ReturnYear(link.Year); * d.Players = link.Players; * d.Coop = link.Coop; * d.ESRB = link.ESRB; * } * } */ //d.Year = "2914"; // last minute region detection if ((d.Country == null || d.Country.Trim() == "") && d.Game != null) { if (d.Game.Contains("(Japan)")) { d.Country = "Japan"; } if (d.Game.Contains("(Europe)")) { d.Country = "Europe"; } if (d.Game.Contains("(USA)")) { d.Country = "USA"; } if (d.Game.Contains("(Usa, Europe)")) { d.Country = "USA, Europe"; } // goodtools if (d.Game.Contains("(W)")) { d.Country = "World"; } if (d.Game.Contains("(U)")) { d.Country = "USA"; } if (d.Game.Contains("(As)")) { d.Country = "Asia"; } if (d.Game.Contains("(E)")) { d.Country = "Europe"; } } return(d); }