public static string MessageFromError(AudioFileReaderErrors error) { switch (error) { default: Debug.Assert(false); throw new InvalidOperationException(); case AudioFileReaderErrors.Success: Debug.Assert(false); throw new InvalidOperationException(); case AudioFileReaderErrors.UnrecognizedFileFormat: return("The format of file content is not recognized."); case AudioFileReaderErrors.UnsupportedVariant: return("The file contains valid audio data but uses file format features that are not supported."); case AudioFileReaderErrors.UnsupportedNumberOfChannels: return("Only files with 1 or 2 channels can be imported."); case AudioFileReaderErrors.NotUncompressedPCM: return("The audio data is in a format other than uncompressed PCM. Only uncompressed PCM audio data is supported."); case AudioFileReaderErrors.UnsupportedNumberOfBits: return("Only 8, 16, or 24 bit files can be imported."); case AudioFileReaderErrors.InvalidData: return("The file contains invalid data."); case AudioFileReaderErrors.Truncated: return("The file is shorter than the header indicates it should be."); case AudioFileReaderErrors.OutOfMemory: return("There is not enough memory available to load the file."); } }
public AudioFileReaderException(AudioFileReaderErrors error) { this.error = error; }