Author: bnickel
Date: 2006-11-06 15:15:19 -0500 (Mon, 06 Nov 2006)
New Revision: 67413

Modified:
   trunk/taglib-sharp/ChangeLog
   trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
   trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptionObject.cs
   trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptor.cs
   trunk/taglib-sharp/src/TagLib/Asf/ExtendedContentDescriptionObject.cs
   trunk/taglib-sharp/src/TagLib/Asf/FilePropertiesObject.cs
   trunk/taglib-sharp/src/TagLib/Asf/Guid.cs
   trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs
   trunk/taglib-sharp/src/TagLib/Asf/Object.cs
   trunk/taglib-sharp/src/TagLib/Asf/StreamPropertiesObject.cs
   trunk/taglib-sharp/src/TagLib/Asf/Tag.cs
   trunk/taglib-sharp/src/TagLib/ByteVector.cs
   trunk/taglib-sharp/src/TagLib/Flac/File.cs
   trunk/taglib-sharp/src/TagLib/Id3v2/Frame.cs
   trunk/taglib-sharp/src/TagLib/Id3v2/FrameHeader.cs
   trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/BoxHeader.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/Box.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkOffsetBox.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoHandlerBox.cs
   trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/Id3BothFormatTest.cs
Log:
2006-11-06  Brian Nickel  <[EMAIL PROTECTED]>

        * src/TagLib/Id3v2/Tag.cs:
        * src/TagLib/Id3v2/FrameHeader.cs:
        * src/TagLib/Id3v2/Frame.cs:
        * src/TagLib/ByteVector.cs:
        * src/TagLib/Ape/Tag.cs:
        * src/TagLib/Flac/File.cs:
        * src/TagLib/Asf/Tag.cs:
        * src/TagLib/Asf/HeaderObject.cs:
        * src/TagLib/Asf/StreamPropertiesObject.cs:
        * src/TagLib/Asf/FilePropertiesObject.cs:
        * src/TagLib/Asf/ContentDescriptionObject.cs:
        * src/TagLib/Asf/ExtendedContentDescriptionObject.cs:
        * src/TagLib/Asf/Object.cs:
        * src/TagLib/Asf/Guid.cs:
        * src/TagLib/Asf/ContentDescriptor.cs:
        * src/TagLib/Mpeg4/Boxes/FullBox.cs:
        * src/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs:
        * src/TagLib/Mpeg4/Boxes/Box.cs:
        * src/TagLib/Mpeg4/Boxes/IsoHandlerBox.cs:
        * src/TagLib/Mpeg4/Boxes/IsoChunkOffsetBox.cs:
        * src/TagLib/Mpeg4/AppleTag.cs:
        * src/TagLib/Mpeg4/BoxHeader.cs: Improve performance by not using plus
        operator so much. Less allocations.
        * tests/fixtures/TagLib.FormatTests/Id3BothFormatTest.cs: Fixed 
multiformat
        tests. Removed Tag Count test.



Modified: trunk/taglib-sharp/ChangeLog
===================================================================
--- trunk/taglib-sharp/ChangeLog        2006-11-06 19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/ChangeLog        2006-11-06 20:15:19 UTC (rev 67413)
@@ -1,3 +1,31 @@
+2006-11-06  Brian Nickel  <[EMAIL PROTECTED]>
+
+       * src/TagLib/Id3v2/Tag.cs:
+       * src/TagLib/Id3v2/FrameHeader.cs:
+       * src/TagLib/Id3v2/Frame.cs:
+       * src/TagLib/ByteVector.cs:
+       * src/TagLib/Ape/Tag.cs:
+       * src/TagLib/Flac/File.cs:
+       * src/TagLib/Asf/Tag.cs:
+       * src/TagLib/Asf/HeaderObject.cs:
+       * src/TagLib/Asf/StreamPropertiesObject.cs:
+       * src/TagLib/Asf/FilePropertiesObject.cs:
+       * src/TagLib/Asf/ContentDescriptionObject.cs:
+       * src/TagLib/Asf/ExtendedContentDescriptionObject.cs:
+       * src/TagLib/Asf/Object.cs:
+       * src/TagLib/Asf/Guid.cs:
+       * src/TagLib/Asf/ContentDescriptor.cs:
+       * src/TagLib/Mpeg4/Boxes/FullBox.cs:
+       * src/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs:
+       * src/TagLib/Mpeg4/Boxes/Box.cs:
+       * src/TagLib/Mpeg4/Boxes/IsoHandlerBox.cs:
+       * src/TagLib/Mpeg4/Boxes/IsoChunkOffsetBox.cs:
+       * src/TagLib/Mpeg4/AppleTag.cs:
+       * src/TagLib/Mpeg4/BoxHeader.cs: Improve performance by not using plus
+       operator so much. Less allocations.
+       * tests/fixtures/TagLib.FormatTests/Id3BothFormatTest.cs: Fixed 
multiformat
+       tests. Removed Tag Count test.
+
 2006-11-03  Brian Nickel  <[EMAIL PROTECTED]>
 
        * src/TagLib/ByteVector.cs: Use Boyer-Moore String Searching Algorithm 

Modified: trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Ape/Tag.cs    2006-11-06 19:08:07 UTC (rev 
67412)
+++ trunk/taglib-sharp/src/TagLib/Ape/Tag.cs    2006-11-06 20:15:19 UTC (rev 
67413)
@@ -72,7 +72,9 @@
          footer.TagSize       = (uint) (data.Count + Footer.Size);
          footer.HeaderPresent = true;
 
-         return footer.RenderHeader () + data + footer.RenderFooter ();
+         data.Insert (0, footer.RenderHeader ());
+         data.Add (footer.RenderFooter ());
+         return data;
       }
       
       public void RemoveItem (string key)

Modified: trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptionObject.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptionObject.cs       
2006-11-06 19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptionObject.cs       
2006-11-06 20:15:19 UTC (rev 67413)
@@ -74,17 +74,16 @@
          ByteVector description_bytes = RenderUnicode (description);
          ByteVector rating_bytes      = RenderUnicode (rating);
          
-         ByteVector output = new ByteVector ();
-         output += RenderWord ((short) title_bytes.Count);
-         output += RenderWord ((short) author_bytes.Count);
-         output += RenderWord ((short) copyright_bytes.Count);
-         output += RenderWord ((short) description_bytes.Count);
-         output += RenderWord ((short) rating_bytes.Count);
-         output += title_bytes;
-         output += author_bytes;
-         output += copyright_bytes;
-         output += description_bytes;
-         output += rating_bytes;
+         ByteVector output = RenderWord ((short) title_bytes.Count);
+         output.Add (RenderWord ((short) author_bytes.Count));
+         output.Add (RenderWord ((short) copyright_bytes.Count));
+         output.Add (RenderWord ((short) description_bytes.Count));
+         output.Add (RenderWord ((short) rating_bytes.Count));
+         output.Add (title_bytes);
+         output.Add (author_bytes);
+         output.Add (copyright_bytes);
+         output.Add (description_bytes);
+         output.Add (rating_bytes);
          
          return Render (output);
       }

Modified: trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptor.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptor.cs      2006-11-06 
19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/ContentDescriptor.cs      2006-11-06 
20:15:19 UTC (rev 67413)
@@ -151,13 +151,16 @@
 
          ByteVector v = Object.RenderUnicode (name);
          
-         ByteVector data = Object.RenderWord ((short) v.Count) + v + 
Object.RenderWord ((short) type);
+         ByteVector data = Object.RenderWord ((short) v.Count);
+         data.Add (v);
+         data.Add (Object.RenderWord ((short) type));
          
          switch (type)
          {
             case DataType.Unicode:
                v = Object.RenderUnicode (sValue);
-               data += Object.RenderWord ((short) v.Count) + v;
+               data.Add (Object.RenderWord ((short) v.Count));
+               data.Add (v);
             break;
             
             case DataType.Bytes:

Modified: trunk/taglib-sharp/src/TagLib/Asf/ExtendedContentDescriptionObject.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/ExtendedContentDescriptionObject.cs       
2006-11-06 19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/ExtendedContentDescriptionObject.cs       
2006-11-06 20:15:19 UTC (rev 67413)
@@ -66,7 +66,7 @@
          foreach (ContentDescriptor desc in descriptors)
          {
             count ++;
-            output += desc.Render ();
+            output.Add (desc.Render ());
          }
          
          return Render (RenderWord (count) + output);

Modified: trunk/taglib-sharp/src/TagLib/Asf/FilePropertiesObject.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/FilePropertiesObject.cs   2006-11-06 
19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/FilePropertiesObject.cs   2006-11-06 
20:15:19 UTC (rev 67413)
@@ -67,20 +67,18 @@
       
       public override ByteVector Render ()
       {
-         ByteVector output = new ByteVector ();
+         ByteVector output = file_id.Render ();
+         output.Add (RenderQWord (file_size));
+         output.Add (RenderQWord (creation_date));
+         output.Add (RenderQWord (data_packets_count));
+         output.Add (RenderQWord (play_duration));
+         output.Add (RenderQWord (send_duration));
+         output.Add (RenderQWord (preroll));
+         output.Add (RenderDWord (flags));
+         output.Add (RenderDWord (minimum_data_packet_size));
+         output.Add (RenderDWord (maximum_data_packet_size));
+         output.Add (RenderDWord (maximum_bitrate));
          
-         output += file_id.Render ();
-         output += RenderQWord (file_size);
-         output += RenderQWord (creation_date);
-         output += RenderQWord (data_packets_count);
-         output += RenderQWord (play_duration);
-         output += RenderQWord (send_duration);
-         output += RenderQWord (preroll);
-         output += RenderDWord (flags);
-         output += RenderDWord (minimum_data_packet_size);
-         output += RenderDWord (maximum_data_packet_size);
-         output += RenderDWord (maximum_bitrate);
-         
          return Render (output);
       }
       

Modified: trunk/taglib-sharp/src/TagLib/Asf/Guid.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/Guid.cs   2006-11-06 19:08:07 UTC (rev 
67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/Guid.cs   2006-11-06 20:15:19 UTC (rev 
67413)
@@ -20,6 +20,7 @@
  *   USA                                                                   *
  ***************************************************************************/
 
+using System.Text;
 using System.Collections;
 using System;
 
@@ -53,11 +54,12 @@
       
       public ByteVector Render ()
       {
-         return ByteVector.FromUInt  (part1, false).Mid (0, 4)
-              + ByteVector.FromShort (part2, false).Mid (0, 2)
-              + ByteVector.FromShort (part3, false).Mid (0, 2)
-              + ByteVector.FromShort (part4, true).Mid (0, 2)
-              + ByteVector.FromLong  (part5, true).Mid (2, 6);
+         ByteVector v = ByteVector.FromUInt  (part1, false).Mid (0, 4);
+         v.Add (ByteVector.FromShort (part2, false).Mid (0, 2));
+         v.Add (ByteVector.FromShort (part3, false).Mid (0, 2));
+         v.Add (ByteVector.FromShort (part4, true).Mid (0, 2));
+         v.Add (ByteVector.FromLong  (part5, true).Mid (2, 6));
+         return v;
       }
       
       public static Guid AsfHeaderObject                     = new Guid 
(0x75B22630, 0x668E, 0x11CF, 0xA6D9, 0x00AA0062CE6C);
@@ -99,11 +101,18 @@
       
       public new string ToString ()
       {
-         return RenderNumber (part1, 8) + "-"
-              + RenderNumber (part2, 4) + "-"
-              + RenderNumber (part3, 4) + "-"
-              + RenderNumber (part4, 4) + "-"
-              + RenderNumber (part5, 12);
+         string dash = "-";
+         StringBuilder b = new StringBuilder (36);
+         b.Append (RenderNumber (part1, 8));
+         b.Append (dash);
+         b.Append (RenderNumber (part2, 4));
+         b.Append (dash);
+         b.Append (RenderNumber (part3, 4));
+         b.Append (dash);
+         b.Append (RenderNumber (part4, 4));
+         b.Append (dash);
+         b.Append (RenderNumber (part5, 12));
+         return b.ToString ();
       }
       
       private string RenderNumber (long value, int length)
@@ -112,10 +121,11 @@
          if (s.Length > length)
             return s.Substring (s.Length - length);
          
-         while (s.Length < length)
-            s = "0" + s;
+         StringBuilder b = new StringBuilder (length);
+         while (b.Length < length)
+            b.Insert (0, '0');
          
-         return s;
+         return b.ToString ();
       }
    }
 }

Modified: trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs   2006-11-06 19:08:07 UTC 
(rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs   2006-11-06 20:15:19 UTC 
(rev 67413)
@@ -55,7 +55,7 @@
          foreach (Object child in children)
             if (child.Guid != Asf.Guid.AsfPaddingObject)
             {
-               output += child.Render ();
+               output.Add (child.Render ());
                child_count ++;
             }
          
@@ -64,11 +64,13 @@
          if (size_diff != 0)
          {
             PaddingObject obj = new PaddingObject ((uint) (size_diff > 0 ? 
4096 : - size_diff));
-            output += obj.Render ();
+            output.Add (obj.Render ());
             child_count ++;
          }
          
-         return Render (RenderDWord (child_count) + reserved + output);
+         output.Insert (0, reserved);
+         output.Insert (0, RenderDWord (child_count));
+         return output;
       }
       
       public void AddObject (Object obj)

Modified: trunk/taglib-sharp/src/TagLib/Asf/Object.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/Object.cs 2006-11-06 19:08:07 UTC (rev 
67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/Object.cs 2006-11-06 20:15:19 UTC (rev 
67413)
@@ -50,7 +50,9 @@
       
       public static ByteVector RenderUnicode (string str)
       {
-         return ByteVector.FromString (str, StringType.UTF16LE) + 
ByteVector.FromShort (0);
+         ByteVector v = ByteVector.FromString (str, StringType.UTF16LE);
+         v.Add (ByteVector.FromShort (0));
+         return v;
       }
       
       public static ByteVector RenderDWord (uint value)
@@ -82,9 +84,11 @@
       
//////////////////////////////////////////////////////////////////////////
       protected ByteVector Render (ByteVector data)
       {
-         if (data == null)
-            data = new ByteVector ();
-         return Guid.Render () + RenderQWord (data.Count + 24) + data;
+         long length = (data != null ? data.Count : 0) + 24;
+         ByteVector v = Guid.Render ();
+         v.Add (RenderQWord (length));
+         v.Add (data);
+         return v;
       }
    }
 }

Modified: trunk/taglib-sharp/src/TagLib/Asf/StreamPropertiesObject.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/StreamPropertiesObject.cs 2006-11-06 
19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/StreamPropertiesObject.cs 2006-11-06 
20:15:19 UTC (rev 67413)
@@ -61,18 +61,16 @@
       
       public override ByteVector Render ()
       {
-         ByteVector output = new ByteVector ();
+         ByteVector output = stream_type.Render ();
+         output.Add (error_correction_type.Render ());
+         output.Add (RenderQWord (time_offset));
+         output.Add (RenderDWord ((uint) type_specific_data.Count));
+         output.Add (RenderDWord ((uint) error_correction_data.Count));
+         output.Add (RenderWord  (flags));
+         output.Add (RenderDWord (reserved));
+         output.Add (type_specific_data);
+         output.Add (error_correction_data);
          
-         output += stream_type.Render ();
-         output += error_correction_type.Render ();
-         output += RenderQWord (time_offset);
-         output += RenderDWord ((uint) type_specific_data.Count);
-         output += RenderDWord ((uint) error_correction_data.Count);
-         output += RenderWord  (flags);
-         output += RenderDWord (reserved);
-         output += type_specific_data;
-         output += error_correction_data;
-         
          return Render (output);
       }
       

Modified: trunk/taglib-sharp/src/TagLib/Asf/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/Tag.cs    2006-11-06 19:08:07 UTC (rev 
67412)
+++ trunk/taglib-sharp/src/TagLib/Asf/Tag.cs    2006-11-06 20:15:19 UTC (rev 
67413)
@@ -305,8 +305,7 @@
                ContentDescriptor [] descriptors = new ContentDescriptor 
[value.Length];
                for (int i = 0; i < value.Length; i ++)
                {
-                       ByteVector v = new ByteVector ();
-                       v.Add ((byte) value [i].Type);
+                       ByteVector v = new ByteVector ((byte) value [i].Type);
                        v.Add (Object.RenderDWord ((uint) value 
[i].Data.Count));
                        v.Add (Object.RenderUnicode (value [i].MimeType));
                        v.Add (Object.RenderUnicode (value [i].Description));

Modified: trunk/taglib-sharp/src/TagLib/ByteVector.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/ByteVector.cs 2006-11-06 19:08:07 UTC (rev 
67412)
+++ trunk/taglib-sharp/src/TagLib/ByteVector.cs 2006-11-06 20:15:19 UTC (rev 
67413)
@@ -366,7 +366,21 @@
                 data.AddRange(vector);
             }
         }
-
+        
+        public void Insert (int index, ByteVector vector)
+        {
+            if(vector != null) {
+                data.InsertRange (index, vector);
+            }
+        }
+        
+        public void Insert (int index, byte [] vector)
+        {
+            if(vector != null) {
+                data.InsertRange (index, vector);
+            }
+        }
+        
         public ByteVector Resize(int size, byte padding)
         {
             if(Count > size) {

Modified: trunk/taglib-sharp/src/TagLib/Flac/File.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Flac/File.cs  2006-11-06 19:08:07 UTC (rev 
67412)
+++ trunk/taglib-sharp/src/TagLib/Flac/File.cs  2006-11-06 20:15:19 UTC (rev 
67413)
@@ -104,7 +104,6 @@
                   id3v2_size = (int) header.CompleteTagSize;
 
                Insert (id3v2_tag_data, id3v2_location, id3v2_size);
-               System.Console.WriteLine ("ID3v2: " + id3v2_size + " " + 
id3v2_tag_data.Count);
                flac_data_begin = id3v2_location + id3v2_tag_data.Count;
             }
             else

Modified: trunk/taglib-sharp/src/TagLib/Id3v2/Frame.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/Frame.cs        2006-11-06 19:08:07 UTC 
(rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/Frame.cs        2006-11-06 20:15:19 UTC 
(rev 67413)
@@ -47,8 +47,9 @@
          ByteVector field_data = RenderFields ();
          header.FrameSize = (uint) field_data.Count;
          ByteVector header_data = header.Render ();
+         header_data.Add (field_data);
 
-         return header_data + field_data;
+         return header_data;
       }
       
       
//////////////////////////////////////////////////////////////////////////

Modified: trunk/taglib-sharp/src/TagLib/Id3v2/FrameHeader.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/FrameHeader.cs  2006-11-06 19:08:07 UTC 
(rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/FrameHeader.cs  2006-11-06 20:15:19 UTC 
(rev 67413)
@@ -183,7 +183,9 @@
       {
          ByteVector flags = new ByteVector (2, (byte) 0); // just blank for 
the moment
          
-         return frame_id + SynchData.FromUInt (frame_size) + flags;
+         flags.Insert (0, SynchData.FromUInt (frame_size));
+         flags.Insert (0, frame_id);
+         return flags;
       }
       
       public static uint Size (uint version)

Modified: trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs  2006-11-06 19:08:07 UTC (rev 
67412)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs  2006-11-06 20:15:19 UTC (rev 
67413)
@@ -130,14 +130,15 @@
          
          // Set the tag size.
          header.TagSize = (uint) tag_data.Count;
-
+         
+         tag_data.Insert (0, header.Render ());
          if (header.FooterPresent)
          {
             footer = new Footer (header);
-            return header.Render () + tag_data + footer.Render ();
+            tag_data.Add (footer.Render ());
          }
          
-         return header.Render () + tag_data;
+         return tag_data;
       }
       
       

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs     2006-11-06 19:08:07 UTC 
(rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs     2006-11-06 20:15:19 UTC 
(rev 67413)
@@ -439,11 +439,10 @@
          }
          set
          {
-            ByteVector v = new ByteVector ();
-            v += ByteVector.FromShort (0);
-            v += ByteVector.FromShort ((short) value);
-            v += ByteVector.FromShort ((short) TrackCount);
-            v += ByteVector.FromShort (0);
+            ByteVector v = ByteVector.FromShort (0);
+            v.Add (ByteVector.FromShort ((short) value));
+            v.Add (ByteVector.FromShort ((short) TrackCount));
+            v.Add (ByteVector.FromShort (0));
             
             SetData (FixId ("trkn"), v, (int) 
AppleDataBox.FlagTypes.ContainsData);
          }

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/BoxHeader.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/BoxHeader.cs    2006-11-06 19:08:07 UTC 
(rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/BoxHeader.cs    2006-11-06 20:15:19 UTC 
(rev 67413)
@@ -60,21 +60,19 @@
             large_size += 8;
          }
          
-         // Get ready to output.
-         ByteVector output = new ByteVector ();
          
          // Add the box size and type to the output.
-         output += ByteVector.FromUInt ((size == 8 || size == 24) ? (uint) 
large_size : 1);
-         output += box_type;
+         ByteVector output = ByteVector.FromUInt ((size == 8 || size == 24) ? 
(uint) large_size : 1);
+         output.Add (box_type);
          
          // If the box size is 16 or 32, we must have more a large header to
          // append.
          if (size == 16 || size == 32)
-            output += ByteVector.FromLong ((long) large_size);
+            output.Add (ByteVector.FromLong ((long) large_size));
          
          // The only reason for such a big size is an extended type. Extend!!!
          if (size >= 24)
-            output += (extended_type != null) ? extended_type.Mid (0, 16) : 
new ByteVector (16);
+            output.Add ((extended_type != null) ? extended_type.Mid (0, 16) : 
new ByteVector (16));
          
          return output;
       }

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/Box.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/Box.cs    2006-11-06 19:08:07 UTC 
(rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/Box.cs    2006-11-06 20:15:19 UTC 
(rev 67413)
@@ -402,9 +402,9 @@
                if (box.GetType () == typeof (IsoFreeSpaceBox))
                   free_found = true;
                else
-                  output += box.Render ();
+                  output.Add (box.Render ());
          else
-            output += Data;
+            output.Add (Data);
          
          // If there was a free, don't take it away, and let meta be a special 
case.
          if (free_found || BoxType == "meta")
@@ -413,17 +413,19 @@
             
             // If we have room for free space, add it so we don't have to 
resize the file.
             if (header.DataSize != 0 && size_difference >= 8)
-               output += (new IsoFreeSpaceBox ((ulong) size_difference, 
this)).Render ();
+               output. Add ((new IsoFreeSpaceBox ((ulong) size_difference, 
this)).Render ());
             // If we're getting bigger, get a lot bigger so we might not have 
to again.
             else
-               output += (new IsoFreeSpaceBox (2048, this)).Render ();
+               output.Add ((new IsoFreeSpaceBox (2048, this)).Render ());
          }
          
          // Adjust the header's data size to match the content.
          header.DataSize = (ulong) (data.Count + output.Count);
          
          // Render the full box.
-         return header.Render () + data + output;
+         output.Insert (0, data);
+         output.Insert (0, header.Render ());
+         return output;
       }
       
       

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs        2006-11-06 
19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs        2006-11-06 
20:15:19 UTC (rev 67413)
@@ -43,11 +43,10 @@
       // Render this box with the extra data at the beginning.
       protected override ByteVector Render (ByteVector data)
       {
-         ByteVector output = new ByteVector ();
+         ByteVector output = new ByteVector ((byte) version);
          
-         output += (byte) version;
-         output += ByteVector.FromUInt (flags).Mid (1,3);
-         output += data;
+         output.Add (ByteVector.FromUInt (flags).Mid (1,3));
+         output.Add (data);
          
          return base.Render (output);
       }

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs 
2006-11-06 19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs 
2006-11-06 20:15:19 UTC (rev 67413)
@@ -27,7 +27,7 @@
          {
             if (offsets [i] >= (ulong) after)
                offsets [i] = (ulong) ((long)offsets [i] + size_difference);
-            output += ByteVector.FromLong ((long) offsets [i]);
+            output.Add (ByteVector.FromLong ((long) offsets [i]));
          }
          
          return output;

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkOffsetBox.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkOffsetBox.cs      
2006-11-06 19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoChunkOffsetBox.cs      
2006-11-06 20:15:19 UTC (rev 67413)
@@ -27,7 +27,7 @@
          {
             if (offsets [i] >= after)
                offsets [i] = (uint) (offsets [i] + size_difference);
-            output += ByteVector.FromUInt (offsets [i]);
+            output.Add (ByteVector.FromUInt (offsets [i]));
          }
          
          return output;

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoHandlerBox.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoHandlerBox.cs  2006-11-06 
19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/IsoHandlerBox.cs  2006-11-06 
20:15:19 UTC (rev 67413)
@@ -39,10 +39,10 @@
       public override ByteVector Render ()
       {
          ByteVector output = new ByteVector (4);
-         output += handler_type;
-         output += new ByteVector (12);
-         output += ByteVector.FromString (name);
-         output += new ByteVector (2);
+         output.Add (handler_type);
+         output.Add (new ByteVector (12));
+         output.Add (ByteVector.FromString (name));
+         output.Add (new ByteVector (2));
          return Render (output);
       }
       

Modified: 
trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/Id3BothFormatTest.cs
===================================================================
--- trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/Id3BothFormatTest.cs   
2006-11-06 19:08:07 UTC (rev 67412)
+++ trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/Id3BothFormatTest.cs   
2006-11-06 20:15:19 UTC (rev 67413)
@@ -44,51 +44,26 @@
         }
         
         [Test]
-        [Ignore("Multiple tags not supported")]
-        public void TagCounts()
-        {
-            // this test fails on purpose as we do not have support
-            // multiples for any tag, which is possible with combined
-            // with ID3v1 and ID3v2 tags for example - entagged-sharp
-            // supports these cases and we should too
-            
-            //Assert.AreEqual(2, file.Tag.Albums.Length);
-            //Assert.AreEqual(2, file.Tag.Comments.Length);
-            //Assert.AreEqual(2, file.Tag.TrackNumbers.Length);
-            //Assert.AreEqual(1, file.Tag.TrackCounts.Length);
-            //Assert.AreEqual(2, file.Tag.Years.Length);
-            
-            //Assert.AreEqual(1, file.Tag.Artists.Length);
-            //Assert.AreEqual(2, file.Tag.Genres.Length);
-        }
-        
-        [Test]
-        [Ignore("Multiple tags not supported")]
         public void FirstTag()
         {
-            // Again, we don't support multiples
-            
-            //Assert.AreEqual("MP3 title v2", file.Tag.Titles[0] as string);
-            //Assert.AreEqual("MP3 album v2", file.Tag.Albums[0] as string);
-            //Assert.AreEqual("MP3 comment v2", file.Tag.Comments[0] as 
string);
-            //Assert.AreEqual(1234, (int)file.Tag.Years[0]);
-            //Assert.AreEqual(6, (int)file.Tag.Tracks[0]);
-            //Assert.AreEqual(7, (int)file.Tag.TrackCounts[0]);
+            Assert.AreEqual("MP3 title v2", file.GetTag 
(TagLib.TagTypes.Id3v2).Title);
+            Assert.AreEqual("MP3 album v2", file.GetTag 
(TagLib.TagTypes.Id3v2).Album);
+            Assert.AreEqual("MP3 comment v2", file.GetTag 
(TagLib.TagTypes.Id3v2).Comment);
+            Assert.AreEqual(1234, (int)file.GetTag 
(TagLib.TagTypes.Id3v2).Year);
+            Assert.AreEqual(6, (int)file.GetTag (TagLib.TagTypes.Id3v2).Track);
+            Assert.AreEqual(7, (int)file.GetTag 
(TagLib.TagTypes.Id3v2).TrackCount);
         }
 
         [Test]
-        [Ignore("Multiple tags not supported")]
         public void SecondTag()
         {
-            // Again, we don't support multiples
-            
-            //Assert.AreEqual("MP3 title", file.Tag.Titles[1] as string);
-            //Assert.AreEqual("MP3 album", file.Tag.Albums[1] as string);
-            //Assert.AreEqual("MP3 comment", file.Tag.Comments[1] as string);
-            Assert.AreEqual("MP3 artist", file.Tag.Artists[0] as string);
-            //Assert.AreEqual(1235, (int)file.Tag.Years[1]);
-            //Assert.AreEqual(6, (int)file.Tag.Tracks[1]);
-            //Assert.AreEqual(7, (int)file.Tag.TrackCounts[0]);
+            Assert.AreEqual("MP3 title", file.GetTag 
(TagLib.TagTypes.Id3v1).Title);
+            Assert.AreEqual("MP3 album", file.GetTag 
(TagLib.TagTypes.Id3v1).Album);
+            Assert.AreEqual("MP3 comment", file.GetTag 
(TagLib.TagTypes.Id3v1).Comment);
+            Assert.AreEqual("MP3 artist", file.GetTag 
(TagLib.TagTypes.Id3v1).FirstArtist);
+            Assert.AreEqual(1235, (int)file.GetTag 
(TagLib.TagTypes.Id3v1).Year);
+            Assert.AreEqual(6, (int)file.GetTag (TagLib.TagTypes.Id3v1).Track);
+            Assert.AreEqual(0, (int)file.GetTag 
(TagLib.TagTypes.Id3v1).TrackCount);
         }
     }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to