Search all possible registry locations for the Heatmaster serial port.
authormoel.mich
Tue, 24 Aug 2010 22:11:10 +0000
changeset 175e4ee19d583bd
parent 174 51d62ed28ff5
child 176 c16fd81b520a
Search all possible registry locations for the Heatmaster serial port.
Hardware/Heatmaster/HeatmasterGroup.cs
Properties/AssemblyVersion.cs
     1.1 --- a/Hardware/Heatmaster/HeatmasterGroup.cs	Tue Aug 24 20:14:54 2010 +0000
     1.2 +++ b/Hardware/Heatmaster/HeatmasterGroup.cs	Tue Aug 24 22:11:10 2010 +0000
     1.3 @@ -69,20 +69,20 @@
     1.4  
     1.5      private static string[] GetRegistryPortNames() {
     1.6        List<string> result = new List<string>();
     1.7 +      string[] paths = { "", "&MI_00" };
     1.8        try {
     1.9 -        RegistryKey key = Registry.LocalMachine.OpenSubKey(
    1.10 -          @"SYSTEM\CurrentControlSet\Enum\USB\VID_10C4&PID_EA60");
    1.11 -        if (key == null)
    1.12 -          key = Registry.LocalMachine.OpenSubKey(
    1.13 -            @"SYSTEM\CurrentControlSet\Enum\USB\VID_10C4&PID_EA60&MI_00");           
    1.14 -        if (key != null) {
    1.15 -          foreach (string subKeyName in key.GetSubKeyNames()) {
    1.16 -            RegistryKey subKey =
    1.17 -              key.OpenSubKey(subKeyName + "\\" + "Device Parameters");
    1.18 -            if (subKey != null) {
    1.19 -              string name = subKey.GetValue("PortName") as string;
    1.20 -              if (name != null)
    1.21 -                result.Add((string)name);
    1.22 +        foreach (string path in paths) {
    1.23 +          RegistryKey key = Registry.LocalMachine.OpenSubKey(
    1.24 +            @"SYSTEM\CurrentControlSet\Enum\USB\VID_10C4&PID_EA60" + path);
    1.25 +          if (key != null) {
    1.26 +            foreach (string subKeyName in key.GetSubKeyNames()) {
    1.27 +              RegistryKey subKey =
    1.28 +                key.OpenSubKey(subKeyName + "\\" + "Device Parameters");
    1.29 +              if (subKey != null) {
    1.30 +                string name = subKey.GetValue("PortName") as string;
    1.31 +                if (name != null && !result.Contains(name))
    1.32 +                  result.Add((string)name);
    1.33 +              }
    1.34              }
    1.35            }
    1.36          }
     2.1 --- a/Properties/AssemblyVersion.cs	Tue Aug 24 20:14:54 2010 +0000
     2.2 +++ b/Properties/AssemblyVersion.cs	Tue Aug 24 22:11:10 2010 +0000
     2.3 @@ -38,5 +38,5 @@
     2.4  using System;
     2.5  using System.Reflection;
     2.6  
     2.7 -[assembly: AssemblyVersion("0.1.37.8")]
     2.8 -[assembly: AssemblyFileVersion("0.1.37.8")]
     2.9 +[assembly: AssemblyVersion("0.1.37.9")]
    2.10 +[assembly: AssemblyFileVersion("0.1.37.9")]