Beispiel #1
0
        public static List <Game> GetRecentlyPlayedGames(dynamic data)
        {
            main.UpdateStatus("Fetching recently played games");

            // New list
            List <Game> recentlyPlayedGames = new List <Game>();

            // For each game in results
            foreach (JObject jo in data["RecentlyPlayed"])
            {
                // Get game
                string           gameID         = jo["GameID"].ToString();
                string           consoleID      = jo["ConsoleID"].ToString();
                string           consoleName    = jo["ConsoleName"].ToString();
                SupportedConsole currentConsole = GetLocalConsole_byName(consoleName);
                Game             game           = GetLocalGame_byIDandConsole(currentConsole, gameID);

                // Check if found local game
                if (game == null)
                {
                    // If not, download individual game
                    Console.WriteLine("No local game found for Game ID: " + gameID);

                    // Download game
                    game = DownloadGame_ByID(gameID);

                    // Add game to it's console
                    currentConsole.games.Add(game);
                }
                // Add game to return list
                recentlyPlayedGames.Add(game);
            }
            main.UpdateStatus(string.Empty);
            return(recentlyPlayedGames);
        }
Beispiel #2
0
        // Game
        public static void DownloadGames_ForConsole(SupportedConsole sc)
        {
            main.UpdateStatus("Downloading games for " + sc.Name + "...");

            receivingData = true;


            // Fetch console list
            string url  = Requests.requestURL(Constants.QueryTypes.WEB_GAME_LIST, sc.ID);
            string json = Requests.FetchJSON(url);

            // Populate list of console IDs
            dynamic data = JsonConvert.DeserializeObject(json);

            // Create list of Games
            if (data["game"][0] != null)
            {
                sc.games = new List <Game>();

                foreach (JObject j in data["game"][0])
                {
                    // Create console object
                    Game newGame = new Game(j);

                    // Adds Game object to list in console's class
                    sc.games.Add(newGame);

                    Console.WriteLine("Added game: " + newGame.Title);
                }
            }
            receivingData = false;

            main.UpdateStatus(string.Empty);
        }
Beispiel #3
0
        // Download
        public static void DownloadConsoleList_CreateObjects()
        {
            main.UpdateStatus("Downloading console list...");
            Console.WriteLine("Downloading console data...");

            receivingData = true;

            // Fetch console list
            string url  = Requests.requestURL(Constants.QueryTypes.WEB_CONSOLE_IDs, null);
            string json = Requests.FetchJSON(url);

            // Populate list of console IDs
            dynamic data = JsonConvert.DeserializeObject(json);

            if (data["console"][0] != null)
            {
                if (globalData == null)
                {
                    globalData = new StoredData();
                }

                // Create list of consoles
                globalData.consoles = new List <SupportedConsole>();

                foreach (JObject j in data["console"][0])
                {
                    // Create console object
                    SupportedConsole sc = new SupportedConsole(j);

                    // Add console to list
                    globalData.consoles.Add(sc);

                    Console.WriteLine("Added console: " + sc.Name);
                }
            }
            else
            {
                MessageBox.Show(
                    "No data received for consoles, check your credentials in Settings.",
                    "No data received",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }
            receivingData = false;

            main.UpdateStatus(string.Empty);
        }
Beispiel #4
0
 public static Game GetLocalGame_byIDandConsole(SupportedConsole sc, string id)
 {
     if (globalData != null)
     {
         if (sc.games != null)
         {
             foreach (Game game in sc.games)
             {
                 if (game.ID == id)
                 {
                     return(game);
                 }
             }
         }
     }
     return(null);
 }
Beispiel #5
0
        public static Image getConsoleImage(SupportedConsole sc)
        {
            switch (sc.Name)
            {
            case "Mega Drive":
                return(ConsoleInformation.ConsoleImages.MegaDrive);

            case "Game Boy":
                return(ConsoleInformation.ConsoleImages.GameBoy);

            case "Game Boy Color":
                return(ConsoleInformation.ConsoleImages.GameBoyColor);

            case "Game Boy Advance":
                return(ConsoleInformation.ConsoleImages.GameBoyAdvance);

            case "SNES":
                return(ConsoleInformation.ConsoleImages.SNES);

            case "NES":
                return(ConsoleInformation.ConsoleImages.NES);

            case "Nintendo 64":
                return(ConsoleInformation.ConsoleImages.Nintendo64);

            case "Master System":
                return(ConsoleInformation.ConsoleImages.MasterSystem);

            case "PlayStation":
                return(ConsoleInformation.ConsoleImages.PlayStation);

            case "Atari Lynx":
                return(ConsoleInformation.ConsoleImages.AtariLynx);

            case "Neo Geo Pocket":
                return(ConsoleInformation.ConsoleImages.NeoGeoPocket);

            case "Game Gear":
                return(ConsoleInformation.ConsoleImages.GameGear);

            case "GameCube":
                return(ConsoleInformation.ConsoleImages.GameCube);

            case "Atari Jaguar":
                return(ConsoleInformation.ConsoleImages.AtariJaguar);

            case "Nintendo DS":
                return(ConsoleInformation.ConsoleImages.NintendoDS);

            case "Wii":
                return(ConsoleInformation.ConsoleImages.Wii);

            case "Wii U":
                return(ConsoleInformation.ConsoleImages.WiiU);

            case "PlayStation 2":
                return(ConsoleInformation.ConsoleImages.PlayStation2);

            case "Xbox":
                return(ConsoleInformation.ConsoleImages.Xbox);

            case "Pokemon Mini":
                return(ConsoleInformation.ConsoleImages.PokemonMini);

            case "Atari 2600":
                return(ConsoleInformation.ConsoleImages.Atari2600);

            case "DOS":
                return(ConsoleInformation.ConsoleImages.DOS);

            case "Arcade":
                return(ConsoleInformation.ConsoleImages.Arcade);

            case "Virtual Boy":
                return(ConsoleInformation.ConsoleImages.VirtualBoy);

            case "MSX":
                return(ConsoleInformation.ConsoleImages.MSX);

            case "Commodore 64":
                return(ConsoleInformation.ConsoleImages.Commodore64);

            case "ZX81":
                return(ConsoleInformation.ConsoleImages.ZX81);

            case "Oric":
                return(ConsoleInformation.ConsoleImages.Oric);

            case "SG-1000":
                return(ConsoleInformation.ConsoleImages.SG_1000);

            case "VIC-20":
                return(ConsoleInformation.ConsoleImages.VIC_20);

            case "Amiga":
                return(ConsoleInformation.ConsoleImages.Amiga);

            case "Atari ST":
                return(ConsoleInformation.ConsoleImages.AtariST);

            case "Amstrad CPC":
                return(ConsoleInformation.ConsoleImages.AmstradCPC);

            case "Apple II":
                return(ConsoleInformation.ConsoleImages.AppleII);

            case "Saturn":
                return(ConsoleInformation.ConsoleImages.Saturn);

            case "Dreamcast":
                return(ConsoleInformation.ConsoleImages.Dreamcast);

            case "PlayStation Portable":
                return(ConsoleInformation.ConsoleImages.PlayStationPortable);

            case "Philips CD-i":
                return(ConsoleInformation.ConsoleImages.PhilipsCD_i);

            case "3DO Interactive Multiplayer":
                return(ConsoleInformation.ConsoleImages._3DOInteractiveMultiplayer);

            case "ColecoVision":
                return(ConsoleInformation.ConsoleImages.ColecoVision);

            case "Intellivision":
                return(ConsoleInformation.ConsoleImages.Intellivision);

            case "Vectrex":
                return(ConsoleInformation.ConsoleImages.Vectrex);

            case "PC-8000/8800":
                return(ConsoleInformation.ConsoleImages.PC8000_8800);

            case "PC-9800":
                return(ConsoleInformation.ConsoleImages.PC9800);

            case "PC-FX":
                return(ConsoleInformation.ConsoleImages.PC_FX);

            case "Atari 5200":
                return(ConsoleInformation.ConsoleImages.Atari5200);

            case "Super Cassette Vision":
                return(ConsoleInformation.ConsoleImages.SuperCassetteVision);

            case "Atari 7800":
                return(ConsoleInformation.ConsoleImages.Atari7800);

            case "X68K":
                return(ConsoleInformation.ConsoleImages.X68K);

            case "WonderSwan":
                return(ConsoleInformation.ConsoleImages.WonderSwan);

            case "Cassette Vision":
                return(ConsoleInformation.ConsoleImages.CassetteVision);

            case "PC Engine":
                return(ConsoleInformation.ConsoleImages.PCEngine);

            case "Sega CD":
                return(ConsoleInformation.ConsoleImages.SegaCD);

            case "32X":
                return(ConsoleInformation.ConsoleImages._32X);



            default:
                return(null);
            }
        }