From 05075a314b9ce11a97011266e27ca78ad4204706 Mon Sep 17 00:00:00 2001 From: Generoso Martello Date: Mon, 10 Dec 2018 01:11:08 +0100 Subject: [PATCH] Added support for CM19 Transceiver (X10) --- .../configure/interfaces/configlet/x10.html | 5 ++- HomeGenie/HomeGenie.csproj | 10 +++-- HomeGenie/Program.cs | 1 + HomeGenie/Service/HomeGenieService.cs | 40 +++++++++++++------ HomeGenie/packages.config | 5 ++- 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/BaseFiles/Common/html/pages/configure/interfaces/configlet/x10.html b/BaseFiles/Common/html/pages/configure/interfaces/configlet/x10.html index 03f3a80ce..130bccfe3 100644 --- a/BaseFiles/Common/html/pages/configure/interfaces/configlet/x10.html +++ b/BaseFiles/Common/html/pages/configure/interfaces/configlet/x10.html @@ -69,7 +69,8 @@ HG.Configure.Interfaces.ServiceCall('Hardware.SerialPorts', function (ports) { portSelect.empty().append(''); portSelect.append(''); - portSelect.append(''); + portSelect.append(''); + portSelect.append(''); for (var p = 0; p < ports.length; p++) { portSelect.append(''); } @@ -301,4 +302,4 @@ } }; - \ No newline at end of file + diff --git a/HomeGenie/HomeGenie.csproj b/HomeGenie/HomeGenie.csproj index 062f1e44d..02ed585ec 100644 --- a/HomeGenie/HomeGenie.csproj +++ b/HomeGenie/HomeGenie.csproj @@ -69,6 +69,10 @@ false + + packages\CM19Lib.1.0.3\lib\CM19Lib.dll + True + packages\CommonMark.NET.0.15.1\lib\net45\CommonMark.dll True @@ -130,8 +134,8 @@ packages\MIG.1.0.5\lib\MIG.dll True - - packages\MIG.HomeAutomation.1.0.2\lib\MIG.HomeAutomation.dll + + packages\MIG.HomeAutomation.1.0.3\lib\MIG.HomeAutomation.dll True @@ -226,7 +230,7 @@ False - packages\XTenLib.1.0.10\lib\XTenLib.dll + packages\XTenLib.1.0.11\lib\XTenLib.dll True diff --git a/HomeGenie/Program.cs b/HomeGenie/Program.cs index 78e500129..84b8d1b4a 100644 --- a/HomeGenie/Program.cs +++ b/HomeGenie/Program.cs @@ -62,6 +62,7 @@ private static void PostInstallCheck() "LibUsb.Common.dll", "LibUsbDotNet.LibUsbDotNet.dll", "XTenLib.dll", + "CM19Lib.dll", "ZWaveLib.dll" }; foreach (var f in migFiles) diff --git a/HomeGenie/Service/HomeGenieService.cs b/HomeGenie/Service/HomeGenieService.cs index d8757e67a..dd6692bf0 100644 --- a/HomeGenie/Service/HomeGenieService.cs +++ b/HomeGenie/Service/HomeGenieService.cs @@ -1193,7 +1193,15 @@ internal void modules_Sort() { module.Properties.Sort((ModuleParameter p1, ModuleParameter p2) => { - return p1.Name.CompareTo(p2.Name); + int c = -1; + try + { + c = p1.Name.CompareTo(p2.Name); + } + catch (Exception e) + { + } + return c; }); } // @@ -1201,18 +1209,24 @@ internal void modules_Sort() // systemModules.Sort((Module m1, Module m2) => { - System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(@"([a-zA-Z]+)(\d+)"); - System.Text.RegularExpressions.Match result1 = re.Match(m1.Address); - System.Text.RegularExpressions.Match result2 = re.Match(m2.Address); - - string alphaPart1 = result1.Groups[1].Value.PadRight(8, '0'); - string numberPart1 = (String.IsNullOrWhiteSpace(result1.Groups[2].Value) ? m1.Address.PadLeft(8, '0') : result1.Groups[2].Value.PadLeft(8, '0')); - string alphaPart2 = result2.Groups[1].Value.PadRight(8, '0'); - string numberPart2 = (String.IsNullOrWhiteSpace(result2.Groups[2].Value) ? m2.Address.PadLeft(8, '0') : result2.Groups[2].Value.PadLeft(8, '0')); - - string d1 = m1.Domain + "|" + alphaPart1 + numberPart1; - string d2 = m2.Domain + "|" + alphaPart2 + numberPart2; - return d1.CompareTo(d2); + int c = -1; + try + { + System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(@"([a-zA-Z]+)(\d+)"); + System.Text.RegularExpressions.Match result1 = re.Match(m1.Address); + System.Text.RegularExpressions.Match result2 = re.Match(m2.Address); + + string alphaPart1 = result1.Groups[1].Value.PadRight(8, '0'); + string numberPart1 = (String.IsNullOrWhiteSpace(result1.Groups[2].Value) ? m1.Address.PadLeft(8, '0') : result1.Groups[2].Value.PadLeft(8, '0')); + string alphaPart2 = result2.Groups[1].Value.PadRight(8, '0'); + string numberPart2 = (String.IsNullOrWhiteSpace(result2.Groups[2].Value) ? m2.Address.PadLeft(8, '0') : result2.Groups[2].Value.PadLeft(8, '0')); + + string d1 = m1.Domain + "|" + alphaPart1 + numberPart1; + string d2 = m2.Domain + "|" + alphaPart2 + numberPart2; + + c = d1.CompareTo(d2); + } catch(Exception e) {} + return c; }); } diff --git a/HomeGenie/packages.config b/HomeGenie/packages.config index 348d28fc3..7d99cd46f 100644 --- a/HomeGenie/packages.config +++ b/HomeGenie/packages.config @@ -1,5 +1,6 @@  + @@ -8,7 +9,7 @@ - + @@ -17,6 +18,6 @@ - + \ No newline at end of file