Don't crash when trying to write AR tags to WMA file

This commit is contained in:
Grigory Chudov
2013-03-26 23:13:40 -04:00
parent b6132b894c
commit 6066e226c6

View File

@@ -38,9 +38,20 @@ namespace CUETools.Processor
}
return true;
}
if (fileInfo is TagLib.Asf.File)
{
var asf = (TagLib.Asf.Tag)fileInfo.GetTag(TagLib.TagTypes.Asf, true);
foreach (string tag in tags.AllKeys)
if (!IsKnownXiphTag(tag))
asf.SetDescriptorString(tag, tags.GetValues(tag));
return true;
}
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape, true);
foreach (string tag in tags.AllKeys)
ape.SetValue(XiphTagNameToApe(tag), tags.GetValues(tag));
if (ape != null)
{
foreach (string tag in tags.AllKeys)
ape.SetValue(XiphTagNameToApe(tag), tags.GetValues(tag));
}
return true;
}
@@ -112,6 +123,13 @@ namespace CUETools.Processor
return tag;
}
public static bool IsKnownXiphTag(string tag)
{
return tag.ToUpper() == "DATE" ||
tag.ToUpper() == "TRACKNUMBER" ||
tag.ToUpper() == "DISCNUMBER";
}
public static string XiphTagNameToApe(string tag)
{
if (tag.ToUpper() == "DATE")