1
0
mirror of synced 2024-11-27 17:00:50 +01:00

Fix exporting multiple arrays

This commit is contained in:
KillzXGaming 2023-11-05 14:13:26 -05:00
parent d50379879f
commit 14fa40193a

View File

@ -969,34 +969,27 @@ namespace Toolbox.Library
progressBar.Show(); progressBar.Show();
progressBar.Refresh(); progressBar.Refresh();
if (ArrayCount > 1 && !ExportSurfaceLevel && false) if (ArrayCount > 1 && !ExportSurfaceLevel)
{ {
progressBar.Task = "Select dialog option... "; string ext = Path.GetExtension(FileName);
var result = MessageBox.Show("Multiple image surfaces found! Would you like to export them all?", "Image Exporter", int index = FileName.LastIndexOf('.');
MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); string name = index == -1 ? FileName : FileName.Substring(0, index);
if (result == DialogResult.Yes)
for (int i = 0; i < ArrayCount; i++)
{ {
string ext = Path.GetExtension(FileName); progressBar.Task = $"Decoding Surface [{i}] for image {Text}... ";
progressBar.Value = (i * 100) / (int)ArrayCount;
progressBar.Refresh();
int index = FileName.LastIndexOf('.'); Bitmap arrayBitMap = GetBitmap(i, 0);
string name = index == -1 ? FileName : FileName.Substring(0, index); arrayBitMap.Save($"{name}_Slice_{i}_{ext}");
arrayBitMap.Dispose();
for (int i = 0; i < ArrayCount; i++)
{
progressBar.Task = $"Decoding Surface [{i}] for image {Text}... ";
progressBar.Value = (i * 100) / (int)ArrayCount;
progressBar.Refresh();
Bitmap arrayBitMap = GetBitmap(i, 0);
arrayBitMap.Save($"{name}_Slice_{i}_{ext}");
arrayBitMap.Dispose();
}
progressBar.Value = 100;
progressBar.Close();
return;
} }
progressBar.Value = 100;
progressBar.Close();
return;
} }
progressBar.Task = $"Decoding image {Text}... "; progressBar.Task = $"Decoding image {Text}... ";