Ejemplo n.º 1
0
 public TagLib.Tag AddTag(TagTypes type, TagLib.Tag copy)
 {
     TagLib.Tag target = null;
     if (type == (TagTypes.None | TagTypes.Id3v1))
     {
         target = new TagLib.Id3v1.Tag();
     }
     else if (type == (TagTypes.None | TagTypes.Id3v2))
     {
         TagLib.Id3v2.Tag tag2;
         target = new TagLib.Id3v2.Tag {
             Version = 4,
             Flags = (byte) (tag2.Flags | HeaderFlags.FooterPresent)
         };
     }
     else if (type == (TagTypes.None | TagTypes.Ape))
     {
         target = new TagLib.Ape.Tag();
     }
     if (target != null)
     {
         if (copy != null)
         {
             copy.CopyTo(target, true);
         }
         if (type == (TagTypes.None | TagTypes.Id3v1))
         {
             base.AddTag(target);
             return target;
         }
         base.InsertTag(0, target);
     }
     return target;
 }
Ejemplo n.º 2
0
 public TagLib.Tag AddTag(TagTypes type, TagLib.Tag copy)
 {
     TagLib.Tag target = null;
     if (type == (TagTypes.None | TagTypes.Id3v2))
     {
         target = new TagLib.Id3v2.Tag();
     }
     else if (type == (TagTypes.None | TagTypes.Ape))
     {
         target = new TagLib.Ape.Tag();
         (target as TagLib.Ape.Tag).HeaderPresent = true;
     }
     if (target != null)
     {
         if (copy != null)
         {
             copy.CopyTo(target, true);
         }
         base.AddTag(target);
     }
     return target;
 }
Ejemplo n.º 3
0
        /// <summary>
        ///    Adds a tag of a specified type to the current instance,
        ///    optionally copying values from an existing type.
        /// </summary>
        /// <param name="type">
        ///    A <see cref="TagTypes" /> value specifying the type of
        ///    tag to add to the current instance. At the time of this
        ///    writing, this is limited to <see cref="TagTypes.Ape" />,
        ///    <see cref="TagTypes.Id3v1" />, and <see
        ///    cref="TagTypes.Id3v2" />.
        /// </param>
        /// <param name="copy">
        ///    A <see cref="TagLib.Tag" /> to copy values from using
        ///    <see cref="TagLib.Tag.CopyTo" />, or <see
        ///    langword="null" /> if no tag is to be copied.
        /// </param>
        /// <returns>
        ///    The <see cref="TagLib.Tag" /> object added to the current
        ///    instance, or <see langword="null" /> if it couldn't be
        ///    created.
        /// </returns>
        /// <remarks>
        ///    ID3v2 tags are added at the end of the current instance,
        ///    while other tags are added to the beginning.
        /// </remarks>
        public TagLib.Tag AddTag(TagTypes type, TagLib.Tag copy)
        {
            TagLib.Tag tag = null;

            if (type == TagTypes.Id3v1) {
                tag = new TagLib.Id3v1.Tag ();
            } else if (type == TagTypes.Id3v2) {
                Id3v2.Tag tag32 = new Id3v2.Tag ();
                tag32.Version = 4;
                tag32.Flags |= Id3v2.HeaderFlags.FooterPresent;
                tag = tag32;
            } else if (type == TagTypes.Ape) {
                tag = new TagLib.Ape.Tag ();
            }

            if (tag != null) {
                if (copy != null)
                    copy.CopyTo (tag, true);

                if (type == TagTypes.Id3v1)
                    AddTag (tag);
                else
                    InsertTag (0, tag);
            }

            return tag;
        }
Ejemplo n.º 4
0
        /// <summary>
        ///    Adds a tag of a specified type to the current instance,
        ///    optionally copying values from an existing type.
        /// </summary>
        /// <param name="type">
        ///    A <see cref="TagTypes" /> value specifying the type of
        ///    tag to add to the current instance. At the time of this
        ///    writing, this is limited to <see cref="TagTypes.Ape" />
        ///    and <see cref="TagTypes.Id3v2" />.
        /// </param>
        /// <param name="copy">
        ///    A <see cref="TagLib.Tag" /> to copy values from using
        ///    <see cref="TagLib.Tag.CopyTo" />, or <see
        ///    langword="null" /> if no tag is to be copied.
        /// </param>
        /// <returns>
        ///    The <see cref="TagLib.Tag" /> object added to the current
        ///    instance, or <see langword="null" /> if it couldn't be
        ///    created.
        /// </returns>
        /// <remarks>
        ///    ID3v2 tags are added at the end of the current instance,
        ///    while other tags are added to the beginning.
        /// </remarks>
        public TagLib.Tag AddTag(TagTypes type, TagLib.Tag copy)
        {
            TagLib.Tag tag = null;

            if (type == TagTypes.Id3v2) {
                tag = new TagLib.Id3v2.Tag ();
            } else if (type == TagTypes.Ape) {
                tag = new TagLib.Ape.Tag ();
                (tag as Ape.Tag).HeaderPresent = true;
            }

            if (tag != null) {
                if (copy != null)
                    copy.CopyTo (tag, true);

                AddTag (tag);
            }

            return tag;
        }