private static void RunMultiDumper(ref Settings settings) { if (settings.MultidumperPath == null || settings.VgmFile == null || settings.InputFiles != null) { return; } // We normalize the VGM path here because we need to know its directory... settings.VgmFile = Path.GetFullPath(settings.VgmFile); // Check if we have WAVs. Note that we use "natural" sorting to make sure 10 comes after 9. settings.InputFiles = Directory.EnumerateFiles( Path.GetDirectoryName(settings.VgmFile) ?? throw new Exception($"Can't get path from VGM \"{settings.VgmFile}\""), Path.GetFileNameWithoutExtension(settings.VgmFile) + " - *.wav") .OrderByAlphaNumeric(s => s) .ToList(); if (!settings.InputFiles.Any()) { Console.WriteLine("Running MultiDumper..."); // Let's run it var wrapper = new MultiDumperWrapper(settings.MultidumperPath); var song = wrapper.GetSongs(settings.VgmFile).First(); var filenames = wrapper.Dump(song, d => Console.Write($"\r{d:P0}")); settings.InputFiles = filenames.OrderByAlphaNumeric(s => s).ToList(); Console.WriteLine($" done. {settings.InputFiles.Count} files found."); } else { Console.WriteLine($"Skipping MultiDumper as {settings.InputFiles.Count} files were already present."); } }
private void SubsongSelectionForm_Load(object sender, EventArgs e) { Subsongs.Items.Clear(); Subsongs.Items.Add($"Checking {_filename}..."); // Start a task to load the metadata Task.Factory.StartNew(() => { var songs = _wrapper.GetSongs(_filename); Subsongs.BeginInvoke(new Action(() => { // Back on the GUI thread... Subsongs.Items.Clear(); Subsongs.Items.AddRange(songs.ToArray <object>()); Subsongs.SelectedIndex = 0; OKButton.Enabled = true; if (Subsongs.Items.Count == 1) { // If only one song, select it OkButtonClick(this, new EventArgs()); } })); }); }
private void SubsongSelectionForm_Load(object sender, EventArgs e) { Subsongs.Items.Clear(); Subsongs.Items.Add($"Checking {_filename}..."); // Start a task to load the metadata Task.Factory.StartNew(() => { var songs = _wrapper.GetSongs(_filename).ToList(); Subsongs.BeginInvoke(new Action(() => { // Back on the GUI thread... Subsongs.Items.Clear(); Subsongs.Items.AddRange(songs.ToArray <object>()); Subsongs.SelectedIndex = 0; OKButton.Enabled = true; if (songs.Count == 1 && songs[0].GetLength() > TimeSpan.Zero) { // If only one song, and it has a length, choose it OkButtonClick(this, EventArgs.Empty); } })); }); }