private string MimeTypeForFile(string filePath)
{
switch (Path.GetExtension(filePath).ToUpperInvariant())
{
case ".MP3":
return "audio/mpeg";
case ".M4A":
case ".MP4A":
return "audio/mp4";
case ".OGA":
case ".OGG":
case ".OPUS":
return "audio/ogg";
case ".FLAC":
return "audio/flac";
default:
throw new NotImplementedException("MIME type not known for file extension " + Path.GetExtension(filePath));
}
}