diff --git a/taglib-sharp/src/AssemblyInfo.cs b/taglib-sharp/src/AssemblyInfo.cs index e1551a2..b0a86b2 100644 --- a/taglib-sharp/src/AssemblyInfo.cs +++ b/taglib-sharp/src/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; [assembly:AssemblyCopyright ("Copyright (c) 2006-2007 Brian Nickel. Copyright (c) 2009-2010 Other contributors")] [assembly:AssemblyCompany ("")] [assembly:AssemblyDelaySign(false)] -[assembly:AssemblyKeyFile("taglib-sharp.snk")] -[assembly:CLSCompliant(false)] +[assembly:CLSCompliant(false)] +[assembly: ComVisibleAttribute(false)] diff --git a/taglib-sharp/src/TagLib/Ape/Tag.cs b/taglib-sharp/src/TagLib/Ape/Tag.cs index 9865ca4..b988096 100644 --- a/taglib-sharp/src/TagLib/Ape/Tag.cs +++ b/taglib-sharp/src/TagLib/Ape/Tag.cs @@ -1418,6 +1418,75 @@ namespace TagLib.Ape { set {SetValue ("RELEASECOUNTRY", value);} } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "RELEASE DATE" item. + /// + public override string ReleaseDate { + get {return GetItemAsString ("RELEASE DATE") ?? GetItemAsString ("RELEASETIME");} + set {SetValue ("RELEASE DATE", value);} + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "PUBLISHER" field. + /// + public override string Publisher + { + get { return GetItemAsString ("PUBLISHER") ?? GetItemAsString ("LABEL"); } + set { SetValue ("PUBLISHER", value); } + } + + /// + /// Gets and sets the CatalogNo of the media represented by + /// the current instance. + /// + /// + /// A containing the catalog number of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "LABELNO" field. + /// + public override string CatalogNo { + get { return GetItemAsString ("CATALOG") ?? GetItemAsString ("CATALOGNUMBER") ?? GetItemAsString ("LABELNO"); } + set { SetValue ("CATALOG", value); } + } + + /// + /// Gets and sets the DiscSubtitle of the media represented by + /// the current instance. + /// + /// + /// A containing the subtitle of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "DISCSUBTITLE" field. + /// + public override string DiscSubtitle { + get { return GetItemAsString ("DISCSUBTITLE"); } + set { SetValue ("DISCSUBTITLE", value); } + } + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/Asf/Tag.cs b/taglib-sharp/src/TagLib/Asf/Tag.cs index 9b44a2b..eca274b 100644 --- a/taglib-sharp/src/TagLib/Asf/Tag.cs +++ b/taglib-sharp/src/TagLib/Asf/Tag.cs @@ -1309,6 +1309,41 @@ namespace TagLib.Asf { set {SetDescriptorString (value, "MusicBrainz/Album Release Country");} } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "ReleaseDate" field. + /// + public override string ReleaseDate { + get { return GetDescriptorString("ReleaseDate"); } + set { SetDescriptorString(value, "ReleaseDate"); } + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "PUBLISHER" field. + /// + public override string Publisher + { + get { return GetDescriptorString("WM/Publisher"); } + set { SetDescriptorString(value, "WM/Publisher"); } + } + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/CombinedTag.cs b/taglib-sharp/src/TagLib/CombinedTag.cs index 9cda5ed..1e76e9b 100644 --- a/taglib-sharp/src/TagLib/CombinedTag.cs +++ b/taglib-sharp/src/TagLib/CombinedTag.cs @@ -1442,6 +1442,163 @@ namespace TagLib { } } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child tags are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in each child + /// tag. + /// + /// + public override string ReleaseDate { + get { + foreach (Tag tag in tags) { + if (tag == null) + continue; + + string value = tag.ReleaseDate; + + if (value != null) + return value; + } + + return null; + } + + set { + foreach (Tag tag in tags) + if (tag != null) + tag.ReleaseDate = value; + } + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child tags are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in each child + /// tag. + /// + /// + public override string Publisher + { + get { + foreach (Tag tag in tags) { + if (tag == null) + continue; + + string value = tag.Publisher; + + if (value != null) + return value; + } + + return null; + } + + set { + foreach (Tag tag in tags) + if (tag != null) + tag.Publisher = value; + } + } + + /// + /// Gets and sets the CatalogNo of the media represented by + /// the current instance. + /// + /// + /// A containing the catalog number of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child tags are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in each child + /// tag. + /// + /// + public override string CatalogNo { + get { + foreach (Tag tag in tags) { + if (tag == null) + continue; + + string value = tag.CatalogNo; + + if (value != null) + return value; + } + + return null; + } + + set { + foreach (Tag tag in tags) + if (tag != null) + tag.CatalogNo = value; + } + } + + /// + /// Gets and sets the DiscSubtitle of the media represented by + /// the current instance. + /// + /// + /// A containing the subtitle of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child tags are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in each child + /// tag. + /// + /// + public override string DiscSubtitle { + get { + foreach (Tag tag in tags) { + if (tag == null) + continue; + + string value = tag.DiscSubtitle; + + if (value != null) + return value; + } + + return null; + } + + set { + foreach (Tag tag in tags) + if (tag != null) + tag.DiscSubtitle = value; + } + } + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/Id3v2/FrameTypes.cs b/taglib-sharp/src/TagLib/Id3v2/FrameTypes.cs index dc2acfa..6e9a04e 100644 --- a/taglib-sharp/src/TagLib/Id3v2/FrameTypes.cs +++ b/taglib-sharp/src/TagLib/Id3v2/FrameTypes.cs @@ -56,7 +56,8 @@ namespace TagLib.Id3v2 { public static readonly ReadOnlyByteVector TCOP = "TCOP"; public static readonly ReadOnlyByteVector TCMP = "TCMP"; public static readonly ReadOnlyByteVector TDRC = "TDRC"; - public static readonly ReadOnlyByteVector TDAT = "TDAT"; + public static readonly ReadOnlyByteVector TDAT = "TDAT"; + public static readonly ReadOnlyByteVector TDRL = "TDRL"; // Release Date public static readonly ReadOnlyByteVector TEXT = "TEXT"; public static readonly ReadOnlyByteVector TIT1 = "TIT1"; public static readonly ReadOnlyByteVector TIT2 = "TIT2"; @@ -67,7 +68,8 @@ namespace TagLib.Id3v2 { public static readonly ReadOnlyByteVector TPE2 = "TPE2"; public static readonly ReadOnlyByteVector TPE3 = "TPE3"; public static readonly ReadOnlyByteVector TPE4 = "TPE4"; - public static readonly ReadOnlyByteVector TPOS = "TPOS"; + public static readonly ReadOnlyByteVector TPOS = "TPOS"; + public static readonly ReadOnlyByteVector TPUB = "TPUB"; // Publisher public static readonly ReadOnlyByteVector TRCK = "TRCK"; public static readonly ReadOnlyByteVector TRDA = "TRDA"; public static readonly ReadOnlyByteVector TSIZ = "TSIZ"; @@ -75,7 +77,8 @@ namespace TagLib.Id3v2 { public static readonly ReadOnlyByteVector TSO2 = "TSO2"; // Album Artist Sort Frame public static readonly ReadOnlyByteVector TSOC = "TSOC"; // Composer Sort Frame public static readonly ReadOnlyByteVector TSOP = "TSOP"; // Performer Sort Frame - public static readonly ReadOnlyByteVector TSOT = "TSOT"; // Track Title Sort Frame + public static readonly ReadOnlyByteVector TSOT = "TSOT"; // Track Title Sort Frame + public static readonly ReadOnlyByteVector TSST = "TSST"; // Set subtitle public static readonly ReadOnlyByteVector TXXX = "TXXX"; public static readonly ReadOnlyByteVector TYER = "TYER"; public static readonly ReadOnlyByteVector UFID = "UFID"; diff --git a/taglib-sharp/src/TagLib/Id3v2/Tag.cs b/taglib-sharp/src/TagLib/Id3v2/Tag.cs index bd26e97..639fccc 100644 --- a/taglib-sharp/src/TagLib/Id3v2/Tag.cs +++ b/taglib-sharp/src/TagLib/Id3v2/Tag.cs @@ -1892,6 +1892,78 @@ namespace TagLib.Id3v2 { get {return GetUserTextAsString ("MusicBrainz Album Release Country");} set {SetUserTextAsString ("MusicBrainz Album Release Country",value);} } + + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "TDRL" text. + /// + public override string ReleaseDate { + get {return GetTextAsString (FrameType.TDRL);} + set {SetTextFrame (FrameType.TDRL, value);} + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "TPUB" text. + /// + public override string Publisher + { + get {return GetTextAsString (FrameType.TPUB);} + set {SetTextFrame (FrameType.TPUB, value);} + } + + /// + /// Gets and sets the CatalogNo of the media represented by + /// the current instance. + /// + /// + /// A containing the catalog number of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "TXXX:CATALOGNUMBER" frame. + /// http://musicbrainz.org/doc/PicardTagMapping + /// + public override string CatalogNo { + get {return GetUserTextAsString ("CATALOGNUMBER");} + set {SetUserTextAsString ("CATALOGNUMBER",value);} + } + + /// + /// Gets and sets the DiscSubtitle of the media represented by + /// the current instance. + /// + /// + /// A containing the subtitle of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This is normally a name which identifies the media + /// within a set, for example name of a CD within a boxset release. + /// + /// + public override string DiscSubtitle { + get {return GetTextAsString (FrameType.TSST);} + set {SetTextFrame (FrameType.TSST, value);} + } /// /// Gets and sets a collection of pictures associated with diff --git a/taglib-sharp/src/TagLib/Matroska/Tag.cs b/taglib-sharp/src/TagLib/Matroska/Tag.cs index 1811b95..e628614 100644 --- a/taglib-sharp/src/TagLib/Matroska/Tag.cs +++ b/taglib-sharp/src/TagLib/Matroska/Tag.cs @@ -631,6 +631,36 @@ namespace TagLib.Matroska set { } } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + public override string ReleaseDate { + get { return null; } + set { } + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + public override string Publisher + { + get { return null; } + set { } + } + + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs b/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs index 29e7e6c..ece939b 100644 --- a/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs +++ b/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs @@ -432,15 +432,20 @@ namespace TagLib.Mpeg4 { /// String specifying text for data box public void SetDashBox(string meanstring, string namestring, string datastring) { - AppleDataBox data_box = GetDashAtoms(meanstring, namestring); - - // If we did find a data_box and we have an empty datastring we should - // remove the entire dash box. - if (data_box != null && string.IsNullOrEmpty(datastring)) { - AppleAnnotationBox dash_box = GetParentDashBox(meanstring, namestring); - dash_box.ClearChildren(); - ilst_box.RemoveChild(dash_box); - return; + AppleDataBox data_box = GetDashAtoms(meanstring, namestring); + + if (string.IsNullOrEmpty(datastring)) + { + // If we did find a data_box and we have an empty datastring we should + // remove the entire dash box. + if (data_box != null) + { + AppleAnnotationBox dash_box = GetParentDashBox(meanstring, namestring); + dash_box.ClearChildren(); + ilst_box.RemoveChild(dash_box); + } + + return; } if (data_box != null) { @@ -1360,6 +1365,78 @@ namespace TagLib.Mpeg4 { set {SetDashBox("com.apple.iTunes", "MusicBrainz Album Release Country",value);} } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "dash"/"----" box type. + /// + public override string ReleaseDate { + get { return GetDashBox("com.apple.iTunes", "MusicBrainz Album Release Date"); } + set { SetDashBox("com.apple.iTunes", "MusicBrainz Album Release Date", value); } + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "dash"/"----" box type. + /// http://musicbrainz.org/doc/PicardTagMapping + /// + public override string Publisher + { + get { return GetDashBox("com.apple.iTunes", "LABEL"); } + set { SetDashBox("com.apple.iTunes", "LABEL", value); } + } + + /// + /// Gets and sets the CatalogNo of the media represented by + /// the current instance. + /// + /// + /// A containing the catalog number of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "dash"/"----" box type. + /// http://musicbrainz.org/doc/PicardTagMapping + /// + public override string CatalogNo { + get { return GetDashBox("com.apple.iTunes", "CATALOGNUMBER"); } + set { SetDashBox("com.apple.iTunes", "CATALOGNUMBER", value); } + } + + /// + /// Gets and sets the DiscSubtitle of the media represented by + /// the current instance. + /// + /// + /// A containing the subtitle of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "dash"/"----" box type. + /// http://musicbrainz.org/doc/PicardTagMapping + /// + public override string DiscSubtitle { + get { return GetDashBox("com.apple.iTunes", "DISCSUBTITLE"); } + set { SetDashBox("com.apple.iTunes", "DISCSUBTITLE", value); } + } + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/Mpeg4/BoxFactory.cs b/taglib-sharp/src/TagLib/Mpeg4/BoxFactory.cs index b28dc57..f1c42e7 100644 --- a/taglib-sharp/src/TagLib/Mpeg4/BoxFactory.cs +++ b/taglib-sharp/src/TagLib/Mpeg4/BoxFactory.cs @@ -119,7 +119,7 @@ namespace TagLib.Mpeg4 { else if (type == BoxType.Free || type == BoxType.Skip) return new IsoFreeSpaceBox (header, file, handler); - else if (type == BoxType.Mean || type == BoxType.Name) + else if ((type == BoxType.Mean || type == BoxType.Name) && header.DataSize >= 4) return new AppleAdditionalInfoBox (header, file, handler); diff --git a/taglib-sharp/src/TagLib/Ogg/Codecs/Vorbis.cs b/taglib-sharp/src/TagLib/Ogg/Codecs/Vorbis.cs index 3491d44..c38d1b5 100644 --- a/taglib-sharp/src/TagLib/Ogg/Codecs/Vorbis.cs +++ b/taglib-sharp/src/TagLib/Ogg/Codecs/Vorbis.cs @@ -185,7 +185,11 @@ namespace TagLib.Ogg.Codecs data.Add (id); data.Add (comment.Render (true)); if (packets.Count > 1 && PacketType (packets [1]) == 0x03) + { + if (data.Count < packets [1].Count) + data.Add (new ByteVector (packets [1].Count - data.Count, 0)); packets [1] = data; + } else packets.Insert (1, data); } diff --git a/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs b/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs index e7b03f9..ee68ca6 100644 --- a/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs +++ b/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs @@ -1208,6 +1208,139 @@ namespace TagLib.Ogg set {if (tags.Count > 0) tags [0].MusicBrainzReleaseCountry = value;} } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child comments are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in the first + /// comment. + /// + public override string ReleaseDate { + get { + foreach (XiphComment tag in tags) { + if (tag == null) + continue; + + string value = tag.ReleaseDate; + + if (value != null && value.Length > 0) + return value; + } + + return null; + } + set {if (tags.Count > 0) tags [0].ReleaseDate = value;} + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child comments are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in the first + /// comment. + /// + public override string Publisher + { + get { + foreach (XiphComment tag in tags) { + if (tag == null) + continue; + + string value = tag.Publisher; + + if (value != null && value.Length > 0) + return value; + } + + return null; + } + set {if (tags.Count > 0) tags [0].Publisher = value;} + } + + /// + /// Gets and sets the CatalogNo of the media represented by + /// the current instance. + /// + /// + /// A containing the catalog number of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child comments are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in the first + /// comment. + /// + public override string CatalogNo { + get { + foreach (XiphComment tag in tags) { + if (tag == null) + continue; + + string value = tag.CatalogNo; + + if (value != null && value.Length > 0) + return value; + } + + return null; + } + set {if (tags.Count > 0) tags [0].CatalogNo = value;} + } + + /// + /// Gets and sets the DiscSubtitle of the media represented by + /// the current instance. + /// + /// + /// A containing the subtitle of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// When getting the value, the child comments are looped + /// through in order and the first non- + /// and non-empty value is returned. + /// When setting the value, it is stored in the first + /// comment. + /// + public override string DiscSubtitle { + get { + foreach (XiphComment tag in tags) { + if (tag == null) + continue; + + string value = tag.DiscSubtitle; + + if (value != null && value.Length > 0) + return value; + } + + return null; + } + set {if (tags.Count > 0) tags [0].DiscSubtitle = value;} + } + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/Ogg/XiphComment.cs b/taglib-sharp/src/TagLib/Ogg/XiphComment.cs index d6259d4..cb75bde 100644 --- a/taglib-sharp/src/TagLib/Ogg/XiphComment.cs +++ b/taglib-sharp/src/TagLib/Ogg/XiphComment.cs @@ -548,7 +548,7 @@ namespace TagLib.Ogg return GetField ("ENSEMBLE"); } - set {SetField ("ALBUMARTIST", value);} + set {SetField ("ALBUM ARTIST", value);} } /// @@ -741,7 +741,8 @@ namespace TagLib.Ogg return 0; } set { - SetField ("TRACKTOTAL", TrackCount); +// SetField ("TRACKTOTAL", TrackCount); + SetField ("TOTALTRACKS", TrackCount); SetField ("TRACKNUMBER", value); } } @@ -769,6 +770,10 @@ namespace TagLib.Ogg if ((text = GetFirstField ("TRACKTOTAL")) != null && uint.TryParse (text, out value)) return value; + + if ((text = GetFirstField ("TOTALTRACKS")) != + null && uint.TryParse (text, out value)) + return value; if ((text = GetFirstField ("TRACKNUMBER")) != null && (values = text.Split ('/')) @@ -778,7 +783,8 @@ namespace TagLib.Ogg return 0; } - set {SetField ("TRACKTOTAL", value);} + //set {SetField ("TRACKTOTAL", value);} + set {SetField ("TOTALTRACKS", value);} } /// @@ -808,7 +814,8 @@ namespace TagLib.Ogg return 0; } set { - SetField ("DISCTOTAL", DiscCount); +// SetField ("DISCTOTAL", DiscCount); + SetField ("TOTALDISCS", DiscCount); SetField ("DISCNUMBER", value); } } @@ -836,6 +843,11 @@ namespace TagLib.Ogg if ((text = GetFirstField ("DISCTOTAL")) != null && uint.TryParse (text, out value)) return value; + + + if ((text = GetFirstField ("TOTALDISCS")) != null + && uint.TryParse (text, out value)) + return value; if ((text = GetFirstField ("DISCNUMBER")) != null && (values = text.Split ('/')) @@ -845,7 +857,8 @@ namespace TagLib.Ogg return 0; } - set {SetField ("DISCTOTAL", value);} +// set {SetField ("DISCTOTAL", value);} + set {SetField ("TOTALDISCS", value);} } /// @@ -1110,6 +1123,75 @@ namespace TagLib.Ogg set {SetField ("RELEASECOUNTRY", value);} } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "RELEASE DATE" field. + /// + public override string ReleaseDate { + get { return GetFirstField("RELEASE DATE") ?? GetFirstField("RELEASETIME"); } + set { SetField("RELEASE DATE", value); } + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "PUBLISHER" field. + /// + public override string Publisher + { + get { return GetFirstField("PUBLISHER") ?? GetFirstField("ORGANIZATION") ?? GetFirstField("LABEL"); } + set { SetField("PUBLISHER", value); } + } + + /// + /// Gets and sets the CatalogNo of the media represented by + /// the current instance. + /// + /// + /// A containing the catalog number of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "LABELNO" field. + /// + public override string CatalogNo { + get { return GetFirstField("LABELNO") ?? GetFirstField("CATALOGNUMBER"); } + set { SetField("LABELNO", value); } + } + + /// + /// Gets and sets the DiscSubtitle of the media represented by + /// the current instance. + /// + /// + /// A containing the subtitle of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This property is implemented using the "DISCSUBTITLE" field. + /// + public override string DiscSubtitle { + get { return GetFirstField("DISCSUBTITLE"); } + set { SetField("DISCSUBTITLE", value); } + } + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/Tag.cs b/taglib-sharp/src/TagLib/Tag.cs index e155cd2..147be0e 100644 --- a/taglib-sharp/src/TagLib/Tag.cs +++ b/taglib-sharp/src/TagLib/Tag.cs @@ -823,6 +823,84 @@ namespace TagLib { set {} } + /// + /// Gets and sets the Release Date of the media represented by + /// the current instance. + /// + /// + /// A containing the ReleaseDate of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This field represents the ReleaseDate, that describes + /// the year or a more accurate date when this version of an + /// album was first released. In case of remastered albums + /// this can be a later date than Year. Format can be one of + /// yyyy, yyyy-MM, yyyy-MM-dd + /// + /// + public virtual string ReleaseDate { + get { return null; } + set {} + } + + /// + /// Gets and sets the Publisher of the media represented by + /// the current instance. + /// + /// + /// A containing the Publisher of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This is normally the name of a record label + /// + /// + public virtual string Publisher { + get { return null; } + set {} + } + + /// + /// Gets and sets the CatalogNo of the media represented by + /// the current instance. + /// + /// + /// A containing the catalog number of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This is normally a unique alphanumeric id, assigned + /// to a given release by it's Publisher. + /// + /// + public virtual string CatalogNo { + get { return null; } + set {} + } + + /// + /// Gets and sets the DiscSubtitle of the media represented by + /// the current instance. + /// + /// + /// A containing the subtitle of the + /// media represented by the current instance or null + /// if no value is present. + /// + /// + /// This is normally a name which identifies the media + /// within a set, for example name of a CD within a boxset release. + /// + /// + public virtual string DiscSubtitle { + get { return null; } + set {} + } + /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. diff --git a/taglib-sharp/src/TagLib/WavPack/File.cs b/taglib-sharp/src/TagLib/WavPack/File.cs index 3e947df..fe63ac7 100644 --- a/taglib-sharp/src/TagLib/WavPack/File.cs +++ b/taglib-sharp/src/TagLib/WavPack/File.cs @@ -216,9 +216,29 @@ namespace TagLib.WavPack { propertiesStyle == ReadStyle.None) return; - Seek (start); - header_block = ReadBlock ( - (int) StreamHeader.Size); +// Seek (start); +// header_block = ReadBlock ( +// (int) StreamHeader.Size); + + do + { + long position = Find(StreamHeader.FileIdentifier, start); + if (position < 0) + throw new CorruptFileException( + "wvpk header not found"); + Seek(position); + header_block = ReadBlock( + (int)StreamHeader.Size); + try + { + new StreamHeader(header_block, header_block.Count); + InvariantStartPosition = position; + return; + } catch (CorruptFileException) + { + start = position + 4; + } + } while (true); } /// diff --git a/taglib-sharp/src/TagLib/WavPack/StreamHeader.cs b/taglib-sharp/src/TagLib/WavPack/StreamHeader.cs index d8a4d0b..2cb7d55 100644 --- a/taglib-sharp/src/TagLib/WavPack/StreamHeader.cs +++ b/taglib-sharp/src/TagLib/WavPack/StreamHeader.cs @@ -136,6 +136,12 @@ namespace TagLib.WavPack { version = data.Mid (8, 2).ToUShort (false); flags = data.Mid (24, 4).ToUInt (false); samples = data.Mid (12, 4).ToUInt (false); + + if (!(0 == (data[4] & 1) && data[6] < 16 && 0 == data[7] && (data[6] != 0 || data[5] != 0 || data[4] > 24) && + version >= 0x402 && version <= 0x410 && + data[22] < 3 && 0 == data[23])) + throw new CorruptFileException( + "Not a supported wavpack header"); } #endregion diff --git a/taglib-sharp/src/taglib-sharp.csproj b/taglib-sharp/src/taglib-sharp.csproj index d961861..7bc8a2e 100644 --- a/taglib-sharp/src/taglib-sharp.csproj +++ b/taglib-sharp/src/taglib-sharp.csproj @@ -37,7 +37,7 @@ AllRules.ruleset - none + pdbonly true ..\..\bin\Release\ prompt @@ -48,6 +48,8 @@ AllRules.ruleset + Auto + true