Author: abock
Date: 2006-03-20 00:00:21 -0500 (Mon, 20 Mar 2006)
New Revision: 58172

Modified:
   trunk/entagged-sharp/ChangeLog
   trunk/entagged-sharp/src/EncodingInfo.cs
Log:
2006-03-15  Aaron Bockover  <[EMAIL PROTECTED]>

    * src/EncodingInfo.cs: Handle invalid integer durations



Modified: trunk/entagged-sharp/ChangeLog
===================================================================
--- trunk/entagged-sharp/ChangeLog      2006-03-19 23:18:01 UTC (rev 58171)
+++ trunk/entagged-sharp/ChangeLog      2006-03-20 05:00:21 UTC (rev 58172)
@@ -1,3 +1,7 @@
+2006-03-15  Aaron Bockover  <[EMAIL PROTECTED]>
+
+       * src/EncodingInfo.cs: Handle invalid integer durations
+
 2006-03-15  Daniel Drake  <[EMAIL PROTECTED]>
 
        * entagged-sharp: Remove all in-file CVS $Log sections

Modified: trunk/entagged-sharp/src/EncodingInfo.cs
===================================================================
--- trunk/entagged-sharp/src/EncodingInfo.cs    2006-03-19 23:18:01 UTC (rev 
58171)
+++ trunk/entagged-sharp/src/EncodingInfo.cs    2006-03-20 05:00:21 UTC (rev 
58172)
@@ -78,7 +78,15 @@
         //Sets the length of the song in seconds
         public TimeSpan Duration {
             set { content["DURATION"] = value; }
-            get { return (TimeSpan) content["DURATION"]; }
+            get { 
+                object o = content["DURATION"];
+                if(o is TimeSpan) {
+                    return (TimeSpan)o;
+                }
+                
+                int duration = (int)o;
+                return duration < 0 ? new TimeSpan(0) : new TimeSpan(duration 
* TimeSpan.TicksPerSecond);
+            }
         }
         
         public bool Vbr {

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

Reply via email to