예제 #1
0
        private TagLib.Tag ReadTag(ref long start)
        {
            long position = start;
            TagTypes types = this.ReadTagInfo(ref position);
            TagLib.Tag tag = null;
            try
            {
                switch (types)
                {
                    case (TagTypes.None | TagTypes.Id3v2):
                        tag = new TagLib.Id3v2.Tag(this.file, start);
                        break;

                    case (TagTypes.None | TagTypes.Ape):
                        tag = new TagLib.Ape.Tag(this.file, start);
                        break;
                }
            }
            catch (CorruptFileException exception)
            {
                Console.Error.WriteLine("taglib-sharp caught exception creating tag: {0}", exception);
            }
            start = position;
            return tag;
        }
예제 #2
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;
 }
예제 #3
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;
 }
예제 #4
0
        private TagLib.Tag ReadTag(ref long end)
        {
            long position = end;
            TagTypes types = this.ReadTagInfo(ref position);
            TagLib.Tag tag = null;
            try
            {
                TagTypes types2 = types;
                switch (types2)
                {
                    case (TagTypes.None | TagTypes.Id3v1):
                        tag = new TagLib.Id3v1.Tag(this.file, position);
                        break;

                    case (TagTypes.None | TagTypes.Id3v2):
                        tag = new TagLib.Id3v2.Tag(this.file, position);
                        break;

                    default:
                        if (types2 == (TagTypes.None | TagTypes.Ape))
                        {
                            tag = new TagLib.Ape.Tag(this.file, end - 0x20L);
                        }
                        break;
                }
                end = position;
            }
            catch (CorruptFileException)
            {
            }
            return tag;
        }