From 0bcac887430c45a2ffc0924da0710f098049d91f Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Mon, 2 Oct 2017 16:57:23 +0200
Subject: [PATCH] VectoCSVFile: changed write method (added own case for
 ConvertedSI formatting)

---
 VectoCore/VectoCore/Utils/VectoCSVFile.cs | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/VectoCore/VectoCore/Utils/VectoCSVFile.cs b/VectoCore/VectoCore/Utils/VectoCSVFile.cs
index 72ad520413..6d5f9469e8 100644
--- a/VectoCore/VectoCore/Utils/VectoCSVFile.cs
+++ b/VectoCore/VectoCore/Utils/VectoCSVFile.cs
@@ -222,10 +222,19 @@ namespace TUGraz.VectoCore.Utils
 				var items = row.ItemArray;
 				var formattedList = new string[items.Length];
 				for (var i = 0; i < items.Length; i++) {
-					var si = items[i] as SI;
-					formattedList[i] = si != null
-						? columnFormatter[i](si)
-						: formattedList[i] = string.Format(CultureInfo.InvariantCulture, "{0}", items[i]);
+
+                    if (items[i] is SI) {
+                        formattedList[i] = columnFormatter[i]((SI)items[i]);
+                    //}
+                    //else if (items[i] is ConvertedSI)
+                    //{
+                    //    // todo mk-2017-10-02: maybe we also have to use decimals and showUnit from columnFormatter here?
+                    //    formattedList[i] = items[i].ToString();
+                    } else {
+                        formattedList[i] = string.Format(CultureInfo.InvariantCulture, "{0}", items[i]);
+                    }
+
+                    // if a string contains a "," then it has to be contained in quotes in order to be correctly recognized in a CSV file.
 					if (formattedList[i].Contains(Delimiter)) {
 						formattedList[i] = string.Format("\"{0}\"", formattedList[i]);
 					}
-- 
GitLab