private void HandleDevices() // Add available and hidden devices from previous time, that the application stored in the file (settings.ini). All hidden devices are stored on application exit. { string devices = HIDGuardianAPI.GetDevicesList().TrimEnd(';'); if (AffectedDevices != "") // Add affected hidden devices from last time acquired from the settings.ini { foreach (string affecteddevice in AffectedDevices.Split(';')) { if (affecteddevice.Contains(":")) { HIDGuardianAPI.HideDevice(affecteddevice.Split(':')[1]); HIDGuardianAPI.ReplugHID(affecteddevice.Split(':')[1]); HiddenDevicesListBox.Items.Add(affecteddevice); } } } if (devices != "") // Add all (available) devices excluding the ones from the last segment. { foreach (string device in devices.Split(';')) { if (!AffectedDevices.Contains(device)) { AvailableDevicesListBox.Items.Add(device); } } } }