public void Write(FileWriter writer, List <FileEntry> Files) { STProgressBar progressBar = new STProgressBar(); progressBar.Task = "Writing File Tree..."; progressBar.Value = 0; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); progressBar.Refresh(); long pos = writer.Position; //reserve space for (int i = 0; i < Files.Count; i++) { writer.Write(uint.MaxValue); writer.Write(uint.MaxValue); writer.Write(uint.MaxValue); } for (int i = 0; i < Files.Count; i++) { writer.WriteUint32Offset(pos + (i * 12)); writer.Write(Files[i].FileName); } for (int i = 0; i < Files.Count; i++) { progressBar.Value = (i * 100) / Files.Count; progressBar.Task = $"Packing {Files[i].FileName}"; progressBar.Refresh(); writer.WriteUint32Offset(pos + (i * 12) + 4); //More simple to get the size this way than getting file data over and over //Also we don't need to store the bytes in memory // long _fileStart = writer.Position; writer.Write(Files[i].FileData); // long _fileEnd = writer.Position; /* using (writer.TemporarySeek(pos + (i * 12) + 8, System.IO.SeekOrigin.Begin)) * { * writer.Write((uint)(_fileEnd - _fileStart)); * }*/ } progressBar.Close(); progressBar.Dispose(); }
private void ApplyEdit(Image Image) { STProgressBar progressBar = new STProgressBar(); progressBar.Task = "Applying Edits"; progressBar.Value = 0; progressBar.IsConstant = true; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); progressBar.Refresh(); ActiveTexture.Width = (uint)Image.Width; ActiveTexture.Height = (uint)Image.Height; ActiveTexture.SetImageData(new Bitmap(Image), CurArrayDisplayLevel); CurMipDisplayLevel = 0; HasBeenEdited = false; if (ActiveTexture.EditedImages != null && ActiveTexture.EditedImages[CurArrayDisplayLevel] != null) { if (ActiveTexture.EditedImages[CurArrayDisplayLevel].bitmap != null) { ActiveTexture.EditedImages[CurArrayDisplayLevel].bitmap.Dispose(); } ActiveTexture.EditedImages[CurArrayDisplayLevel] = null; } progressBar.Value = 100; UpdateTextureReplace(new Bitmap(Image)); }
private void ApplyEdit() { STProgressBar progressBar = new STProgressBar(); progressBar.Task = "Applying Edits"; progressBar.Value = 0; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); progressBar.Refresh(); Image Image = pictureBoxCustom1.Image; if (Image != null) { ActiveTexture.Width = (uint)Image.Width; ActiveTexture.Height = (uint)Image.Height; ActiveTexture.SetImageData(new Bitmap(Image), CurArrayDisplayLevel); CurMipDisplayLevel = 0; HasBeenEdited = false; } ActiveTexture.EditedImages[CurArrayDisplayLevel].bitmap.Dispose(); ActiveTexture.EditedImages[CurArrayDisplayLevel] = null; progressBar.Value = 100; }
private void UpdateProgressbar(STProgressBar progressBar, int length, int maxLength) { if (progressBar.InvokeRequired) { progressBar.Invoke((MethodInvoker) delegate { progressBar.Task = $"Searching characters {length} of max {maxLength}"; progressBar.Value = ((length * 100) / maxLength); progressBar.Refresh(); }); } }
private void ExportAll(string Folder, STProgressBar progressBar) { int Curfile = 0; foreach (FileEntry asst in Nodes) { int value = (Curfile * 100) / beaFile.FileList.Count; progressBar.Value = value; progressBar.Refresh(); try { if (!String.IsNullOrWhiteSpace(Path.GetDirectoryName($"{Folder}/{beaFile.Name}/{asst.FullName}"))) { if (!File.Exists(asst.FullName)) { if (!Directory.Exists($"{Folder}/{beaFile.Name}/{asst.FullName}")) { Directory.CreateDirectory(Path.GetDirectoryName($"{Folder}/{beaFile.Name}/{asst.FullName}")); } } } File.WriteAllBytes($"{Folder}/{beaFile.Name}/{asst.FullName}", GetASSTData(asst)); } catch { } Curfile++; if (value == 99) { value = 100; } progressBar.Value = value; progressBar.Refresh(); } }
private void ExportAll(object sender, EventArgs args) { FolderSelectDialog fsd = new FolderSelectDialog(); if (fsd.ShowDialog() == DialogResult.OK) { progressBar = new STProgressBar(); progressBar.Task = "Extracing Files..."; progressBar.Refresh(); progressBar.Value = 0; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); ExportAll(fsd.SelectedPath, progressBar); } }
public void UpdateVertexData() { if (!Runtime.OpenTKInitialized) { return; } STProgressBar progressBar = new STProgressBar(); progressBar.Task = "Updating Vertex Data..."; progressBar.Value = 0; progressBar.StartPosition = FormStartPosition.CenterScreen; progressBar.Show(); progressBar.Refresh(); Loaded = false; DisplayVertex[] Vertices; int[] Faces; int poffset = 0; int voffset = 0; List <DisplayVertex> Vs = new List <DisplayVertex>(); List <int> Ds = new List <int>(); int TotalShapeCount = models.Sum(b => b.shapes.Count); int curShape = 0; int value = 0; foreach (FMDL mdl in models) { foreach (FSHP m in mdl.shapes) { progressBar.Task = "Updating Shape... " + m.Text; value = ((curShape * 100) / TotalShapeCount); progressBar.Value = value; progressBar.Refresh(); m.Offset = poffset * 4; List <DisplayVertex> pv = m.CreateDisplayVertices(); Vs.AddRange(pv); for (int i = 0; i < m.lodMeshes[m.DisplayLODIndex].displayFaceSize; i++) { Ds.Add(m.display[i] + voffset); } poffset += m.lodMeshes[m.DisplayLODIndex].displayFaceSize; voffset += pv.Count; curShape++; } } progressBar.Value = 100; progressBar.Close(); // Binds Vertices = Vs.ToArray(); Faces = Ds.ToArray(); // Bind only once! GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position); GL.BufferData <DisplayVertex>(BufferTarget.ArrayBuffer, (IntPtr)(Vertices.Length * DisplayVertex.Size), Vertices, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo_elements); GL.BufferData <int>(BufferTarget.ElementArrayBuffer, (IntPtr)(Faces.Length * sizeof(int)), Faces, BufferUsageHint.StaticDraw); LibraryGUI.Instance.UpdateViewport(); Loaded = true; }