[chronojump] Linux camera code can have more than on digit



commit 1b85ab75e2f6df9fd092137d7668a0c5b543358a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 14 13:56:39 2020 +0100

    Linux camera code can have more than on digit

 src/gui/preferences.cs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 7f0794aa..7d081a5c 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -33,6 +33,7 @@ using System.Threading;
 using System.Globalization; //CultureInfo stuff
 
 using System.Diagnostics;  //Stopwatch
+using System.Text.RegularExpressions; //Regex
 
 
 /*
@@ -956,8 +957,11 @@ public class PreferencesWindow
                if(operatingSystem == UtilAll.OperatingSystems.LINUX)
                {
                        string number = "0";
-                       if(cameraCode.StartsWith("/dev/video") && cameraCode.Length > 10 && 
Util.IsNumber(cameraCode[10], false))
-                              number = cameraCode[10].ToString();
+
+                       //allows to use two-digit codes
+                       Match match = Regex.Match(cameraCode, @"/dev/video/(\d+)");
+                       if(match.Groups.Count == 2)
+                               number = match.Value;
 
                        wfsm = new WebcamFfmpegSupportedModesLinux(number);
                }


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