public Tuple <bool, bool> IsAllPressed(BindingsFile.Assignment a) // return if all okay pressed, second if all are pressable { bool allpressable = true; foreach (BindingsFile.DeviceKeyPair ma in a.keys) { InputDeviceInterface idi = GetInputDeviceFromBindingDevice(ma.Device); if (idi == null) // no device, false { return(new Tuple <bool, bool>(false, false)); } bool?v = idi.IsPressed(ma.Key); // is it pressed, or not pressable? if (v.HasValue) // is pressable { if (v.Value == false) // if it { return(new Tuple <bool, bool>(false, false)); } } else { allpressable = false; // not pressable } } return(new Tuple <bool, bool>(true, allpressable)); }
InputDeviceInterface GetInputDeviceFromBindingDevice(BindingsFile.Device dv) { InputDeviceInterface i = devices.Find(x => { BindingsFile.Device b = bf.FindDevice(x.ID().Name, x.ID().Instanceguid, x.ID().Productguid); return(b != null && b.Name.Equals(dv.Name)); }); return(i); }
public string CheckBindings() { string ret = ""; foreach (BindingsFile.Device bd in bf) // for all devices listed in the binding file { InputDeviceInterface idi = GetInputDeviceFromBindingDevice(bd); if (idi == null) { ret += "ERROR: Missing physical device for " + bd.Name + Environment.NewLine; } else { ret += "Match of FD Device " + bd.Name + " to " + idi.ID().Name + Environment.NewLine; } } return(ret); }
} // if applicable, axis for instance.. public InputDeviceEvent(InputDeviceInterface d, int en, bool p, int v = 0) { Device = d; EventNumber = en; Pressed = p; Value = v; }