コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        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;
            }
        }