diff --git a/ZSpriteTools/ZSpriteToolForm.cs b/ZSpriteTools/ZSpriteToolForm.cs index 781e360..dc35eaa 100644 --- a/ZSpriteTools/ZSpriteToolForm.cs +++ b/ZSpriteTools/ZSpriteToolForm.cs @@ -1120,18 +1120,27 @@ private void batchConvertToolStripMenuItem_Click(object sender, EventArgs e) foreach(var file in files) { - var destFilename = Path.Combine(destinationFolder, Path.GetFileNameWithoutExtension(file) + ".zspr"); + try + { + var destFilename = Path.Combine(destinationFolder, Path.GetFileNameWithoutExtension(file) + ".zspr"); - var spriteFile = File.ReadAllBytes(file); - var loadedSprite = new SpriteLibrary.PlayerSprite(spriteFile); - if (loadedSprite.Version == 0) + var spriteFile = File.ReadAllBytes(file); + var loadedSprite = new SpriteLibrary.PlayerSprite(spriteFile); + if (loadedSprite.Version == 0) + { + loadedSprite.DisplayText = Path.GetFileNameWithoutExtension(file); + } + + var spriteData = loadedSprite.ToByteArray(); + FileUtilities.WriteAllBytes(destFilename, spriteData); + } + catch(Exception ex) { - loadedSprite.DisplayText = Path.GetFileNameWithoutExtension(file); + MessageBox.Show($"Failed to convert file {file}. {ex.ToString()}."); } - - var spriteData = loadedSprite.ToByteArray(); - FileUtilities.WriteAllBytes(destFilename, spriteData); } + + MessageBox.Show("Done converting sprites"); } private void animationComboBox_SelectedIndexChanged(object sender, EventArgs e)