具体地说,我想编写Windows Media Player框架,比如WM/MediaClassPrimaryID、WM/MediaClassSecondaryID和WM/WMCollectionGroupID框架。
我使用的是PowerShell,不过C#也不错。
发布于 2012-01-17 04:51:43
我有点生疏了,但以下内容应该是基本正确的。我记得这些标记是UTF-16的,但是您可能希望获得一个现有的标记,并尝试使用Unicode编码器解码它的值,以确保这一点。
// Get or create the ID3v2 tag.
TagLib.Id3v2.Tag id3v2_tag = file.GetTag(TagLib.TagTypes.Id3v2, true);
if(id3v2_tag != null) {
// Get the private frame, create if necessary.
PrivateFrame frame = PrivateFrame.Get(id3v2_tag, "WM/MediaClassPrimaryID", true);
// Set the frame data to your value. I am 90% sure that these are encoded with UTF-16.
frame.PrivateData = System.Text.Encoding.Unicode.GetBytes(value);
}https://stackoverflow.com/questions/8793640
复制相似问题