[chronojump] Fixed crash on encoder analysis ecS



commit 9a4e83d68730cd95d81276f67bbe4fbeeb7f536f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Dec 16 21:26:03 2015 +0100

    Fixed crash on encoder analysis ecS

 src/encoder.cs              |   25 ++++++++++++++++++++++++-
 src/gui/encoderTreeviews.cs |    4 ++++
 2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 0ac8ad2..6a48e08 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -301,9 +301,32 @@ public class EncoderCurve
                int num;
                return int.TryParse(N, out num);
        }
+
+       //check if last char is 'e' or 'c'
+       private bool isValidLastCharN() {
+               if(N.Length <= 1)
+                       return false;
+               
+               char lastChar = N[N.Length-1];
+               if(lastChar == 'e' || lastChar == 'c')
+                       return true;
+               
+               return false;
+       }
+       //check if it's "21c" or "15e"
+       public bool IsNumberNandEorC() {
+               if(N.Length <= 1)
+                       return false;
+
+               int num;
+               if(int.TryParse(N.Substring(0, N.Length-1), out num) && isValidLastCharN())
+                       return true;
+
+               return false;
+       }
        //at least for RenderNAnalyze
        public bool IsValidN() {
-               if (N == "AVG" || N == "SD" || IsNumberN())
+               if (N == "AVG" || N == "SD" || IsNumberN() || IsNumberNandEorC())
                        return true;
                return false;
        }
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index e5c48f5..ebe0a01 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -916,6 +916,10 @@ public partial class ChronoJumpWindow
                        (cell as Gtk.CellRendererText).Markup = "<b>" + Catalog.GetString(curve.N) + "</b>";
                        return;
                }
+               else if(curve.IsNumberNandEorC()) { //maybe from R comes and '21c' or '15e'. Just write it
+                       (cell as Gtk.CellRendererText).Text = curve.N;
+                       return;
+               }
                
                if(check_encoder_analyze_signal_or_curves.Active && findEccon(false) == "ecS") 
                {


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