private void ExportAllSpritesInFolder(string exportToFolder)
{
try
{
foreach (Sprite sprite in _currentFolder.Sprites)
{
Bitmap bmp = Factory.NativeProxy.GetBitmapForSprite(sprite.Number, sprite.Width, sprite.Height);
if ((sprite.ColorDepth < 32) && (!sprite.AlphaChannel))
{
bmp.Save(string.Format("{0}{1}spr{2:00000}.bmp", exportToFolder, Path.DirectorySeparatorChar, sprite.Number), ImageFormat.Bmp);
}
else
{
// export 32-bit images as PNG so no alpha channel is lost
bmp.Save(string.Format("{0}{1}spr{2:00000}.png", exportToFolder, Path.DirectorySeparatorChar, sprite.Number), ImageFormat.Png);
}
bmp.Dispose();
}
Factory.GUIController.ShowMessage("Sprites exported successfully.", MessageBoxIcon.Information);
}
catch (Exception ex)
{
Factory.GUIController.ShowMessage("There was an error exporting the files. The error message was: '" + ex.Message + "'. Please try again", MessageBoxIcon.Warning);
}
}