[chronojump] Fixing character problems on encoderSaveCurve



commit 4eba83ad8cbb5a248623e2e37656201bd0f3c727
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Jun 19 12:27:43 2016 +0200

    Fixing character problems on encoderSaveCurve

 src/gui/encoder.cs |    4 ++++
 src/utilEncoder.cs |   17 +++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 5295944..f2b4efe 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1830,6 +1830,10 @@ public partial class ChronoJumpWindow
                                        inertialCheckStart, inertialCheckDuration, (ecconLast == "c"), 
                                        currentSession.UniqueID, currentPerson.UniqueID, 
                                        currentPerson.Name, encoderTimeStamp, curveIDMax);
+                       
+                       //there was a problem copying
+                       if(fileSaved == "")
+                               return "";
 
                        //save it to SQL (encoderSignalCurve table)
                        SqliteEncoder.SignalCurveInsert(dbconOpened, 
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index b2a4608..6f50d22 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -713,12 +713,17 @@ public class UtilEncoder
                        contents = contentsReversed;
                }
 
-               
-               TextWriter writer = File.CreateText(fileCurveFull);
-               writer.Write(contents);
-               writer.Flush();
-               writer.Close();
-               ((IDisposable)writer).Dispose();
+               try {
+                       TextWriter writer = File.CreateText(fileCurveFull);
+                       writer.Write(contents);
+                       writer.Flush();
+                       writer.Close();
+                       ((IDisposable)writer).Dispose();
+               }
+               catch {
+                       LogB.Error("Problems on EncoderSaveCurve with file: " + fileCurveFull);
+                       return "";
+               }
 
                return fileCurve;
        }


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