Author: bnickel
Date: 2007-09-05 20:25:26 -0400 (Wed, 05 Sep 2007)
New Revision: 85387

Modified:
   trunk/taglib-sharp/ChangeLog
   trunk/taglib-sharp/configure.ac
   trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
   trunk/taglib-sharp/src/TagLib/Flac/Block.cs
   trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
Log:
2007-09-05  Brian Nickel <[EMAIL PROTECTED]>

        * src/TagLib/Flac/Block.cs: Completed docs.
        
        * src/TagLib/Id3v2/Tag.cs: GetItemAsUInt32 was fubar and always
        returning zero. (Thanks to renzska for the bug report.) Always set the
        encoding to the default when setting the contents of a frame. This
        should hopefully prevent bad encoding. (Thanks to evgeni for the bug
        report.)

        * src/TagLib/Ape/Tag.cs: GetItemAsUInt32 was fubar and always returning
        zero.
        
        * configure.ac:  Now 2.0.2.13.




Modified: trunk/taglib-sharp/ChangeLog
===================================================================
--- trunk/taglib-sharp/ChangeLog        2007-09-05 22:12:40 UTC (rev 85386)
+++ trunk/taglib-sharp/ChangeLog        2007-09-06 00:25:26 UTC (rev 85387)
@@ -1,3 +1,18 @@
+2007-09-05  Brian Nickel <[EMAIL PROTECTED]>
+
+       * src/TagLib/Flac/Block.cs: Completed docs.
+       
+       * src/TagLib/Id3v2/Tag.cs: GetItemAsUInt32 was fubar and always
+       returning zero. (Thanks to renzska for the bug report.) Always set the
+       encoding to the default when setting the contents of a frame. This
+       should hopefully prevent bad encoding. (Thanks to evgeni for the bug
+       report.)
+
+       * src/TagLib/Ape/Tag.cs: GetItemAsUInt32 was fubar and always returning
+       zero.
+       
+       * configure.ac:  Now 2.0.2.13.
+
 2007-09-04  Brian Nickel <[EMAIL PROTECTED]>
 
        Only 713 public members away from doing away with MonoDoc.

Modified: trunk/taglib-sharp/configure.ac
===================================================================
--- trunk/taglib-sharp/configure.ac     2007-09-05 22:12:40 UTC (rev 85386)
+++ trunk/taglib-sharp/configure.ac     2007-09-06 00:25:26 UTC (rev 85387)
@@ -3,7 +3,7 @@
 
 ASSEMBLY_NAME="taglib-sharp"
 
-VERSION="2.0.2.12"
+VERSION="2.0.2.13"
 ASSEMBLY_VERSION="$VERSION"
 
 POLICY_2_0_VERSIONS="2.0.0.0-$ASSEMBLY_VERSION"

Modified: trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Ape/Tag.cs    2007-09-05 22:12:40 UTC (rev 
85386)
+++ trunk/taglib-sharp/src/TagLib/Ape/Tag.cs    2007-09-06 00:25:26 UTC (rev 
85387)
@@ -649,7 +649,7 @@
                                return 0;
                        
                        string [] values = text.Split (new char [] {'/'},
-                               index);
+                               index + 2);
                        
                        if (values.Length < index + 1)
                                return 0;

Modified: trunk/taglib-sharp/src/TagLib/Flac/Block.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Flac/Block.cs 2007-09-05 22:12:40 UTC (rev 
85386)
+++ trunk/taglib-sharp/src/TagLib/Flac/Block.cs 2007-09-06 00:25:26 UTC (rev 
85387)
@@ -1,5 +1,5 @@
 //
-// Block.cs:
+// Block.cs: Represents a Flac metadata block.
 //
 // Author:
 //   Brian Nickel ([EMAIL PROTECTED])
@@ -21,55 +21,180 @@
 // USA
 //
 
+using System;
 using System.Collections.Generic;
-using System;
 
-namespace TagLib.Flac
-{
-   public class Block
-   {
-      private BlockHeader _header;
-      private ByteVector  _data;
-      
-      public Block (BlockHeader header, ByteVector data)
-      {
-         if (data == null)
-            throw new ArgumentNullException ("data");
-         
-         if (header.BlockSize != data.Count)
-            throw new CorruptFileException ("Data count not equal to block 
size.");
-         
-         _header = header;
-         _data   = data;
-      }
-      
-      public Block (BlockType type, ByteVector data)
-      {
-         if (data == null)
-            throw new ArgumentNullException ("data");
-         
-         _header = new BlockHeader (type, (uint) data.Count);
-         
-         if (_header.BlockSize != data.Count)
-            throw new CorruptFileException ("Data count not equal to block 
size.");
-         
-         _data   = data;
-      }
-      
-      public ByteVector Render (bool isLastBlock)
-      {
-         if (_data == null)
-            throw new InvalidOperationException ("Cannot render empty 
blocks.");
-         
-         ByteVector data = _header.Render (isLastBlock);
-         data.Add (_data);
-         return data;
-      }
-      
-      public   BlockType   Type        {get {return _header.BlockType;}}
-      public   bool        IsLastBlock {get {return _header.IsLastBlock;}}
-      public   uint        DataSize    {get {return _header.BlockSize;}}
-      public   uint        TotalSize   {get {return DataSize + 
BlockHeader.Size;}}
-      public   ByteVector  Data        {get {return _data;}}
-   }
-}
+namespace TagLib.Flac {
+       /// <summary>
+       ///    This class represents a Flac metadata block.
+       /// </summary>
+       public class Block
+       {
+               #region Private Fields
+               
+               /// <summary>
+               ///    Contains the block header.
+               /// </summary>
+               private BlockHeader header;
+               
+               /// <summary>
+               ///    Contains the block data.
+               /// </summary>
+               private ByteVector data;
+               
+               #endregion
+               
+               
+               
+               #region Constructors
+               
+               /// <summary>
+               ///    Constructs and initializes a new instance of <see
+               ///    cref="Block" /> with a specified header and internal
+               ///    data.
+               /// </summary>
+               /// <param name="header">
+               ///    A <see cref="BlockHeader" /> object containing the
+               ///    header to use for the new instance.
+               /// </param>
+               /// <param name="data">
+               ///    A <see cref="ByteVector" /> object containing the data
+               ///    to be contained in the new instance.
+               /// </param>
+               /// <exception cref="ArgumentNullException">
+               ///    <paramref name="data" /> is <see langword="null" />.
+               /// </exception>
+               /// <exception cref="CorruptFileException">
+               ///    The size of <paramref name="data" /> does not match the
+               ///    size specified in <paramref name="header" />.
+               /// </exception>
+               public Block (BlockHeader header, ByteVector data)
+               {
+                       if (data == null)
+                               throw new ArgumentNullException ("data");
+                       
+                       if (header.BlockSize != data.Count)
+                               throw new CorruptFileException (
+                                       "Data count not equal to block size.");
+                       
+                       this.header = header;
+                       this.data = data;
+               }
+               
+               /// <summary>
+               ///    Constructs and initializes a new instance of <see
+               ///    cref="Block" /> with of a specified type and internal
+               ///    data.
+               /// </summary>
+               /// <param name="type">
+               ///    A <see cref="BlockType" /> value indicating the type of
+               ///    data stored in <paramref name="data" />.
+               /// </param>
+               /// <param name="data">
+               ///    A <see cref="ByteVector" /> object containing the data
+               ///    to be contained in the new instance.
+               /// </param>
+               /// <exception cref="ArgumentNullException">
+               ///    <paramref name="data" /> is <see langword="null" />.
+               /// </exception>
+               public Block (BlockType type, ByteVector data)
+               {
+                       if (data == null)
+                               throw new ArgumentNullException ("data");
+                       
+                       header = new BlockHeader (type, (uint) data.Count);
+                       
+                       this.data = data;
+               }
+               
+               #endregion
+               
+               
+               
+               #region Public Properties
+               
+               /// <summary>
+               ///    Gets the type of data contained in the current instance.
+               /// </summary>
+               /// <value>
+               ///    A <see cref="BlockType" /> value indicating the type of
+               ///    data contained in <see cref="Data" />.
+               /// </value>
+               public BlockType Type {
+                       get {return header.BlockType;}
+               }
+               
+               /// <summary>
+               ///    Gets whether or not the block represented by the current
+               ///    instance is the last metadata block in the Flac stream.
+               /// </summary>
+               /// <value>
+               ///    <see langword="true" /> if the block represented by the
+               ///    current instance was the last one to appear in the file
+               ///    and is followed immediately by the audio data, or <see
+               ///    langword="false" /> if another block appears after the
+               ///    current one or the block was not read from disk.
+               /// </value>
+               public bool IsLastBlock {
+                       get {return header.IsLastBlock;}
+               }
+               
+               /// <summary>
+               ///    Gets the size of the data contained in the current
+               ///    instance.
+               /// </summary>
+               public uint DataSize {
+                       get {return header.BlockSize;}
+               }
+               
+               /// <summary>
+               ///    Gets the total size of the block represented by the
+               ///    current instance as it appears on disk.
+               /// </summary>
+               public uint TotalSize {
+                       get {return DataSize + BlockHeader.Size;}
+               }
+               
+               /// <summary>
+               ///    Gets the data contained in the current instance.
+               /// </summary>
+               /// <value>
+               ///    A <see cref="ByteVector" /> object containing the data
+               ///    stored in the current instance.
+               /// </value>
+               public ByteVector Data {
+                       get {return data;}
+               }
+               
+               #endregion
+               
+               
+               
+               #region Public Methods
+               
+               /// <summary>
+               ///    Renders the current instance as a raw Flac metadata
+               ///    block.
+               /// </summary>
+               /// <param name="isLastBlock">
+               ///    A <see cref="bool" /> value indicating whether or not the
+               ///    block is to be marked as the last metadata block.
+               /// </param>
+               /// <returns>
+               ///    A <see cref="ByteVector" /> object containing the
+               ///    rendered version of the current instance.
+               /// </returns>
+               public ByteVector Render (bool isLastBlock)
+               {
+                       if (this.data == null)
+                               throw new InvalidOperationException (
+                                       "Cannot render empty blocks.");
+                       
+                       ByteVector data = header.Render (isLastBlock);
+                       data.Add (this.data);
+                       return data;
+               }
+               
+               #endregion
+       }
+}
\ No newline at end of file

Modified: trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs  2007-09-05 22:12:40 UTC (rev 
85386)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs  2007-09-06 00:25:26 UTC (rev 
85387)
@@ -387,17 +387,18 @@
                                        "Identifier must be four bytes long.",
                                        "ident");
                        
-                       bool invalid = true;
                        if (text != null)
-                               for (int i = 0; invalid && i < text.Length; i 
++)
-                                       if (!string.IsNullOrEmpty (text [i]))
-                                               invalid = false;
+                               for (int i = 0; i < text.Length; i ++)
+                                       if (!string.IsNullOrEmpty (text [i])) {
+                                               RemoveFrames (ident);
+                                               return;
+                                       }
                        
-                       if (invalid)
-                               RemoveFrames (ident);
-                       else
-                               TextInformationFrame.Get (this, ident, true)
-                                       .Text = text;
+                       TextInformationFrame frame =
+                               TextInformationFrame.Get (this, ident, true);
+                       
+                       frame.Text = text;
+                       frame.TextEncoding = DefaultEncoding;
                }
                
                /// <summary>
@@ -955,7 +956,7 @@
                                return 0;
                        
                        string [] values = text.Split (new char [] {'/'},
-                               index);
+                               index + 2);
                        
                        if (values.Length < index + 1)
                                return 0;
@@ -1114,8 +1115,11 @@
                                return f != null ? f.ToString () : null;
                        }
                        set {
-                               CommentsFrame.Get (this, String.Empty, Language,
-                                       true).Text = value;
+                               CommentsFrame frame = CommentsFrame.Get (this,
+                                       String.Empty, Language, true);
+                               
+                               frame.Text = value;
+                               frame.TextEncoding = DefaultEncoding;
                        }
                }
                
@@ -1304,9 +1308,12 @@
                                return f != null ? f.ToString () : null;
                        }
                        set {
-                               UnsynchronisedLyricsFrame.Get (this,
-                                       String.Empty, Language, true).Text =
-                                               value;
+                               UnsynchronisedLyricsFrame frame =
+                                       UnsynchronisedLyricsFrame.Get (this,
+                                               String.Empty, Language, true);
+                               
+                               frame.Text = value;
+                               frame.TextEncoding = DefaultEncoding;
                        }
                }
                

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

Reply via email to