Exemplo n.º 1
0
 public Binding(HeadAxis axis, VirtualDeviceCapability capability, object posKey, object negKey, object mapping)
 {
     this.sourceAxis       = axis;
     this.targetCapability = capability;
     this.targetPosKey     = posKey;
     this.targetNegKey     = negKey;
     this.mapping          = mapping;
 }
Exemplo n.º 2
0
        public override object[] GetKeyHandles(VirtualDeviceCapability capability)
        {
            switch (capability)
            {
            case VirtualDeviceCapability.Key:
                return((object[])keyHandles.Clone());

            default:
                return(new object[0]);
            }
        }
Exemplo n.º 3
0
        public override object[] GetModifiedKeys(VirtualDeviceCapability capability)
        {
            switch (capability)
            {
            case VirtualDeviceCapability.Key:
                return(modifiedKeys.ToArray());

            default:
                return(new object[0]);
            }
        }
Exemplo n.º 4
0
        public override int GetKeyNo(VirtualDeviceCapability capability)
        {
            switch (capability)
            {
            case VirtualDeviceCapability.Key:
                return(keyHandles.Length);

            default:
                return(0);
            }
        }
Exemplo n.º 5
0
        public void AddBinding(HeadAxis axis, int deviceIndex, VirtualDeviceCapability capability, object posKey, object negKey, object mapping)
        {
            List <Binding> deviceBindings;

            if (!config.TryGetValue(deviceIndex, out deviceBindings))
            {
                deviceBindings = new List <Binding>();
                config.Add(deviceIndex, deviceBindings);
            }
            var binding = new Binding(axis, capability, posKey, negKey, mapping);

            deviceBindings.Add(binding);
        }
Exemplo n.º 6
0
        public override KeyState GetKeyState(VirtualDeviceCapability capability, object keyHandle)
        {
            switch (capability)
            {
            case VirtualDeviceCapability.Axis:
                KeyState result;
                if (keyState.TryGetValue(keyHandle.ToString(), out result))
                {
                    return(result);
                }
                return(new KeyState(0, 0));

            default:
                return(new KeyState(0, 0));
            }
        }
Exemplo n.º 7
0
        public override bool SetKeyState(VirtualDeviceCapability capability, object keyHandle, KeyState state)
        {
            switch (capability)
            {
            case VirtualDeviceCapability.Axis:
                if (!keyState.ContainsKey(keyHandle.ToString()))
                {
                    return(false);
                }
                keyState[keyHandle.ToString()] = state;
                modifiedKeys.Add(keyHandle);
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 8
0
        public override KeyState GetKeyState(VirtualDeviceCapability capability, object keyHandle)
        {
            string keyName = keyHandle.ToString();

            switch (capability)
            {
            case VirtualDeviceCapability.Key:
                KeyState result;
                if (!keyState.TryGetValue(keyName, out result))
                {
                    return(result);
                }
                return(new KeyState(false, false));

            default:
                return(new KeyState(false, false));
            }
        }
Exemplo n.º 9
0
        public override bool SetKeyState(VirtualDeviceCapability capability, object keyHandle, KeyState state)
        {
            // TODO: implement
            string keyName = keyHandle.ToString();

            switch (capability)
            {
            case VirtualDeviceCapability.Key:
                if (!keyState.ContainsKey(keyName))
                {
                    return(false);
                }
                keyState[keyName] = state;
                modifiedKeys.Add(keyHandle);
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 10
0
        private XmlNode WriteRelay(int index, CapInputRelay settings, XmlDocument document)
        {
            var result = document.CreateElement("Bindings");

            result.SetAttribute("Index", index.ToString());
            foreach (HeadAxis axis in (HeadAxis[])Enum.GetValues(typeof(HeadAxis)))
            {
                int device = settings.GetDeviceIndex(axis);
                if (device < 0)
                {
                    continue;
                }
                XmlElement node = document.CreateElement("Bind");
                result.AppendChild(node);
                node.SetAttribute("Axis", axis.ToString());
                node.SetAttribute("Index", device.ToString());
                VirtualDeviceCapability capability = settings.GetDeviceCapability(axis);
                node.SetAttribute("Capability", capability.ToString());
                Tuple <object, object> keys = settings.GetDeviceKeys(axis);
                node.SetAttribute("Key1", keys.Item1.ToString());
                node.SetAttribute("Key2", keys.Item2.ToString());
            }
            return(result);
        }
Exemplo n.º 11
0
 public override object[] GetKeyHandles(VirtualDeviceCapability capability)
 {
     return((object[])keyHandles.Clone());
 }
Exemplo n.º 12
0
 public abstract object[] GetModifiedKeys(VirtualDeviceCapability capability);
Exemplo n.º 13
0
 public abstract KeyState GetKeyState(VirtualDeviceCapability capability, object keyHandle);
Exemplo n.º 14
0
 public abstract bool SetKeyState(VirtualDeviceCapability capability, object keyHandle, KeyState state);
Exemplo n.º 15
0
 public abstract int GetKeyNo(VirtualDeviceCapability capability);
Exemplo n.º 16
0
 public abstract object[] GetKeyHandles(VirtualDeviceCapability capability);