コード例 #1
0
        private void SelectGamePath_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowser = new FolderBrowserDialog
            {
                Description = "Please select a RomFS / ExeFS Folder."
            };

            DialogResult result = folderBrowser.ShowDialog();

            if (result == DialogResult.OK)
            {
                PathText.Text = folderBrowser.SelectedPath;
                if (GameList.IsGameDirectoryValid(folderBrowser.SelectedPath))
                {
                    if (!String.IsNullOrWhiteSpace(PathText.Text))
                    {
                        isUnlocked      = true;
                        Add.Enabled     = true;
                        ScanDir.Enabled = false;
                    }

                    UpdateLock();
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(PathText.Text))
                    {
                        ScanDir.Enabled = true;
                        Add.Enabled     = true;
                    }
                }

                folderBrowser.Dispose();
            }
            else if (result == DialogResult.Cancel)
            {
                folderBrowser.Dispose();
                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;
            }
        }