コード例 #1
0
        private static void PopulateApp(ConcurrentBag <AppEntity> updates, StoreAppInfo appInfo, BasicStoreInfo app, string type)
        {
            var platforms       = GetPlatforms(appInfo);
            var categories      = GetCategories(appInfo.data.categories);
            var genres          = GetGenres(appInfo.data.genres);
            var publishers      = GetDistinctListOrUnknown(appInfo.data.publishers);
            var developers      = GetDistinctListOrUnknown(appInfo.data.developers);
            var releaseDate     = GetReleaseDate(appInfo.data.release_date);
            var metaCriticScore = GetMetaCriticScore(appInfo.data.metacritic);

            if (ContainsAppGenre(genres))
            {
                type = AppEntity.AppTypeName;
            }
            else if (!categories.Contains("Single-player", StringComparer.OrdinalIgnoreCase))
            {
                type = AppEntity.MultiplayerOnlyTypeName;
            }

            CommonEventSource.Log.PopulateApp(
                app.AppId, app.Name, type, platforms, categories.ToFlatString(), genres.ToFlatString(),
                publishers.ToFlatString(), developers.ToFlatString(), releaseDate.ToString(CultureInfo.InvariantCulture), metaCriticScore);

            updates.Add(new AppEntity(app.AppId, app.Name, type, platforms, categories, genres, publishers, developers, releaseDate, metaCriticScore));
        }
コード例 #2
0
        private static Entities.Platforms GetPlatforms(StoreAppInfo appInfo)
        {
            if (appInfo.data.platforms == null)
            {
                return(Entities.Platforms.None);
            }

            return((appInfo.data.platforms.windows ? Entities.Platforms.Windows : Entities.Platforms.None)
                   | (appInfo.data.platforms.mac ? Entities.Platforms.Mac : Entities.Platforms.None)
                   | (appInfo.data.platforms.linux ? Entities.Platforms.Linux : Entities.Platforms.None));
        }