private void ImportButton_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } if (AddressList.SelectedIndex <= 0) { return; } if (!this.InputFormRef.CheckWriteProtectionID00()) { return; } string filename; if (ImageFormRef.GetDragFilePath(out filename)) { } else { string title = R._("インポートする音楽ファイルを選択してください"); string filter = R._("sound|*.s;*.wav;*.mid;*.midi;*.instrument|s|*.s|midi|*.mid;*.midi|wav|*.wav|MusicalInstrument|*.instrument|All files|*"); OpenFileDialog open = new OpenFileDialog(); open.Title = title; open.Filter = filter; Program.LastSelectedFilename.Load(this, "", open); DialogResult dr = open.ShowDialog(); if (dr != DialogResult.OK) { return; } if (!U.CanReadFileRetry(open)) { return; } Program.LastSelectedFilename.Save(this, "", open); filename = open.FileNames[0]; } uint songtable_address = InputFormRef.BaseAddress + (InputFormRef.BlockSize * (uint)AddressList.SelectedIndex); string error = ""; string ext = U.GetFilenameExt(filename); if (ext == ".WAV" || ext == ".WAVE") { SongTrackImportWaveForm f = (SongTrackImportWaveForm)InputFormRef.JumpFormLow <SongTrackImportWaveForm>(); f.Init(filename); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { f.Dettach(); return; } error = SongUtil.ImportWave(f.GetFilename(), songtable_address, f.UseLoop()); f.Dettach(); } else if (ext == ".MID" || ext == ".MIDI") { //楽器セットとオプションを選択してもらう. SongTrackImportMidiForm f = (SongTrackImportMidiForm)InputFormRef.JumpFormLow <SongTrackImportMidiForm>(); f.Init((uint)P4.Value); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return; } //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { if (f.GetUseMID2AGB() == SongTrackImportMidiForm.ImportMethod.FEBuilderGBA) {//FEBuilderGBAでimport error = SongUtil.ImportMidiFile(filename, songtable_address , f.GetInstrumentAddr() , f.GetIgnoreMOD() , f.GetIgnoreBEND() , f.GetIgnoreLFOS() , f.GetIgnoreHEAD() , f.GetIgnoreBACK() ); } else {//mid2agbでimport error = SongUtil.ImportMidiFileMID2AGB(filename, songtable_address , f.GetInstrumentAddr() , f.GetMID2AGB_V() , f.GetMID2AGB_R() , f.GetIgnoreMOD() , f.GetIgnoreBEND() , f.GetIgnoreLFOS() ); } } } else if (ext == ".INSTRUMENT") { //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { error = SongUtil.ImportInstrument(filename, songtable_address); } } else { //楽器セットを選択してもらう. SongTrackImportSelectInstrumentForm f = (SongTrackImportSelectInstrumentForm)InputFormRef.JumpFormLow <SongTrackImportSelectInstrumentForm>(); f.Init((uint)P4.Value); DialogResult dr = f.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return; } //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { error = SongUtil.ImportS(filename, songtable_address, f.GetInstrumentAddr()); } } if (error != "") { R.ShowStopError(error); return; } int selectedIndex = AddressList.SelectedIndex; ReloadListButton.PerformClick(); AddressList.SelectedIndex = selectedIndex; SongTableForm.ReloadList(); InputFormRef.ShowWriteNotifyAnimation(this, 0); }