[chronojump] Better race analyzer read version
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Better race analyzer read version
- Date: Mon, 21 Oct 2019 16:42:13 +0000 (UTC)
commit 675c2b3416e91601e7b18c78c5d1a20476c651e5
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Oct 21 18:35:06 2019 +0200
Better race analyzer read version
src/gui/runEncoder.cs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index 65cd9d7b..2e5770ef 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -28,6 +28,7 @@ using Glade;
using System.Text; //StringBuilder
using System.Collections;
using System.Collections.Generic; //List<T>
+using System.Text.RegularExpressions; //Regex
using Mono.Unix;
@@ -166,7 +167,16 @@ public partial class ChronoJumpWindow
//forceSensorOtherMessage = str;
//return the version without "Race_Analyzer-"
- return(str.Remove(0,14));
+ /*
+ * return(str.Remove(0,14));
+ * use a regex because with above line we can find problems like this:
+ * init string: ^@;Race_analyzer-0.2
+ */
+ Match match = Regex.Match(str, @"Race_Analyzer-(\d+\.\d+)");
+ if(match.Groups.Count == 1)
+ return str = match.Value;
+ else
+ return "0.2"; //if there is a problem default to 0.2. 0.2 is the first that will be
distributed and will be on binary
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]