问题
I'm new using TagLib sharp. I'm trying to save ONLY an specific version of the tag inside the file. Everytime I save the tag both ID3v1 and ID3v2 get created. Is there a way to stop this from happening? Can I choose which one I want to save. The save function doesn't take any arguments, so any ideas?
回答1:
These tags are added for convenience when the File
object is created. The correct way to remove newly created tags is to perform the following command before calling Save
:
file.RemoveTags (file.TagTypes & ~file.TagTypesOnDisk);
Source
回答2:
Thank you Brian.
The C# "& ~" syntax is not that obvious for VB.NET users:
file.RemoveTags(file.TagTypes And Not file.TagTypesOnDisk)
@user1098787:
If you want to write a specific id3v2 version, you can use this commands
TagLib.Id3v2.Tag.DefaultVersion = 3
TagLib.Id3v2.Tag.ForceDefaultVersion = True
Possible values for DefaultVersion are 2 (id3v2.2), 3 (id3v2.3) or 4 (id3v2.4)
来源:https://stackoverflow.com/questions/8513182/taglib-sharp-saving-only-id3v2