[banshee] [StreamRatingTagger] Use culture invariant double parsing



commit 4956948adc0a55e4d2bb132d1e7b5d2c6b604f05
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Sep 1 15:39:58 2010 -0500

    [StreamRatingTagger] Use culture invariant double parsing
    
    Fixes issue with not being able to properly read back Ogg ratings when
    in cultures that don't use . for the decimal point (bgo#626803)

 .../Banshee.Streaming/StreamRatingTagger.cs        |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Streaming/StreamRatingTagger.cs b/src/Core/Banshee.Core/Banshee.Streaming/StreamRatingTagger.cs
index f196a45..714e4ff 100644
--- a/src/Core/Banshee.Core/Banshee.Streaming/StreamRatingTagger.cs
+++ b/src/Core/Banshee.Core/Banshee.Streaming/StreamRatingTagger.cs
@@ -28,6 +28,7 @@
 
 using System;
 using System.Collections;
+using System.Globalization;
 
 using Banshee.Collection;
 
@@ -197,7 +198,8 @@ namespace Banshee.Streaming
         private static int OggToBanshee (string ogg_rating_str)
         {
             double ogg_rating;
-            if (Double.TryParse (ogg_rating_str, out ogg_rating)) {
+            if (Double.TryParse (ogg_rating_str, NumberStyles.Number,
+                    CultureInfo.InvariantCulture, out ogg_rating)) {
                 // Quod Libet Ogg ratings are stored as a value
                 // between 0.0 and 1.0 inclusive, where unrated = 0.5.
                 if (ogg_rating == 0.5)// unrated



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]