[chronojump] Encoder: check if data is ok before fixCells
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder: check if data is ok before fixCells
- Date: Thu, 26 Apr 2018 15:41:45 +0000 (UTC)
commit f75f9c9c60f96271a1e02f45190bdc433a048e79
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Apr 26 15:33:19 2018 +0200
Encoder: check if data is ok before fixCells
src/gui/encoderTreeviews.cs | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 9ecdeae..bfe28db 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -103,6 +103,11 @@ public partial class ChronoJumpWindow
curvesCount ++;
string [] cells = line.Split(new char[] {','});
+
+ //check if data is ok
+ if(! fixDecimalsWillWork(true, cells))
+ return curvesCount;
+
cells = fixDecimals(true, cells);
/*
@@ -553,6 +558,11 @@ public partial class ChronoJumpWindow
curvesCount ++;
string [] cells = line.Split(new char[] {','});
+
+ //check if data is ok
+ if(! fixDecimalsWillWork(false, cells))
+ return curvesCount;
+
cells = fixDecimals(false, cells);
@@ -1372,6 +1382,17 @@ public partial class ChronoJumpWindow
/* end of rendering neuromuscular cols */
+ //check if there are enought cells, sometimes file is created but data is not completely written
+ private bool fixDecimalsWillWork(bool captureOrAnalyze, string [] cells)
+ {
+ LogB.Information(string.Format("captureOrAnalyze: {0}, cells.Length: {1}", captureOrAnalyze,
cells.Length));
+ if(captureOrAnalyze && cells.Length < 18) //from 0 to 17
+ return false;
+ else if(! captureOrAnalyze && cells.Length < 20) //from 0 to 19
+ return false;
+
+ return true;
+ }
//captureOrAnalyze is true on capture, false on analyze
private string [] fixDecimals(bool captureOrAnalyze, string [] cells)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]