示例#1
0
        public Game GetGameFromSiteUri(string siteUri, GameEmbeds embeds = default(GameEmbeds))
        {
            var id = GetGameIDFromSiteUri(siteUri);

            if (string.IsNullOrEmpty(id))
                return null;

            return GetGame(id, embeds);
        }
示例#2
0
        public Game GetGameFromSiteUri(string siteUri, GameEmbeds embeds = default(GameEmbeds))
        {
            var id = GetGameIDFromSiteUri(siteUri);

            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            return(GetGame(id, embeds));
        }
示例#3
0
        public Game GetGame(string gameId, GameEmbeds embeds = default)
        {
            var parameters = new List <string>()
            {
                embeds.ToString()
            };
            var uri    = GetGamesUri(string.Format("/{0}{1}", Uri.EscapeDataString(gameId), parameters.ToParameters()));
            var result = baseClient.DoRequest(uri);

            return(Game.Parse(baseClient, result.data));
        }
示例#4
0
        public Game GetGame(string gameId, GameEmbeds embeds = default(GameEmbeds))
        {
            var parameters = new List<string>() { embeds.ToString() };

            var uri = GetGamesUri(string.Format("/{0}{1}",
                Uri.EscapeDataString(gameId),
                parameters.ToParameters()));

            var result = baseClient.DoRequest(uri);

            return Game.Parse(baseClient, result.data);
        }
示例#5
0
        public IEnumerable <Game> GetGames(
            string seriesId,
            string name           = null, int?yearOfRelease   = null,
            string platformId     = null, string regionId     = null,
            string moderatorId    = null, int?elementsPerPage = null,
            GameEmbeds embeds     = default(GameEmbeds),
            GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List <string>()
            {
                embeds.ToString()
            };

            parameters.AddRange(orderBy.ToParameters());

            if (!string.IsNullOrEmpty(name))
            {
                parameters.Add(string.Format("name={0}", Uri.EscapeDataString(name)));
            }

            if (yearOfRelease.HasValue)
            {
                parameters.Add(string.Format("released={0}", yearOfRelease.Value));
            }

            if (!string.IsNullOrEmpty(platformId))
            {
                parameters.Add(string.Format("platform={0}", Uri.EscapeDataString(platformId)));
            }

            if (!string.IsNullOrEmpty(regionId))
            {
                parameters.Add(string.Format("region={0}", Uri.EscapeDataString(regionId)));
            }

            if (!string.IsNullOrEmpty(moderatorId))
            {
                parameters.Add(string.Format("moderator={0}", Uri.EscapeDataString(moderatorId)));
            }

            if (elementsPerPage.HasValue)
            {
                parameters.Add(string.Format("max={0}", elementsPerPage.Value));
            }

            var uri = GetSeriesUri(string.Format("/{0}/games{1}",
                                                 Uri.EscapeDataString(seriesId),
                                                 parameters.ToParameters()));

            return(baseClient.DoPaginatedRequest(uri,
                                                 x => Game.Parse(baseClient, x) as Game));
        }
示例#6
0
        public ReadOnlyCollection <Game> GetRomHacks(string gameId,
                                                     GameEmbeds embeds     = default(GameEmbeds),
                                                     GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List <string>()
            {
                embeds.ToString()
            };

            parameters.AddRange(orderBy.ToParameters());

            var uri = GetGamesUri(string.Format("/{0}/romhacks{1}",
                                                Uri.EscapeDataString(gameId),
                                                parameters.ToParameters()));

            return(baseClient.DoDataCollectionRequest(uri,
                                                      x => Game.Parse(baseClient, x) as Game));
        }
示例#7
0
        public IEnumerable<Game> GetGames(
            string seriesId,
            string name = null, int? yearOfRelease = null,
            string platformId = null, string regionId = null,
            string moderatorId = null, int? elementsPerPage = null,
            GameEmbeds embeds = default(GameEmbeds),
            GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List<string>() { embeds.ToString() };

            parameters.AddRange(orderBy.ToParameters());

            if (!string.IsNullOrEmpty(name))
                parameters.Add(string.Format("name={0}", Uri.EscapeDataString(name)));

            if (yearOfRelease.HasValue)
                parameters.Add(string.Format("released={0}", yearOfRelease.Value));

            if (!string.IsNullOrEmpty(platformId))
                parameters.Add(string.Format("platform={0}", Uri.EscapeDataString(platformId)));

            if (!string.IsNullOrEmpty(regionId))
                parameters.Add(string.Format("region={0}", Uri.EscapeDataString(regionId)));

            if (!string.IsNullOrEmpty(moderatorId))
                parameters.Add(string.Format("moderator={0}", Uri.EscapeDataString(moderatorId)));

            if (elementsPerPage.HasValue)
                parameters.Add(string.Format("max={0}", elementsPerPage.Value));

            var uri = GetSeriesUri(string.Format("/{0}/games{1}",
                Uri.EscapeDataString(seriesId),
                parameters.ToParameters()));

            return baseClient.DoPaginatedRequest(uri,
                x => Game.Parse(baseClient, x) as Game);
        }
示例#8
0
        public Game SearchGameExact(string name, GameEmbeds embeds = default(GameEmbeds))
        {
            var game = GetGames(name: name, embeds: embeds, elementsPerPage: 1).Take(1).FirstOrDefault(x => x.Name == name);

            return(game);
        }
示例#9
0
        public Game SearchGame(string name, GameEmbeds embeds = default)
        {
            var game = GetGames(name: name, embeds: embeds, elementsPerPage: 1).FirstOrDefault();

            return(game);
        }
示例#10
0
        public Game SearchGameExact(string name, GameEmbeds embeds = default(GameEmbeds))
        {
            var game = GetGames(name: name, embeds: embeds, elementsPerPage: 1).Take(1).FirstOrDefault(x => x.Name == name);

            return game;
        }
示例#11
0
        public Game SearchGame(string name, GameEmbeds embeds = default(GameEmbeds))
        {
            var game = GetGames(name: name, embeds: embeds, elementsPerPage: 1).FirstOrDefault();

            return game;
        }
示例#12
0
        public ReadOnlyCollection<Game> GetRomHacks(string gameId,
            GameEmbeds embeds = default(GameEmbeds),
            GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List<string>() { embeds.ToString() };

            parameters.AddRange(orderBy.ToParameters());

            var uri = GetGamesUri(string.Format("/{0}/romhacks{1}",
                Uri.EscapeDataString(gameId),
                parameters.ToParameters()));

            return baseClient.DoDataCollectionRequest(uri,
                x => Game.Parse(baseClient, x) as Game);
        }