I got this cryptic error the first time I tried to use File.Create:
An exception of type 'TagLib.UnsupportedFormatException' occurred in TagLib.Portable.dll but was not handled in user code
Additional information: streamname (taglib/)
I'm not really sure why we ask for a stream name (other than guessing a mimetype), but it would be great if this behavior was documented somewhere or the error was more explicit.
I'm thinking something like the following could work:
if(index >= 1 && index < abstraction.Name.Length)
ext = abstraction.Name.Substring (index,
abstraction.Name.Length - index);
if (string.IsNullOrWhiteSpace(ext))
throw new UnsupportedFormatException (
String.Format (
CultureInfo.InvariantCulture,
"If a mimetype is not specified, then the IFileAbstraction name should have a file extension"));
mimetype = "taglib/" + ext.ToLower();
I got this cryptic error the first time I tried to use
File.Create
:I had to dig a little bit until I found that TagLib requires me to add an extension to the stream name if the mimetype is missing (https://github.com/timheuer/taglib-sharp-portable/blob/master/src/TagLib.Shared/TagLib/File.cs#L1264).
I'm not really sure why we ask for a stream name (other than guessing a mimetype), but it would be great if this behavior was documented somewhere or the error was more explicit.
I'm thinking something like the following could work:
Thanks!