Beispiel #1
0
        static void Main(string[] args)
        {
            List <GetAppListApp> apiApps = GetAppList.GetAllApps();
            List <SteamApp>      dbApps  = SteamGameListData.Models.SteamApp.GetAllSteamApps();

            int counter = 0;

            foreach (GetAppListApp steamApp in apiApps)
            {
                // Attempt to get from database
                SteamApp existingApp = dbApps.Where(x => x.AppId == steamApp.AppId).FirstOrDefault();

                if (existingApp == null)
                {
                    // Add
                    WriteLine(string.Format("Missing {0}: {1}", steamApp.AppId, steamApp.Name), 0);
                    SteamApp newSteamApp = SteamApp.CreateSteamApp(steamApp.AppId, steamApp.Name);

                    SteamApp.UpdateSteamAppReleaseDate(newSteamApp.AppId, GetAppDate(newSteamApp));
                }
                else if (existingApp.ReleaseDate == null)
                {
                    WriteLine(string.Format("No Release Date {0}: {1}", steamApp.AppId, steamApp.Name), 0);

                    // Get the release date
                    SteamApp.UpdateSteamAppReleaseDate(existingApp.SteamAppId, GetAppDate(existingApp));
                }
                else
                {
                    WriteLine(string.Format("Found {0}: {1}", steamApp.AppId, steamApp.Name), 0);
                }

                counter++;

                WriteLine(counter + " / " + apiApps.Count, 2);
            }
        }