public static void viewCueFile(FileInfo path) { //Yeah, this kinda sucks actually, and it's the pinnacle of my hatred for shit which requires multiple files to represent one thing //This whole view individual file thing doesn't seem suitable for this... anyway, the most notable problem is that due to the way I wrote all this other code here, it asks you for which track before you select a handler, and that feels kinda weird? Like I think that's kinda weird but anyway whatever who cares nothing matters try { using (var file = path.OpenRead()) { var cue = CueSheet.create(file, path.Extension); var choices = cue.filenames; var choice = chooseChoices(choices.Where(c => c.isData), "filename", "Which file do you want to view from this cuesheet?", "File selection"); if (choice != null) { FileInfo filename = new FileInfo(Path.Combine(path.DirectoryName, choice.filename)); using (ROMFile rom = new NormalROMFile(filename)) { rom.cdSectorSize = choice.sectorSize; viewFile(rom, true); } } //TODO: Include a way for user to view the cuesheet itself or non-data tracks, if they reaaaally wanted to do that } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Uh oh spaghetti-o", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void viewFile(FileInfo path) { if (IO.ArchiveHelpers.isArchiveExtension(path.Extension)) { try { using (IArchive archive = ArchiveFactory.Open(path)) { string helpString = "This is an archive and there's multiple files in it. Please choose which one you want to view the info for."; IArchiveEntry choice = chooseChoices(archive.Entries, "Key", helpString, "Choose File in Archive"); if (choice != null) { using (ROMFile f = new CompressedROMFile(choice, path)) { viewFile(f); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Uh oh spaghetti-o", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (IO.ArchiveHelpers.isGCZ(path.Extension)) { using (GCZROMFile gcz = new GCZROMFile(path)) { viewFile(gcz); } } else if (CueSheet.isCueExtension(path.Extension)) { viewCueFile(path); } else { using (ROMFile f = new NormalROMFile(path)) { viewFile(f); } } }