private void GetMetadataNucleus_Click(object sender, EventArgs e) { if (Meta.npdm.TitleID == null) { Meta = GameList.ParseGameFiles(PathText.Text); } NucleusCDN.GameHeader header = NucleusCDN.MakeHeadRequest(Meta.npdm.TitleID); if (header.Return == NucleusCDN.ReturnType.Success) { GameName.Text = header.GameName; PublisherName.Text = header.Publisher; if (!File.Exists("./Images/GameThumbnails/" + Meta.npdm.TitleID + ".jpg")) { File.WriteAllBytes("./Images/GameThumbnails/" + Meta.npdm.TitleID + ".jpg", NucleusCDN.MakeIconRequest(Meta.npdm.TitleID)); } Image image = Image.FromFile("./Images/GameThumbnails/" + Meta.npdm.TitleID + ".jpg"); Bitmap scaledImage = ResizeImage(image, 256, 256); Thumbnail.Image = scaledImage; } else { switch (header.Return) { case NucleusCDN.ReturnType.MissingTitle: MessageBox.Show("This title doesn't exist on the Nucleus CDN."); return; case NucleusCDN.ReturnType.InvalidTitle: MessageBox.Show("This TitleID is invalid."); return; } } }
private void SelectNacpPath_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog { Title = "Please select a NACP." }; fileDialog.Filter = "NACP File (*.nacp)|*.nacp"; DialogResult result = fileDialog.ShowDialog(); if (result == DialogResult.OK) { ContentNacpPath.Text = fileDialog.FileName; Meta = GameList.ParseGameFiles(PathText.Text, ContentNacpPath.Text); if (!String.IsNullOrWhiteSpace(Meta.nacp.TitleName)) { GameName.Text = Meta.nacp.TitleName; } if (!String.IsNullOrWhiteSpace(Meta.nacp.Publisher)) { PublisherName.Text = Meta.nacp.Publisher; } fileDialog.Dispose(); } else if (result == DialogResult.Cancel) { fileDialog.Dispose(); return; } }
private void AddGameListEntry_Load(object sender, EventArgs e) { this.Icon = new Icon("Images/main.ico"); UpdateLock(); GetMetadataCDN.Visible = Settings.GET_METADATA_FROM_CDN; ScanDir.Visible = Settings.GET_METADATA_FROM_CDN || Settings.USE_NUCLEUS; GetMetadataNucleus.Visible = Settings.USE_NUCLEUS; ScanState.Text = ""; Meta = new GameList.GameListMetaData(); }
private void GetMetadataCDN_Click(object sender, EventArgs e) { if (Meta.npdm.TitleID == null) { Meta = GameList.ParseGameFiles(PathText.Text); } GameList.GameListNACP nacp = NintendoCDN.GetGameMetadata(Meta.npdm.TitleID); GameName.Text = nacp.TitleName; PublisherName.Text = nacp.Publisher; Image image = Image.FromFile("./Images/GameThumbnails/" + Meta.npdm.TitleID + ".jpg"); Bitmap scaledImage = ResizeImage(image, 256, 256); Thumbnail.Image = scaledImage; }
private void Add_Click(object sender, EventArgs e) { if (entrysfound != null) { foreach (GameList.GameListEntry entry in entrysfound) { GameList.AddGameListEntry(entry); } MainForm.ReloadGameList(); } else { if (Meta.npdm.TitleID == null) { Meta = GameList.ParseGameFiles(PathText.Text); } if (!String.IsNullOrWhiteSpace(ThumbnailPath.Text)) { if (File.Exists("./Images/GameThumbnails/" + Meta.npdm.TitleID + ".jpg")) { File.Delete("./Images/GameThumbnails/" + Meta.npdm.TitleID + ".jpg"); } File.Copy(ThumbnailPath.Text, "./Images/GameThumbnails/" + Meta.npdm.TitleID + ".jpg"); } GameList.GameListEntry entry = new GameList.GameListEntry(); if (String.IsNullOrWhiteSpace(GameName.Text)) { MessageBox.Show("Please fill in the at least Game Name.", "Error"); return; } entry.AppName = GameName.Text; entry.Publisher = PublisherName.Text; entry.GamePath = PathText.Text; entry.TitleID = Meta.npdm.TitleID; GameList.AddGameListEntry(entry); MainForm.ReloadGameList(); Meta = new GameList.GameListMetaData(); } this.Close(); }
private void ScanDir_Click(object sender, EventArgs e) { if (Settings.GET_METADATA_FROM_CDN) { entrysfound = new List <GameList.GameListEntry>(); int foundgames = 0; int skippedgames = 0; foreach (string dir in Directory.GetDirectories(PathText.Text)) { if (GameList.IsGameDirectoryValid(dir)) { ScanState.Text = "Games found: " + foundgames + "\nSkipped Games (Aka Games not found on the CDN): " + skippedgames + "\n(This process may take a while)"; GameList.GameListMetaData metaData = GameList.ParseGameFiles(dir); metaData.nacp = NintendoCDN.GetGameMetadata(metaData.npdm.TitleID); if (metaData.nacp.TitleName == null) { ++skippedgames; continue; } entrysfound.Add(new GameList.GameListEntry { AppName = metaData.nacp.TitleName, Publisher = metaData.nacp.Publisher, TitleID = metaData.npdm.TitleID, GamePath = dir }); ++foundgames; } } ScanState.Text = "All Games found: " + foundgames + "\nAll Games Skipped: " + skippedgames; } else if (Settings.USE_NUCLEUS) { entrysfound = new List <GameList.GameListEntry>(); int foundgames = 0; int skippedgames = 0; foreach (string dir in Directory.GetDirectories(PathText.Text)) { if (GameList.IsGameDirectoryValid(dir)) { ScanState.Text = "Games found: " + foundgames + "\nSkipped Games (Aka Games not found on the CDN): " + skippedgames + "\n(This process may take a while)"; GameList.GameListMetaData metaData = GameList.ParseGameFiles(dir); NucleusCDN.GameHeader header = NucleusCDN.MakeHeadRequest(metaData.npdm.TitleID); if (header.Return == NucleusCDN.ReturnType.Success) { if (!File.Exists("./Images/GameThumbnails/" + metaData.npdm.TitleID + ".jpg")) { File.WriteAllBytes("./Images/GameThumbnails/" + metaData.npdm.TitleID + ".jpg", NucleusCDN.MakeIconRequest(metaData.npdm.TitleID)); } entrysfound.Add(new GameList.GameListEntry { AppName = header.GameName, Publisher = header.Publisher, TitleID = metaData.npdm.TitleID, GamePath = dir }); ++foundgames; } else { ++skippedgames; continue; } } } ScanState.Text = "All Games found: " + foundgames + "\nAll Games Skipped: " + skippedgames; } }