void Action_MidiFileOpen_QuietAppend(string filename, int trackNo) { Event_MidiClearMemory(null, EventArgs.Empty); if (string.IsNullOrEmpty(filename)) return; if (!System.IO.File.Exists(filename)) { MessageBox.Show(filename, "Error loading file."); return; } Text = string.Format(Strings.Dialog_Title_1, Path.GetFileNameWithoutExtension(filename)); midiFile = new MidiReader(filename); midiFile.SelectedTrackNumber = trackNo; midiFile.ClearView -= Event_MidiClearMemory; midiFile.FileLoaded -= Event_MidiFileLoaded; midiFile.TrackChanged -= Event_MidiActiveTrackChanged_ListBoxItemSelected; midiFile.ClearView += Event_MidiClearMemory; midiFile.FileLoaded += Event_MidiFileLoaded; midiFile.TrackChanged += Event_MidiActiveTrackChanged_ListBoxItemSelected; #if DEBUG midiFile.MessageHandlers.Add(ShowProgress); #endif midiFile.Read(); VstContainer.VstPlayer.Settings.FromMidi(midiFile); //foreach (Action a in afteropen) a(); OnGotMidiFile(); }
public void Action_MidiFileOpen() { if (midiFile != null) { midiFile.Dispose(); midiFile = null; } MidiFileDialog.Filter = Strings.FileFilter_MidiFile; Text = Strings.Dialog_Title_0; if (MidiFileDialog.ShowDialog() == DialogResult.OK) if (File.Exists(MidiFileDialog.FileName)) Action_MidiFileOpen(MidiFileDialog.FileName, 0); }