コード例 #1
0
 public static List <Link> GetGameFamilies(this Game game)
 {
     return(game
            .GetGameItem()
            .Link
            .Where(link =>
                   string.Equals(link.Type, BOARDGAME_FAMILY) &&
                   !string.Equals(link.Value, ADMIN_NOT_TO_ADD))
            .ToList());
 }
コード例 #2
0
        public static int GetId(this Game game)
        {
            var item = game.GetGameItem();

            if (item == null)
            {
                throw new NullReferenceException("Game item returned null");
            }

            return(int.Parse(item.Id));
        }
コード例 #3
0
        // Methods to get internal objects / properties
        private static string GetValue(this Game game, string propName)
        {
            var gameItem = game.GetGameItem();

            var obj = gameItem
                      .GetType()
                      .GetProperty(propName)
                      ?.GetValue(gameItem, null);

            return(obj?
                   .GetType()
                   .GetProperty("Value")
                   ?.GetValue(obj, null) as string);
        }
コード例 #4
0
 public static string GetName(this Game game)
 {
     return(game.GetGameItem()?.Name.FirstOrDefault(name => string.Equals(name.Type, PRIMARY_NAME))?.Value);
 }
コード例 #5
0
 private static Ratings GetStatistics(this Game game)
 {
     return(game.GetGameItem().Statistics.Ratings);
 }
コード例 #6
0
 public static List <Link> GetGameMechanics(this Game game)
 {
     return(game.GetGameItem().Link.Where(link => string.Equals(link.Type, BOARDGAME_MECHANIC)).ToList());
 }
コード例 #7
0
 public static List <Link> GetGameCategories(this Game game)
 {
     return(game.GetGameItem().Link.Where(link => string.Equals(link.Type, BOARDGAME_CATEGORY)).ToList());
 }