HidDevice.cs
changeset 71 c28dd93b94c5
parent 69 b27d6b8527e2
child 72 471b1d45c46a
     1.1 --- a/HidDevice.cs	Wed Mar 04 20:52:24 2015 +0100
     1.2 +++ b/HidDevice.cs	Thu Mar 05 10:12:37 2015 +0100
     1.3 @@ -243,9 +243,20 @@
     1.4                  FriendlyName = Product + suffix;
     1.5              }
     1.6              else
     1.7 -            {
     1.8 -                //No proper name just use the device ID instead
     1.9 -                FriendlyName = "0x" + ProductId.ToString("X4") + suffix;
    1.10 +            {   
    1.11 +                //Extract friendly name from name
    1.12 +                char[] delimiterChars = { '#', '&'};
    1.13 +                string[] words = Name.Split(delimiterChars);
    1.14 +                if (words.Length >= 2)
    1.15 +                {
    1.16 +                    //Use our name sub-string to describe this device
    1.17 +                    FriendlyName = words[1] + " - 0x" + ProductId.ToString("X4") + suffix;
    1.18 +                }
    1.19 +                else
    1.20 +                {
    1.21 +                    //No proper name just use the device ID instead
    1.22 +                    FriendlyName = "0x" + ProductId.ToString("X4") + suffix;
    1.23 +                }
    1.24              }
    1.25  
    1.26          }