From d477ad5d9c8c0765c4fe5d85447b3c0155c0ba4c Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Thu, 19 Apr 2018 17:04:25 +1000 Subject: [PATCH] Client: Use UUID if no serial number is found --- Disco.Client/Interop/Hardware.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Disco.Client/Interop/Hardware.cs b/Disco.Client/Interop/Hardware.cs index 595e4fd4..f35aec7c 100644 --- a/Disco.Client/Interop/Hardware.cs +++ b/Disco.Client/Interop/Hardware.cs @@ -242,7 +242,19 @@ namespace Disco.Client.Interop var uUID = (string)mItem.GetPropertyValue("UUID"); if (!string.IsNullOrWhiteSpace(uUID)) + { DeviceHardware.UUID = uUID.Trim(); + + // if serial number is absent attempt using UUID if valid + if (string.IsNullOrWhiteSpace(DeviceHardware.SerialNumber)) + { + Guid uuidGuid; + if (Guid.TryParse(DeviceHardware.UUID, out uuidGuid) && uuidGuid != Guid.Empty) + { + DeviceHardware.SerialNumber = $"UUID{uuidGuid:N}"; + } + } + } } else {