public override void ReadXml(XmlReader reader) { string name = reader.GetAttribute("Name"); string guid = reader.GetAttribute("GUID"); reader.ReadStartElement("Controller"); name = reader.ReadElementString("Name"); guid = reader.ReadElementString("GUID"); ControllerId = new DirectXControllerGuid(name, new Guid(guid)); if (_device == null) { if (!reader.IsEmptyElement) { reader.ReadStartElement("Functions"); while (reader.NodeType != XmlNodeType.EndElement) { reader.ReadStartElement("Function"); string functionName = reader.ReadElementString("Type"); int objectNumber = int.Parse(reader.ReadElementString("Number"), CultureInfo.InvariantCulture); reader.ReadEndElement(); AddFunction(DirectXControllerFunction.CreateDummy(this, functionName, objectNumber)); } reader.ReadEndElement(); } else { reader.Read(); } } else { reader.Skip(); } reader.ReadEndElement(); }
internal List <DirectXControllerGuid> GetAvailableControllers(HeliosProfile profile) { List <DirectXControllerGuid> controllers = new List <DirectXControllerGuid>(); List <DirectXControllerGuid> usedControllers = new List <DirectXControllerGuid>(); foreach (HeliosInterface profileInterface in profile.Interfaces) { DirectXControllerInterface controllerInterface = profileInterface as DirectXControllerInterface; if (controllerInterface != null) { usedControllers.Add(controllerInterface.ControllerId); } } IList <DeviceInstance> gameControllerList = DirectInput.GetDevices(DeviceClass.GameControl, DeviceEnumerationFlags.AttachedOnly); foreach (DeviceInstance controllerInstance in gameControllerList) { DirectXControllerGuid joystickId = new DirectXControllerGuid(controllerInstance.ProductName, controllerInstance.InstanceGuid); if (!usedControllers.Contains(joystickId)) { controllers.Add(joystickId); } } return(controllers); }
internal List<DirectXControllerGuid> GetAvailableControllers(HeliosProfile profile) { List<DirectXControllerGuid> controllers = new List<DirectXControllerGuid>(); List<DirectXControllerGuid> usedControllers = new List<DirectXControllerGuid>(); foreach (HeliosInterface profileInterface in profile.Interfaces) { DirectXControllerInterface controllerInterface = profileInterface as DirectXControllerInterface; if (controllerInterface != null) { usedControllers.Add(controllerInterface.ControllerId); } } IList<DeviceInstance> gameControllerList = DirectInput.GetDevices(DeviceClass.GameControl, DeviceEnumerationFlags.AttachedOnly); foreach(DeviceInstance controllerInstance in gameControllerList) { DirectXControllerGuid joystickId = new DirectXControllerGuid(controllerInstance.ProductName, controllerInstance.InstanceGuid); if (!usedControllers.Contains(joystickId)) { controllers.Add(joystickId); } } return controllers; }
public override bool Equals(object obj) { if (obj is DirectXControllerGuid) { DirectXControllerGuid otherGuid = (DirectXControllerGuid)obj; return(InstanceGuid.Equals(otherGuid.InstanceGuid)); } return(false); }