private void buttonClear_Click(object sender, EventArgs e) { foreach (RenderWareModelFile r in BSPStream) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } BSPStream.Clear(); listBoxLevelModels.Items.Clear(); }
private void buttonRemove_Click(object sender, EventArgs e) { for (int i = 0; i < BSPStream.Count; i++) { if (listBoxLevelModels.SelectedIndices.Contains(i)) { foreach (SharpMesh mesh in BSPStream[i].meshList) { mesh.Dispose(); } BSPStream.RemoveAt(i); listBoxLevelModels.Items.RemoveAt(i); i -= 1; } } InitBSPList(); }
private void buttonImport_Click(object sender, EventArgs e) { using (OpenFileDialog a = new OpenFileDialog() { Filter = "All supported types|*.dae;*.obj;*.bsp|DAE Files|*.dae|OBJ Files|*.obj|BSP Files|*.bsp|All files|*.*", Multiselect = true }) if (a.ShowDialog() == DialogResult.OK) { progressBar1.Minimum = 0; progressBar1.Value = 0; progressBar1.Step = 1; progressBar1.Maximum = a.FileNames.Count(); foreach (string i in a.FileNames) { RenderWareModelFile file = new RenderWareModelFile(Path.GetFileNameWithoutExtension(i) + ".BSP"); file.SetChunkNumberAndName(); if (Path.GetExtension(i).ToLower() == ".obj") { file.SetForRendering(CreateBSPFile(i, ReadOBJFile(i, false)), null); } else if (Path.GetExtension(i).ToLower() == ".dae") { file.SetForRendering(CreateBSPFile(i, ConvertDataFromDAEObject(ReadDAEFile(i), false)), null); } else if (new string[] { ".bsp", ".rg1", ".rp2", ".rx1" }.Contains(Path.GetExtension(i).ToLower())) { file.SetForRendering(ReadFileMethods.ReadRenderWareFile(i), File.ReadAllBytes(i)); } BSPStream.Add(file); listBoxLevelModels.Items.Add(file.fileName); progressBar1.PerformStep(); } progressBar1.Value = 0; } }