//Everything else. #region everythingElse //New private void newBetaToolStripMenuItem_Click(object sender, EventArgs e) { file = new swarFile(); file.data = new swarFile.swarData[0]; file.fixOffsets(); updateNodes(); }
//Open private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog f = new OpenFileDialog(); f.Filter = "Swarchive|*.swar"; f.Title = "Import the file"; f.ShowDialog(); if (f.FileName != "") { file = new swarFile(); file.load(File.ReadAllBytes(f.FileName)); file.fixOffsets(); updateNodes(); } }
//Sound menu. #region soundMenu //Add above. private void addAbove_Click(object sender, EventArgs e) { OpenFileDialog f = new OpenFileDialog(); f.Filter = "Swav File|*.swav|Wave|*.wav"; f.Title = "Import the file"; f.ShowDialog(); if (f.FileName != "") { if (f.FilterIndex == 1) { List <byte[]> files = file.data[0].files.ToList(); files.Insert(tree.SelectedNode.Index, File.ReadAllBytes(f.FileName)); file.data[0].files = files.ToArray(); file.fixOffsets(); updateNodes(); } else { //Make new swav. RIFF r = new RIFF(); r.load(File.ReadAllBytes(f.FileName)); List <byte[]> files = file.data[0].files.ToList(); files.Insert(tree.SelectedNode.Index, r.toSwav().toBytes()); file.data[0].files = files.ToArray(); file.fixOffsets(); updateNodes(); } } }