public void SaveFromModel(List <STGenericObject> Meshes, List <STGenericMaterial> Materials, string FileName, List <STGenericTexture> Textures, STSkeleton skeleton = null, List <int> NodeArray = null) { ExtractedTextures.Clear(); Scene scene = new Scene(); scene.RootNode = new Node("RootNode"); progressBar = new STProgressBar(); progressBar.Task = "Exporting Skeleton..."; progressBar.Value = 0; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); progressBar.Refresh(); SaveSkeleton(skeleton, scene.RootNode); SaveMaterials(scene, Materials, FileName, Textures); progressBar.Task = "Exporting Meshes..."; progressBar.Value = 50; SaveMeshes(scene, Meshes, skeleton, FileName, NodeArray); progressBar.Task = "Saving File..."; progressBar.Value = 80; SaveScene(FileName, scene, Meshes); progressBar.Value = 100; progressBar.Close(); progressBar.Dispose(); }
private void RepackAction(object sender, EventArgs args) { FolderSelectDialog dlg = new FolderSelectDialog(); if (dlg.ShowDialog() == DialogResult.OK) { string FolderPath = dlg.SelectedPath; STProgressBar progressBar = new STProgressBar(); progressBar.Task = "Reading Directory..."; progressBar.Value = 0; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); progressBar.Refresh(); var ProccessedFiles = TreeHelper.ReadFiles(FolderPath); progressBar.Task = "Repacking Files..."; progressBar.Refresh(); ArchiveFile.ClearFiles(); for (int i = 0; i < ProccessedFiles.Count; i++) { progressBar.Value = (i * 100) / ProccessedFiles.Count; progressBar.Task = $"Packing {ProccessedFiles[i].Item1}"; progressBar.Refresh(); ArchiveFile.AddFile(new ArchiveFileInfo() { FileName = ProccessedFiles[i].Item1, FileData = File.ReadAllBytes(ProccessedFiles[i].Item2), }); } progressBar.Close(); progressBar.Dispose(); ProccessedFiles.Clear(); GC.Collect(); FillTreeNodes(); } }