[chronojump] Fixed 652133 crash on load multichronopic data when locale problems



commit 44854450cc4adba8508f4476b0302685892c8c34
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jun 8 20:37:31 2011 +0200

    Fixed 652133 crash on load multichronopic data when locale problems

 src/multiChronopic.cs        |   17 +++++++++--------
 src/sqlite/multiChronopic.cs |   18 +++++++++---------
 2 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/src/multiChronopic.cs b/src/multiChronopic.cs
index 1a0488e..a1a156e 100644
--- a/src/multiChronopic.cs
+++ b/src/multiChronopic.cs
@@ -77,6 +77,7 @@ public class MultiChronopic : Event
 	}
 	
 	//used to select a event at SqliteMultiChronopic.SelectMultiChronopicData and at Sqlite.convertTables
+	//Util.ConvertToPointIfNeeded is used because multichronopic data is recorded by mistake as ',' instead of '.' on database
 	public MultiChronopic(string [] eventString) {
 		this.uniqueID = Convert.ToInt32(eventString[0]);
 		this.personID = Convert.ToInt32(eventString[1]);
@@ -86,14 +87,14 @@ public class MultiChronopic : Event
 		this.cp2StartedIn = Convert.ToInt32(eventString[5]);
 		this.cp3StartedIn = Convert.ToInt32(eventString[6]);
 		this.cp4StartedIn = Convert.ToInt32(eventString[7]);
-		this.cp1InStr = eventString[8];
-		this.cp1OutStr = eventString[9];
-		this.cp2InStr = eventString[10];
-		this.cp2OutStr = eventString[11];
-		this.cp3InStr = eventString[12];
-		this.cp3OutStr = eventString[13];
-		this.cp4InStr = eventString[14];
-		this.cp4OutStr = eventString[15];
+		this.cp1InStr  = Util.ConvertToPointIfNeeded(eventString[8]);
+		this.cp1OutStr = Util.ConvertToPointIfNeeded(eventString[9]);
+		this.cp2InStr  = Util.ConvertToPointIfNeeded(eventString[10]);
+		this.cp2OutStr = Util.ConvertToPointIfNeeded(eventString[11]);
+		this.cp3InStr  = Util.ConvertToPointIfNeeded(eventString[12]);
+		this.cp3OutStr = Util.ConvertToPointIfNeeded(eventString[13]);
+		this.cp4InStr  = Util.ConvertToPointIfNeeded(eventString[14]);
+		this.cp4OutStr = Util.ConvertToPointIfNeeded(eventString[15]);
 		this.vars = eventString[16];
 		this.description = eventString[17];
 		this.simulated = Convert.ToInt32(eventString[18]);
diff --git a/src/sqlite/multiChronopic.cs b/src/sqlite/multiChronopic.cs
index a56055c..5159866 100644
--- a/src/sqlite/multiChronopic.cs
+++ b/src/sqlite/multiChronopic.cs
@@ -142,7 +142,7 @@ class SqliteMultiChronopic : Sqlite
 
 		
 		while(reader.Read()) {
-
+			//Util.ConvertToPointIfNeeded is used because multichronopic data is recorded by mistake as ',' instead of '.' on database
 			myArray.Add (reader[0].ToString() + ":" +	//person.name
 					reader[1].ToString() + ":" +	//mc.uniqueID
 					reader[2].ToString() + ":" + 	//mc.personID
@@ -152,14 +152,14 @@ class SqliteMultiChronopic : Sqlite
 					reader[6].ToString() + ":" + 	//mc.cp2StartedIn
 					reader[7].ToString() + ":" + 	//mc.cp3StartedIn
 					reader[8].ToString() + ":" + 	//mc.cp4StartedIn
-					reader[9].ToString() + ":" + 	//mc.cp1InStr
-					reader[10].ToString() + ":" + 	//mc.cp1OutStr
-					reader[11].ToString() + ":" + 	//mc.cp2InStr
-					reader[12].ToString() + ":" + 	//mc.cp2OutStr
-					reader[13].ToString() + ":" + 	//mc.cp3InStr
-					reader[14].ToString() + ":" + 	//mc.cp3OutStr
-					reader[15].ToString() + ":" + 	//mc.cp4InStr
-					reader[16].ToString() + ":" + 	//mc.cp4OutStr
+					Util.ConvertToPointIfNeeded(reader[9].ToString()) + ":" + 	//mc.cp1InStr
+					Util.ConvertToPointIfNeeded(reader[10].ToString()) + ":" + 	//mc.cp1OutStr
+					Util.ConvertToPointIfNeeded(reader[11].ToString()) + ":" + 	//mc.cp2InStr
+					Util.ConvertToPointIfNeeded(reader[12].ToString()) + ":" + 	//mc.cp2OutStr
+					Util.ConvertToPointIfNeeded(reader[13].ToString()) + ":" + 	//mc.cp3InStr
+					Util.ConvertToPointIfNeeded(reader[14].ToString()) + ":" + 	//mc.cp3OutStr
+					Util.ConvertToPointIfNeeded(reader[15].ToString()) + ":" + 	//mc.cp4InStr
+					Util.ConvertToPointIfNeeded(reader[16].ToString()) + ":" + 	//mc.cp4OutStr
 					reader[17].ToString() + ":" + 	//vars
 					reader[18].ToString() + ":" + 	//description
 					reader[19].ToString()		//simulated



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