Skip to content

Commit

Permalink
Invalid audio files
Browse files Browse the repository at this point in the history
- Added a popup when an invalid .wav file is supplied instead of a hard crash.
  • Loading branch information
BJDubb committed May 10, 2023
1 parent 7d5797d commit dcfce85
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion SirenSharp/SirenBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,16 @@ public static void GenerateFiveMResource(string folderPath, string resourceName,
var doc = new XmlDocument();
doc.LoadXml(datXml);

byte[] data = XmlMeta.GetData(doc, mformat, ""); // rel file data
byte[] data = new byte[] { 0x0 };

try
{
data = XmlMeta.GetData(doc, mformat, ""); // rel file data
}
catch (Exception ex)
{
MessageBox.Show($"One of the audio files provided was invalid.\n\n {ex.Message}\n {ex.StackTrace}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

File.WriteAllBytes(Path.Combine(dataDir.FullName, "custom_sounds.dat54.rel"), data); // write rel to disk

Expand Down

0 comments on commit dcfce85

Please sign in to comment.