private void ImportButton_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } if (!this.InputFormRef.CheckWriteProtectionID00()) { return; } if (AddressList.SelectedIndex < 0) { 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 song_id = (uint)AddressList.SelectedIndex; uint songtable_address = InputFormRef.BaseAddress + (InputFormRef.BlockSize * song_id); 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.GetFromFilename()); f.Dettach(); } else if (ext == ".MID" || ext == ".MIDI") { HowDoYouLikePatchForm.CheckAndShowPopupDialog(HowDoYouLikePatchForm.TYPE.NIMAP_By_SongTrack); HowDoYouLikePatchForm.CheckAndShowPopupDialog(HowDoYouLikePatchForm.TYPE.DrumFix_By_SongTrack); //楽器セットとオプションを選択してもらう. 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.UseMidfix4agb()) { filename = SongUtil.ConvertMidfix4agb(filename); if (filename == "") { return; } } 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.GetMIDI2AGB_MODSC() , 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 { HowDoYouLikePatchForm.CheckAndShowPopupDialog(HowDoYouLikePatchForm.TYPE.NIMAP_By_SongTrack); HowDoYouLikePatchForm.CheckAndShowPopupDialog(HowDoYouLikePatchForm.TYPE.DrumFix_By_SongTrack); //楽器セットを選択してもらう. 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; } R.Notify("{0}, SongID: {1} ,Ext: {2} ,Filename: {3}", this.Text, song_id, ext, filename); int selectedIndex = AddressList.SelectedIndex; ReloadListButton.PerformClick(); AddressList.SelectedIndex = selectedIndex; SongTableForm.ReloadList(); InputFormRef.ShowWriteNotifyAnimation(this, 0); }