// // CombinedTag.cs: Combines a collection of tags so that they behave as one. // // Author: // Brian Nickel (brian.nickel@gmail.com) // // Copyright (C) 2005-2007 Brian Nickel // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License version // 2.1 as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA // using System; using System.Collections.Generic; namespace TagLib { /// /// This class combines a collection of tags so that they behave as /// one. /// public class CombinedTag : Tag { #region Private Fields /// /// Contains tags to be combined. /// readonly List tags; #endregion #region Constructors /// /// Constructs and initializes a new instance of with no internal tags. /// /// /// You can set the tags in the new instance later using /// . /// public CombinedTag () { tags = new List (); } /// /// Constructs and initializes a new instance of with a specified collection of /// tags. /// /// /// A containing a collection of tags to /// combine in the new instance. /// public CombinedTag (params Tag[] tags) { this.tags = new List (tags); } #endregion #region Public Properties /// /// Gets the tags combined in the current instance. /// /// /// A containing the tags combined in /// the current instance. /// public virtual Tag[] Tags { get { return tags.ToArray (); } } #endregion #region Public Methods /// /// Sets the child tags to combine in the current instance. /// /// /// A containing the tags to combine. /// public void SetTags (params Tag[] tags) { this.tags.Clear (); this.tags.AddRange (tags); } #endregion #region Protected Methods /// /// Inserts a tag into the collection of tags in the current /// instance. /// /// /// A value specifying the index at which /// to insert the tag. /// /// /// A object to insert into the collection /// of tags. /// /// /// is less than zero or greater /// than the count. /// protected void InsertTag (int index, Tag tag) { tags.Insert (index, tag); } /// /// Adds a tag at the end of the collection of tags in the /// current instance. /// /// /// A object to add to the collection of /// tags. /// protected void AddTag (Tag tag) { tags.Add (tag); } /// /// Removes a specified tag from the collection in the /// current instance. /// /// /// A object to remove from the /// collection. /// protected void RemoveTag (Tag tag) { tags.Remove (tag); } /// /// Clears the tag collection in the current instance. /// protected void ClearTags () { tags.Clear (); } #endregion #region Overrides /// /// Gets the tag types contained in the current instance. /// /// /// A bitwise combined /// containing the tag types contained in the current /// instance. /// /// /// This value contains a bitwise combined value from all the /// child tags. /// /// public override TagTypes TagTypes { get { TagTypes types = TagTypes.None; foreach (Tag tag in tags) if (tag != null) types |= tag.TagTypes; return types; } } /// /// Gets and sets the title for the media described by the /// current instance. /// /// /// A object containing the title for /// the media described by the current instance or if no value is present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Title { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Title; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Title = value; } } /// /// Gets and sets a short description, one-liner. /// It represents the tagline of the Video/music. /// /// /// A containing the subtitle /// the media represented by the current instance /// or an empty array if no value is present. /// /// /// This field gives a nice/short precision to /// the title, which is typically below the title on the /// front cover of a media. /// For example, for "Back to the future", this would be /// "It's About Time". /// /// public override string Subtitle { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Subtitle; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Subtitle = value; } } /// /// Gets and sets a short description of the media. /// For a music, this could be the comment that the artist /// made of its artwork. For a video, this should be a /// short summary of the story/plot, but a spoiler. This /// should give the impression of what to expect in the /// media. /// /// /// A containing the subtitle /// the media represented by the current instance /// or an empty array if no value is present. /// /// /// This is especially relevant for a movie. /// For example, for "Back to the Future 2", this could be /// "After visiting 2015, Marty McFly must repeat his visit /// to 1955 to prevent disastrous changes to 1985...without /// interfering with his first trip". /// /// public override string Description { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Description; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Description = value; } } /// /// Gets and sets the performers or artists who performed in /// the media described by the current instance. /// /// /// A containing the performers or /// artists who performed in the media described by the /// current instance or an empty array 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[] Performers { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.Performers; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.Performers = value; } } /// /// Gets and sets the sort names of the performers or artists /// who performed in the media described by the current instance. /// /// /// A containing the sort names for /// the performers or artists who performed in the media /// described by the current instance, or an empty array 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[] PerformersSort { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.PerformersSort; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.PerformersSort = value; } } /// /// Gets and sets the Charaters for a video media, or /// instruments played for music media. /// This should match the array (for /// each person correspond one/more role). Several roles for /// the same artist/actor can be made up with semicolons. /// For example, "Marty McFly; Marty McFly Jr.; Marlene McFly". /// /// /// This is typically usefull for movies, although the /// instrument played by each artist in a music may be of /// relevance. /// /// It is highly important to match each role to the /// performers. This means that a role may be to keep the match between a /// Performers[i] and PerformersRole[i]. /// /// public override string[] PerformersRole { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.PerformersRole; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.PerformersRole = value; } } /// /// Gets and sets the sort names for the band or artist who /// is credited in the creation of the entire album or /// collection containing the media described by the /// current instance. /// /// /// A containing the sort names /// for the band or artist who is credited in the creation /// of the entire album or collection containing the media /// described by the current instance or an empty array 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[] AlbumArtistsSort { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.AlbumArtistsSort; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.AlbumArtistsSort = value; } } /// /// Gets and sets the band or artist who is credited in the /// creation of the entire album or collection containing the /// media described by the current instance. /// /// /// A containing the band or artist /// who is credited in the creation of the entire album or /// collection containing the media described by the current /// instance or an empty array 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[] AlbumArtists { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.AlbumArtists; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.AlbumArtists = value; } } /// /// Gets and sets the composers of the media represented by /// the current instance. /// /// /// A containing the composers of the /// media represented by the current instance or an empty /// array 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[] Composers { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.Composers; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.Composers = value; } } /// /// Gets and sets the sort names for the composer of the /// media described by the current instance. /// /// /// A containing the sort names /// for the composers of the media described by the /// current instance or an empty array 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[] ComposersSort { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.ComposersSort; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.ComposersSort = value; } } /// /// Gets and sets the sort names for the Track Title of the /// media described by the current instance. /// /// /// A containing the sort names /// for the Track Title of the media described 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 TitleSort { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.TitleSort; if (value != null && value.Length > 0) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.TitleSort = value; } } /// /// Gets and sets the sort names for the Album Title of the /// media described by the current instance. /// /// /// A containing the sort names /// for the Title of the media described 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 AlbumSort { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.AlbumSort; if (value != null && value.Length > 0) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.AlbumSort = value; } } /// /// Gets and sets the album of the media represented by the /// current instance. /// /// /// A object containing the album of /// the media represented by the current instance or if no value is present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Album { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Album; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Album = value; } } /// /// Gets and sets a user comment on the media represented by /// the current instance. /// /// /// A object containing user comments /// on the media represented by the current instance or if no value is present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Comment { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Comment; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Comment = value; } } /// /// Gets and sets the genres of the media represented by the /// current instance. /// /// /// A containing the genres of the /// media represented by the current instance or an empty /// array 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[] Genres { get { foreach (Tag tag in tags) { if (tag == null) continue; string[] value = tag.Genres; if (value != null && value.Length > 0) return value; } return new string[] { }; } set { foreach (Tag tag in tags) if (tag != null) tag.Genres = value; } } /// /// Gets and sets the year that the media represented by the /// current instance was recorded. /// /// /// A containing the year that the media /// represented by the current instance was created or zero /// if no value is present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override uint Year { get { foreach (Tag tag in tags) { if (tag == null) continue; uint value = tag.Year; if (value != 0) return value; } return 0; } set { foreach (Tag tag in tags) if (tag != null) tag.Year = value; } } /// /// Gets and sets the position of the media represented by /// the current instance in its containing album. /// /// /// A containing the position of the /// media represented by the current instance in its /// containing album or zero if not specified. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override uint Track { get { foreach (Tag tag in tags) { if (tag == null) continue; uint value = tag.Track; if (value != 0) return value; } return 0; } set { foreach (Tag tag in tags) if (tag != null) tag.Track = value; } } /// /// Gets and sets the number of tracks in the album /// containing the media represented by the current instance. /// /// /// A containing the number of tracks in /// the album containing the media represented by the current /// instance or zero if not specified. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override uint TrackCount { get { foreach (Tag tag in tags) { if (tag == null) continue; uint value = tag.TrackCount; if (value != 0) return value; } return 0; } set { foreach (Tag tag in tags) if (tag != null) tag.TrackCount = value; } } /// /// Gets and sets the number of the disc containing the media /// represented by the current instance in the boxed set. /// /// /// A containing the number of the disc /// containing the media represented by the current instance /// in the boxed set. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override uint Disc { get { foreach (Tag tag in tags) { if (tag == null) continue; uint value = tag.Disc; if (value != 0) return value; } return 0; } set { foreach (Tag tag in tags) if (tag != null) tag.Disc = value; } } /// /// Gets and sets the number of discs in the boxed set /// containing the media represented by the current instance. /// /// /// A containing the number of discs in /// the boxed set containing the media represented by the /// current instance or zero if not specified. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override uint DiscCount { get { foreach (Tag tag in tags) { if (tag == null) continue; uint value = tag.DiscCount; if (value != 0) return value; } return 0; } set { foreach (Tag tag in tags) if (tag != null) tag.DiscCount = value; } } /// /// Gets and sets the lyrics or script of the media /// represented by the current instance. /// /// /// A object containing the lyrics or /// script of the media represented by the current instance /// or if no value is present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Lyrics { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Lyrics; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Lyrics = value; } } /// /// Gets and sets the grouping on the album which the media /// in the current instance belongs to. /// /// /// A object containing the grouping on /// the album which the media in the current instance belongs /// to or if no value is present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Grouping { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Grouping; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Grouping = value; } } /// /// Gets and sets the number of beats per minute in the audio /// of the media represented by the current instance. /// /// /// A containing the number of beats per /// minute in the audio of the media represented by the /// current instance, or zero if not specified. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override uint BeatsPerMinute { get { foreach (Tag tag in tags) { if (tag == null) continue; uint value = tag.BeatsPerMinute; if (value != 0) return value; } return 0; } set { foreach (Tag tag in tags) if (tag != null) tag.BeatsPerMinute = value; } } /// /// Gets and sets the conductor or director of the media /// represented by the current instance. /// /// /// A object containing the conductor /// or director of the media represented by the current /// instance or if no value present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Conductor { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Conductor; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Conductor = value; } } /// /// Gets and sets the copyright information for the media /// represented by the current instance. /// /// /// A object containing the copyright /// information for the media represented by the current /// instance or if no value present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Copyright { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Copyright; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Copyright = value; } } /// /// Gets and sets the date at which the tag has been written. /// /// /// A nullable object containing the /// date at which the tag has been written, or if no value present. /// public override DateTime? DateTagged { get { foreach (Tag tag in tags) { if (tag == null) continue; DateTime? value = tag.DateTagged; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.DateTagged = value; } } /// /// Gets and sets the MusicBrainz Artist ID. /// /// /// A containing the MusicBrainz /// ArtistID for the media described 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 MusicBrainzArtistId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzArtistId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzArtistId = value; } } /// /// Gets and sets the MusicBrainz Release Group ID. /// /// /// A containing the MusicBrainz /// ReleaseGroupID for the media described 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 MusicBrainzReleaseGroupId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzReleaseGroupId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzReleaseGroupId = value; } } /// /// Gets and sets the MusicBrainz Release ID. /// /// /// A containing the MusicBrainz /// ReleaseID for the media described 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 MusicBrainzReleaseId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzReleaseId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzReleaseId = value; } } /// /// Gets and sets the MusicBrainz Release Artist ID. /// /// /// A containing the MusicBrainz /// ReleaseArtistID for the media described 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 MusicBrainzReleaseArtistId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzReleaseArtistId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzReleaseArtistId = value; } } /// /// Gets and sets the MusicBrainz Track ID. /// /// /// A containing the MusicBrainz /// TrackID for the media described 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 MusicBrainzTrackId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzTrackId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzTrackId = value; } } /// /// Gets and sets the MusicBrainz Disc ID. /// /// /// A containing the MusicBrainz /// DiscID for the media described 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 MusicBrainzDiscId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzDiscId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzDiscId = value; } } /// /// Gets and sets the MusicIP PUID. /// /// /// A containing the MusicIP PUID /// for the media described 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 MusicIpId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicIpId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicIpId = value; } } /// /// Gets and sets the Amazon ID. /// /// /// A containing the Amazon Id /// for the media described 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 AmazonId { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.AmazonId; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.AmazonId = value; } } /// /// Gets and sets the MusicBrainz Release Status. /// /// /// A containing the MusicBrainz /// ReleaseStatus for the media described 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 MusicBrainzReleaseStatus { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzReleaseStatus; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzReleaseStatus = value; } } /// /// Gets and sets the MusicBrainz Release Type. /// /// /// A containing the MusicBrainz /// ReleaseType for the media described 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 MusicBrainzReleaseType { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzReleaseType; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzReleaseType = value; } } /// /// Gets and sets the MusicBrainz Release Country. /// /// /// A containing the MusicBrainz /// ReleaseCountry for the media described 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 MusicBrainzReleaseCountry { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.MusicBrainzReleaseCountry; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.MusicBrainzReleaseCountry = value; } } /// /// Gets and sets a collection of pictures associated with /// the media represented by the current instance. /// /// /// A containing a collection of /// pictures associated with the media represented by the /// current instance or an empty array if none are 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 IPicture[] Pictures { get { foreach (Tag tag in tags) { if (tag == null) continue; IPicture[] value = tag.Pictures; if (value != null && value.Length > 0) return value; } return base.Pictures; } set { foreach (Tag tag in tags) if (tag != null) tag.Pictures = value; } } /// /// Gets and sets the ReplayGain track gain in dB. /// /// /// A value in dB for the track gain as /// per the ReplayGain specification. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override double ReplayGainTrackGain { get { foreach (Tag tag in tags) { if (tag == null) continue; double value = tag.ReplayGainTrackGain; if (!double.IsNaN (value)) return value; } return double.NaN; } set { foreach (Tag tag in tags) if (tag != null) tag.ReplayGainTrackGain = value; } } /// /// Gets and sets the ReplayGain track peak sample. /// /// /// A value for the track peak as per the /// ReplayGain specification. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override double ReplayGainTrackPeak { get { foreach (Tag tag in tags) { if (tag == null) continue; double value = tag.ReplayGainTrackPeak; if (!double.IsNaN (value)) return value; } return double.NaN; } set { foreach (Tag tag in tags) if (tag != null) tag.ReplayGainTrackPeak = value; } } /// /// Gets and sets the ReplayGain album gain in dB. /// /// /// A value in dB for the album gain as /// per the ReplayGain specification. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override double ReplayGainAlbumGain { get { foreach (Tag tag in tags) { if (tag == null) continue; double value = tag.ReplayGainAlbumGain; if (!double.IsNaN (value)) return value; } return double.NaN; } set { foreach (Tag tag in tags) if (tag != null) tag.ReplayGainAlbumGain = value; } } /// /// Gets and sets the ReplayGain album peak sample. /// /// /// A value for the album peak as per the /// ReplayGain specification. /// /// /// When getting the value, the child tags are looped /// through in order and the first non-zero value is /// returned. /// When setting the value, it is stored in each child /// tag. /// /// public override double ReplayGainAlbumPeak { get { foreach (Tag tag in tags) { if (tag == null) continue; double value = tag.ReplayGainAlbumPeak; if (!double.IsNaN (value)) return value; } return double.NaN; } set { foreach (Tag tag in tags) if (tag != null) tag.ReplayGainAlbumPeak = value; } } /// /// Gets and sets the initial key of the media /// represented by the current instance. /// /// /// A object containing the initial /// key of the media represented by the current /// instance or if no value present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string InitialKey { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.InitialKey; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.InitialKey = value; } } /// /// Gets and sets the remixer of the media /// represented by the current instance. /// /// /// A object containing the remixer /// of the media represented by the current /// instance or if no value present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string RemixedBy { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.RemixedBy; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.RemixedBy = value; } } /// /// Gets and sets the publisher of the media /// represented by the current instance. /// /// /// A object containing the /// publisher of the media represented by the current /// instance or if no value present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// 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 ISRC (International Standard Recording Code) /// of the song represented by the current instance. /// /// /// A object containing the ISRC /// of the media represented by the current /// instance or if no value present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string ISRC { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.ISRC; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.ISRC = value; } } /// /// Gets and sets the length of the media /// represented by the current instance. /// /// /// A object containing the /// length of the media represented by the current /// instance or if no value present. /// /// /// When getting the value, the child tags are looped /// through in order and the first non- /// value is returned. /// When setting the value, it is stored in each child /// tag. /// /// public override string Length { get { foreach (Tag tag in tags) { if (tag == null) continue; string value = tag.Length; if (value != null) return value; } return null; } set { foreach (Tag tag in tags) if (tag != null) tag.Length = value; } } /// /// Gets whether or not the current instance is empty. /// /// /// if all the child tags are empty. /// Otherwise . /// /// public override bool IsEmpty { get { foreach (Tag tag in tags) if (tag.IsEmpty) return true; return false; } } /// /// Clears all of the child tags. /// public override void Clear () { foreach (Tag tag in tags) tag.Clear (); } #endregion } }