Example #1
0
        private void romInfoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (NesEmu.EmulationON)
            {
                NesEmu.EmulationPaused = true;

                FormRomInfo frm = new FormRomInfo(NesEmu.GAMEFILE);
                frm.ShowDialog(this);

                NesEmu.EmulationPaused = false;
            }
            else
            {
                OpenFileDialog op = new OpenFileDialog();
                op.Title = Program.ResourceManager.GetString("Title_OpenRom");
                op.Filter = Program.ResourceManager.GetString("Filter_Rom");
                if (op.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    FormRomInfo frm = new FormRomInfo(op.FileName);
                    frm.ShowDialog(this);
                }
            }
        }
Example #2
0
        private void ShowGameInfo(object sender, EventArgs e)
        {
            if (managedListView1.SelectedItems.Count != 1)
            {
                ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseSelectOneGameToShowInfoOf"));
                return;
            }
            string id = managedListView1.SelectedItems[0].Tag.ToString();

            bool isArchive = false;
            MyNesDBEntryInfo entry = MyNesDB.GetEntry(id);
            string path = entry.Path;
            string tempFile = path;
            int aIndex = 0;
            if (path.StartsWith("("))
            {
                isArchive = true;
                // Decode
                string[] pathCodes = path.Split(new char[] { '(', ')' });
                int.TryParse(pathCodes[1], out aIndex);
                path = pathCodes[2];
            }
            if (isArchive)
            {
                // Extract the archive
                string tempFolder = Path.GetTempPath() + "\\MYNES\\";

                Directory.CreateDirectory(tempFolder);
                // Extract it !
                SevenZipExtractor extractor = new SevenZipExtractor(path);
                tempFile = tempFolder + extractor.ArchiveFileData[aIndex].FileName;
                Stream aStream = new FileStream(tempFile, FileMode.Create, FileAccess.Write);
                extractor.ExtractFile(aIndex, aStream);
                aStream.Close();
            }
            if (File.Exists(tempFile))
            {
                if (NesEmu.EmulationON)
                    NesEmu.EmulationPaused = true;

                FormRomInfo form = new FormRomInfo(tempFile);
                form.ShowDialog(this);

                if (NesEmu.EmulationON)
                    NesEmu.EmulationPaused = false;
            }
            else
            {
                ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_GameFileNotExistOrNoFileAssignedToThisGameYet"));
            }
        }