public void Start(TFXFile tfx, byte[] sampledata, int subsong) { if (!File.Exists(playerPath)) { throw new Exception($"tfmx player '{playerPath}' not found"); } if (started) { throw new Exception("already started"); } started = true; var tmp = Path.GetTempFileName(); var tfxpath = Path.ChangeExtension(tmp, ".tfx"); var sampath = Path.ChangeExtension(tmp, ".sam"); tfx.Save(tfxpath); File.WriteAllBytes(sampath, sampledata); var sui = new ProcessStartInfo { FileName = playerPath, Arguments = (subsong != 0 ? "-p " + subsong : "") + " -b 1 " + tfxpath, WindowStyle = ProcessWindowStyle.Minimized }; process = Process.Start(sui); }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { var sfd = new SaveFileDialog { Filter = "TFX module|*.TFX" }; if (sfd.ShowDialog() == DialogResult.OK) { tfx.Save(sfd.FileName); File.WriteAllBytes(Path.ChangeExtension(sfd.FileName, ".sam"), sampledata); } }