具体来说,我想编写 Windows Media Player 框架,例如WM/MediaClassPrimaryID
和WM/MediaClassSecondaryID
框架WM/WMCollectionGroupID
。
我正在使用 PowerShell,但 C# 也会很好。
具体来说,我想编写 Windows Media Player 框架,例如WM/MediaClassPrimaryID
和WM/MediaClassSecondaryID
框架WM/WMCollectionGroupID
。
我正在使用 PowerShell,但 C# 也会很好。
我有点生疏,但以下应该是正确的。我记得这些标签是 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);
}