From 71e8e209878507e37f7ccbeecac9416e92474897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 13 Jan 2016 12:02:12 +0100 Subject: [PATCH] Report unknown codecs when failing --- OpenRA.Game/FileFormats/WavLoader.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/FileFormats/WavLoader.cs b/OpenRA.Game/FileFormats/WavLoader.cs index 297c733ca8..abba87daba 100644 --- a/OpenRA.Game/FileFormats/WavLoader.cs +++ b/OpenRA.Game/FileFormats/WavLoader.cs @@ -43,7 +43,6 @@ namespace OpenRA.FileFormats Format = s.ReadASCII(4); if (Format != "WAVE") return false; - while (s.Position < s.Length) { if ((s.Position & 1) == 1) @@ -57,8 +56,8 @@ namespace OpenRA.FileFormats AudioFormat = s.ReadInt16(); Type = (WaveType)AudioFormat; - if (Type != WaveType.Pcm && Type != WaveType.ImaAdpcm) - throw new NotSupportedException("Compression type is not supported."); + if (!Enum.IsDefined(typeof(WaveType), Type)) + throw new NotSupportedException("Compression type {0} is not supported.".F(AudioFormat)); Channels = s.ReadInt16(); SampleRate = s.ReadInt32();