public static void UpdateSerial(object sender, EventArgs e) { lock (Devices) { DS4Device device = (DS4Device)sender; if (device != null) { string devPath = device.HidDevice.DevicePath; string serial = device.getMacAddress(); if (Devices.ContainsKey(devPath)) { deviceSerials.Remove(serial); device.updateSerial(); serial = device.getMacAddress(); if (DS4Device.isValidSerial(serial)) { deviceSerials.Add(serial); } if (device.ShouldRunCalib()) { device.RefreshCalibration(); } } } } }