private void rSTMToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog() { Filter = SupportedFilesHandler.GetCompleteFilter("wav") }) if (ofd.ShowDialog() == DialogResult.OK) { RSTMNode r = new RSTMNode() { _fileIndex = _targetNode.Files.Count }; using (BrstmConverterDialog dlg = new BrstmConverterDialog()) { dlg.AudioSource = ofd.FileName; if (dlg.ShowDialog(this) == DialogResult.OK) { r.Name = String.Format("[{0}] {1}", _targetNode.Files.Count, Path.GetFileNameWithoutExtension(dlg.AudioSource)); r.ReplaceRaw(dlg.AudioData); } } r._parent = _targetNode; _targetNode.Files.Add(r); r.SignalPropertyChange(); Update(lstSets); } }
/// <summary> /// This method can handle WAV files, converting them to BRSTM using BrawlLib's converter. /// </summary> /// <param name="src">a BRSTM or WAV file</param> /// <param name="dest">the output BRSTM path</param> public static void copyBrstm(string src, string dest) { if (src.EndsWith(".brstm")) { FileOperations.Copy(src, dest, deleteFirst: true); } else { BrstmConverterDialog bcd = new BrstmConverterDialog(); bcd.AudioSource = src; if (bcd.ShowDialog() == DialogResult.OK) { // Make a temporary node to put the data in, and export it. // This avoids the need to use pointers directly. RSTMNode tmpNode = new RSTMNode(); tmpNode.ReplaceRaw(bcd.AudioData); tmpNode.Export(dest); tmpNode.Dispose(); } bcd.Dispose(); } }