///Stores the CloudCoin.stack file as the value tied to the CloudCoinStack key. public static TagLib.Ape.Tag SetApeTagValue(TagLib.Ape.Tag ApeTag, string MyCloudCoin, string stackName) { // Get the APEv2 tag if it exists. try{ TagLib.Ape.Item currentStacks = ApeTag.GetItem("CloudCoinStack"); ApeTag.SetValue("CloudCoinStack", MyCloudCoin); ApeTag.SetValue("StackName", stackName); return(ApeTag); } catch (Exception e) { Console.Out.WriteLine("The process failed: {0}", e.ToString()); return(ApeTag); } }
public static bool UpdateTags(TagLib.File fileInfo, NameValueCollection tags, CUEToolsCodecsConfig config, bool useId3v24) { if (fileInfo is TagLib.Riff.File) { return(false); } TagLib.Ogg.XiphComment xiph = (TagLib.Ogg.XiphComment)fileInfo.GetTag(TagLib.TagTypes.Xiph); if (xiph != null) { foreach (string tag in tags.AllKeys) { xiph.SetField(tag, tags.GetValues(tag)); } return(true); } if (fileInfo is TagLib.Mpeg4.File) { var mpeg4 = (TagLib.Mpeg4.AppleTag)fileInfo.GetTag(TagLib.TagTypes.Apple, true); foreach (string tag in tags.AllKeys) { mpeg4.SetDashBox("com.apple.iTunes", tag, string.Join(";", tags.GetValues(tag))); } return(true); } if (fileInfo is TagLib.Mpeg.AudioFile || (fileInfo is TagLib.UserDefined.File && (fileInfo as TagLib.UserDefined.File).Tagger == CUEToolsTagger.ID3v2)) { var id3v2 = (TagLib.Id3v2.Tag)fileInfo.GetTag(TagLib.TagTypes.Id3v2, true); id3v2.Version = (byte)(useId3v24 ? 4 : 3); foreach (string tag in tags.AllKeys) { var frame = TagLib.Id3v2.UserTextInformationFrame.Get(id3v2, tag, true); frame.Text = tags.GetValues(tag); } 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) { asf.SetDescriptorStrings(tags.GetValues(tag), "foobar2000/" + tag); } return(true); } TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape, true); if (ape != null) { foreach (string tag in tags.AllKeys) { ape.SetValue(tag, tags.GetValues(tag)); } } return(true); }