Added blank serial string as const

This commit is contained in:
Travis Nickles 2019-10-25 18:17:10 -05:00
parent 66321306f3
commit d48a2b3ec9

View File

@ -25,6 +25,8 @@ namespace DS4Windows
private readonly HidDeviceCapabilities _deviceCapabilities; private readonly HidDeviceCapabilities _deviceCapabilities;
private bool _monitorDeviceEvents; private bool _monitorDeviceEvents;
private string serial = null; private string serial = null;
private const string BLANK_SERIAL = "00:00:00:00:00:00";
internal HidDevice(string devicePath, string description = null) internal HidDevice(string devicePath, string description = null)
{ {
_devicePath = devicePath; _devicePath = devicePath;
@ -484,9 +486,10 @@ namespace DS4Windows
byte[] buffer = new byte[16]; byte[] buffer = new byte[16];
buffer[0] = 18; buffer[0] = 18;
if (readFeatureData(buffer)) if (readFeatureData(buffer))
serial = String.Format("{0:X02}:{1:X02}:{2:X02}:{3:X02}:{4:X02}:{5:X02}", buffer[6], buffer[5], buffer[4], buffer[3], buffer[2], buffer[1]); serial = String.Format("{0:X02}:{1:X02}:{2:X02}:{3:X02}:{4:X02}:{5:X02}",
buffer[6], buffer[5], buffer[4], buffer[3], buffer[2], buffer[1]);
else else
serial = "00:00:00:00:00:00"; serial = BLANK_SERIAL;
return serial; return serial;
} }
@ -505,7 +508,7 @@ namespace DS4Windows
serial = MACAddr; serial = MACAddr;
} }
else else
serial = "00:00:00:00:00:00"; serial = BLANK_SERIAL;
return serial; return serial;
} }