public bool Run() { if (HasOption("?") || HasOption("help")) { DisplayHelp(); return(true); } if (args.Length >= 3) { InitializeConsole(); using (var scopedLog = new ScopedLogOutput(this)) { if (OpenProject()) { var outputFilename = args[2]; switch (args[1].ToLower().Trim()) { case "wav-export": WavMp3Export(outputFilename, false); break; case "mp3-export": WavMp3Export(outputFilename, true); break; case "nsf-export": NsfExport(outputFilename); break; case "rom-export": RomExport(outputFilename); break; case "fds-export": FdsExport(outputFilename); break; case "famitracker-txt-export": FamiTrackerTextExport(outputFilename); break; case "famistudio-txt-export": FamiStudioTextExport(outputFilename); break; case "famitone2-asm-export": FamiTone2MusicExport(outputFilename, false); break; case "famitone2-asm-sfx-export": FamiTone2SfxExport(outputFilename, false); break; case "famistudio-asm-export": FamiTone2MusicExport(outputFilename, true); break; case "famistudio-asm-sfx-export": FamiTone2SfxExport(outputFilename, true); break; case "unit-test": RunUnitTest(outputFilename); break; default: Console.WriteLine($"Unknown command {args[1]}. Use -help or -? for help."); break; } } } ShutdownConsole(); return(true); } return(false); }
public void Export(FamiStudioForm parentForm, bool repeatLast) { var dlgLog = new LogProgressDialog(parentForm); using (var scopedLog = new ScopedLogOutput(dlgLog, LogSeverity.Info)) { var selectedFormat = (ExportFormat)dialog.SelectedIndex; Exporting?.Invoke(); if (!repeatLast) { lastExportFilename = null; } switch (selectedFormat) { case ExportFormat.WavMp3: ExportWavMp3(); break; case ExportFormat.Video: ExportVideo(); break; case ExportFormat.Nsf: ExportNsf(); break; case ExportFormat.Rom: ExportRom(); break; case ExportFormat.Midi: ExportMidi(); break; case ExportFormat.Text: ExportText(); break; case ExportFormat.FamiTracker: ExportFamiTracker(); break; case ExportFormat.FamiTone2Music: ExportFamiTone2Music(false); break; case ExportFormat.FamiStudioMusic: ExportFamiTone2Music(true); break; case ExportFormat.FamiTone2Sfx: ExportFamiTone2Sfx(false); break; case ExportFormat.FamiStudioSfx: ExportFamiTone2Sfx(true); break; } if (dlgLog.HasMessages) { Log.LogMessage(LogSeverity.Info, "Done!"); Log.ReportProgress(1.0f); } dlgLog.StayModalUntilClosed(); } }
public void ShowDialog(FamiStudioForm parentForm) { if (dialog.ShowDialog(parentForm) == DialogResult.OK) { dialog.Hide(); var dlgLog = new LogProgressDialog(parentForm); using (var scopedLog = new ScopedLogOutput(dlgLog, LogSeverity.Info)) { var selectedFormat = (ExportFormat)dialog.SelectedIndex; switch (selectedFormat) { case ExportFormat.WavMp3: ExportWavMp3(); break; case ExportFormat.Video: ExportVideo(); break; case ExportFormat.Nsf: ExportNsf(); break; case ExportFormat.Rom: ExportRom(); break; case ExportFormat.Text: ExportText(); break; case ExportFormat.FamiTracker: ExportFamiTracker(); break; case ExportFormat.FamiTone2Music: ExportFamiTone2Music(false); break; case ExportFormat.FamiStudioMusic: ExportFamiTone2Music(true); break; case ExportFormat.FamiTone2Sfx: ExportFamiTone2Sfx(false); break; case ExportFormat.FamiStudioSfx: ExportFamiTone2Sfx(true); break; } if (dlgLog.HasMessages) { Log.LogMessage(LogSeverity.Info, "Done!"); Log.ReportProgress(1.0f); } dlgLog.StayModalUntilClosed(); } } }