private void FdsExport(string filename) { if (!ValidateExtension(filename, ".fds")) { return; } var exportSongIds = GetExportSongIds(); if (exportSongIds != null) { if (exportSongIds.Length > RomFileBase.MaxSongs) { Console.WriteLine("There is currently a hard limit of 8 songs for FDS disk export."); return; } var fds = new FdsFile(); fds.Save( project, filename, exportSongIds, project.Name, project.Author); } }
private void ExportRom() { var props = dialog.GetPropertyPage((int)ExportFormat.Rom); var songIds = GetSongIds(props.GetPropertyValue <bool[]>(4)); if (songIds.Length > RomFileBase.MaxSongs) { PlatformUtils.MessageBox($"Please select {RomFileBase.MaxSongs} songs or less.", "ROM Export", MessageBoxButtons.OK); return; } if (props.GetPropertyValue <string>(0) == "NES ROM") { var filename = lastExportFilename != null ? lastExportFilename : PlatformUtils.ShowSaveFileDialog("Export ROM File", "NES ROM (*.nes)|*.nes", ref Settings.LastExportFolder); if (filename != null) { var rom = new RomFile(); rom.Save( project, filename, songIds, props.GetPropertyValue <string>(1), props.GetPropertyValue <string>(2), props.GetPropertyValue <string>(3) == "PAL"); lastExportFilename = filename; } } else { var filename = lastExportFilename != null ? null : PlatformUtils.ShowSaveFileDialog("Export Famicom Disk", "FDS Disk (*.fds)|*.fds", ref Settings.LastExportFolder); if (filename != null) { var fds = new FdsFile(); fds.Save( project, filename, songIds, props.GetPropertyValue <string>(1), props.GetPropertyValue <string>(2)); lastExportFilename = filename; } } }
private void ExportRom() { var props = dialog.GetPropertyPage((int)ExportFormat.Rom); var songIds = GetSongIds(props.GetPropertyValue <bool[]>(4)); if (songIds.Length > RomFileBase.MaxSongs) { PlatformUtils.MessageBoxAsync($"Please select {RomFileBase.MaxSongs} songs or less.", "ROM Export", MessageBoxButtons.OK); return; } if (props.GetPropertyValue <string>(0) == "NES ROM") { Action <string> ExportRomAction = (filename) => { if (filename != null) { var rom = new RomFile(); rom.Save( project, filename, songIds, props.GetPropertyValue <string>(1), props.GetPropertyValue <string>(2), props.GetPropertyValue <string>(3) == "PAL"); lastExportFilename = filename; } }; if (PlatformUtils.IsMobile) { PlatformUtils.StartMobileSaveFileOperationAsync("*/*", $"{project.Name}.nes", (f) => { ExportRomAction(f); PlatformUtils.FinishMobileSaveFileOperationAsync(true, () => { PlatformUtils.ShowToast("NES ROM Export Successful!"); }); }); } else { var filename = lastExportFilename != null ? lastExportFilename : PlatformUtils.ShowSaveFileDialog("Export ROM File", "NES ROM (*.nes)|*.nes", ref Settings.LastExportFolder); ExportRomAction(filename); } } else { Action <string> ExportFdsAction = (filename) => { if (filename != null) { var fds = new FdsFile(); fds.Save( project, filename, songIds, props.GetPropertyValue <string>(1), props.GetPropertyValue <string>(2)); lastExportFilename = filename; } }; if (PlatformUtils.IsMobile) { PlatformUtils.StartMobileSaveFileOperationAsync("*/*", $"{project.Name}.fds", (f) => { ExportFdsAction(f); PlatformUtils.FinishMobileSaveFileOperationAsync(true, () => { PlatformUtils.ShowToast("FDS Disk Export Successful!"); }); }); } else { var filename = lastExportFilename != null ? null : PlatformUtils.ShowSaveFileDialog("Export Famicom Disk", "FDS Disk (*.fds)|*.fds", ref Settings.LastExportFolder); ExportFdsAction(filename); } } }