Пример #1
0
        void ExportGBAWave(NumericUpDown addrNumObj, string fingerPrint)
        {
            string title  = R._("保存するファイル名を選択してください");
            string filter = R._("wav|*.wav|All files|*");

            string songname = "instrument_" + U.ToHexString(AddressList.SelectedIndex) + "_" + fingerPrint;
            uint   addr     = (uint)addrNumObj.Value;

            addr = U.toOffset(addr);

            SaveFileDialog save = new SaveFileDialog();

            save.Title        = title;
            save.Filter       = filter;
            save.AddExtension = true;
            Program.LastSelectedFilename.Load(this, "", save, songname);

            DialogResult dr = save.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }
            if (save.FileNames.Length <= 0 || !U.CanWriteFileRetry(save.FileNames[0]))
            {
                return;
            }
            Program.LastSelectedFilename.Save(this, "", save);
            string filename = save.FileNames[0];


            if (!U.isSafetyOffset(addr))
            {
                return;
            }

            byte[] wave = SongUtil.byteToWav(Program.ROM.Data, addr);
            U.WriteAllBytes(filename, wave);

            U.SelectFileByExplorer(filename);
        }