[chronojump] If ChronopicRegister finds a A50285BI inserts on list but not in SQL



commit 19e624a504595810f4e2dcd3134425309490c605
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed May 18 11:53:52 2022 +0200

    If ChronopicRegister finds a A50285BI inserts on list but not in SQL

 src/chronopicRegister.cs | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/chronopicRegister.cs b/src/chronopicRegister.cs
index 01e3991a5..104195f43 100644
--- a/src/chronopicRegister.cs
+++ b/src/chronopicRegister.cs
@@ -118,10 +118,11 @@ public class ChronopicRegisterPortList
                return false;
        }
 
-       public void Add (ChronopicRegisterPort crp)
+       public void Add (ChronopicRegisterPort crp, bool insertSQL)
        {
                //Add to SQL
-               SqliteChronopicRegister.Insert(false, crp);
+               if (insertSQL)
+                       SqliteChronopicRegister.Insert(false, crp);
 
                //Add to list
                L.Add(crp);
@@ -245,10 +246,17 @@ public abstract class ChronopicRegister
                if(! crp.FTDI)
                        return;
 
-               if (! crpl.Exists(crp))
-                       crpl.Add(crp);
-               else if(crpl.PortChanged(crp))
-                       crpl.UpdatePort(crp, crp.Port);
+               //special case for the massively repeated A50285BI
+               if (crp.SerialNumber == "A50285BI")
+               {
+                       crpl.Add (crp, false); //only add to the current list
+                       return;
+               }
+
+               if (! crpl.Exists (crp))
+                       crpl.Add (crp, true);
+               else if(crpl.PortChanged (crp))
+                       crpl.UpdatePort (crp, crp.Port);
        }
 
        //unused


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