Ejemplo n.º 1
0
        /// <summary>
        /// Gets the summary.
        /// </summary>
        /// <param name="system">The system.</param>
        /// <param name="user">The user.</param>
        /// <returns>GameSystemSummary.</returns>
        private GameSystemSummary GetSummary(GameSystem system, User user)
        {
            var summary = new GameSystemSummary
            {
                Name        = system.GameSystemName,
                DisplayName = system.Name
            };

            var items = user == null?
                        system.GetRecursiveChildren(i => i is Game) :
                            system.GetRecursiveChildren(user, new InternalItemsQuery(user)
            {
                IncludeItemTypes = new[] { typeof(Game).Name }
            });

            var games = items.Cast <Game>().ToList();

            summary.ClientInstalledGameCount = games.Count(i => i.IsPlaceHolder);

            summary.GameCount = games.Count;

            summary.GameFileExtensions = games.Where(i => !i.IsPlaceHolder).Select(i => Path.GetExtension(i.Path))
                                         .Distinct(StringComparer.OrdinalIgnoreCase)
                                         .ToList();

            return(summary);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the summary.
        /// </summary>
        /// <param name="system">The system.</param>
        /// <param name="user">The user.</param>
        /// <returns>GameSystemSummary.</returns>
        private GameSystemSummary GetSummary(GameSystem system, User user)
        {
            var summary = new GameSystemSummary
            {
                Name        = system.GameSystemName,
                DisplayName = system.Name
            };

            var items = user == null ? system.RecursiveChildren : system.GetRecursiveChildren(user);

            var games = items.OfType <Game>().ToList();

            summary.ClientInstalledGameCount = games.Count(i => !i.IsInstalledOnClient);

            summary.GameCount = games.Count;

            summary.GameFileExtensions = games.Where(i => !i.IsInstalledOnClient).Select(i => Path.GetExtension(i.Path))
                                         .Distinct(StringComparer.OrdinalIgnoreCase)
                                         .ToList();

            return(summary);
        }