private void export_btn_Click(object sender, EventArgs e) { if (this.midis_lv.SelectedIndices.Count == 0) { return; } SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Midi Files (.mid;.midi)|*.mid;*.midi"; if (saveFileDialog.ShowDialog() != DialogResult.OK) { return; } try { byte[] inputMID = this.decompressFile(this.midis[this.midis_lv.SelectedIndices[0]].Pointer); int numberInstruments = 0; MidiParse.GEMidiToMidi(inputMID, inputMID.Length, saveFileDialog.FileName, ref numberInstruments); int num = (int)MessageBox.Show("Export Successful"); } catch (Exception ex) { int num = (int)MessageBox.Show("Export Failed: " + ex.ToString()); } }
private void import_btn_Click(object sender, EventArgs e) { if (this.midis_lv.SelectedIndices.Count == 0) { return; } this.openFileDialog1.Filter = "Midi Files (.mid;.midi)|*.mid;*.midi"; if (this.openFileDialog1.ShowDialog() != DialogResult.OK) { return; } try { if (!MidiParse.MidiToGEFormat(this.openFileDialog1.FileName, this.outDir + this.midis[this.midis_lv.SelectedIndices[0]].Pointer.ToString("x"), this.checkBoxLoop.Checked, Convert.ToUInt32(this.LoopPoint_tb.Text), this.checkBoxUseRepeaters.Checked)) { int num1 = (int)MessageBox.Show("Failure"); } else { this.updatedMidis.Add(this.midis[this.midis_lv.SelectedIndices[0]].Pointer); int num2 = (int)MessageBox.Show("Midi Converted, Rom will be updated when the form is closed"); } } catch (Exception ex) { int num = (int)MessageBox.Show("Could not import Midi " + ex.ToString()); } }