sharpdx/SharpDX — pull request #164 by tomspilman (2013-09-17 04:21:00+00:00)
Title: XInput.Controller.GetCapabilities() Overload

I added a simple new overload to `XInput.Controller.GetCapabilities()` which matches a similar overload for `Controller.GetState()`.

Currently you have to do this:

```
if (!myController.IsConnected)
{
// The device is disconnected!
return false;
}

var capabilities = myController.GetCapabilities(DeviceQueryType.Any);
```

In this code `IsConnected` under the hood calls `XInput.XInputGetState` to test for a device connection, so this code uses 2 Pinvokes to function. That however is redundant as [XInputGetCapabilities](http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.reference.xinputgetcapabilities(v=vs.85).aspx) also supports detection of disconnected state via the `ERROR_DEVICE_NOT_CONNECTED` return value.

So this new overload allows you to make a single call like so:

```
Capabilities capabilities;
if (!myController.GetCapabilities(DeviceQueryType.Any, out capabilities))
{
// The device is disconnected!
return false;
}
```

This only uses one PInvoke to XInput.