public override bool Equals(object other)
        {
            if (other == null)
            {
                return(false);
            }
            UnknownDeviceBindingSource unknownDeviceBindingSource = other as UnknownDeviceBindingSource;

            if (unknownDeviceBindingSource != null)
            {
                return(Control == unknownDeviceBindingSource.Control);
            }
            return(false);
        }
Пример #2
0
        internal void Load(BinaryReader reader)
        {
            ClearBindings();

            var bindingCount = reader.ReadInt32();

            for (var i = 0; i < bindingCount; i++)
            {
                var           bindingSourceType = (BindingSourceType)reader.ReadInt32();
                BindingSource bindingSource;

                switch (bindingSourceType)
                {
                case BindingSourceType.None:
                    continue;

                case BindingSourceType.DeviceBindingSource:
                    bindingSource = new DeviceBindingSource();
                    break;

                case BindingSourceType.KeyBindingSource:
                    bindingSource = new KeyBindingSource();
                    break;

                case BindingSourceType.MouseBindingSource:
                    bindingSource = new MouseBindingSource();
                    break;

                case BindingSourceType.UnknownDeviceBindingSource:
                    bindingSource = new UnknownDeviceBindingSource();
                    break;

                default:
                    throw new InControlException("Don't know how to load BindingSourceType: " + bindingSourceType);
                }

                bindingSource.Load(reader);
                AddBinding(bindingSource);
            }
        }
Пример #3
0
        public BindingSource Listen(BindingListenOptions listenOptions, InputDevice device)
        {
            if (!listenOptions.IncludeUnknownControllers || device.IsKnown)
            {
                return(null);
            }

            if (detectPhase == DetectPhase.WaitForControlRelease && detectFound)
            {
                if (!IsPressed(detectFound, device))
                {
                    var bindingSource = new UnknownDeviceBindingSource(detectFound);
                    Reset();
                    return(bindingSource);
                }
            }

            var control = ListenForControl(listenOptions, device);

            if (control)
            {
                if (detectPhase == DetectPhase.WaitForControlPress)
                {
                    detectFound = control;
                    detectPhase = DetectPhase.WaitForControlRelease;
                }
            }
            else
            {
                if (detectPhase == DetectPhase.WaitForInitialRelease)
                {
                    detectPhase = DetectPhase.WaitForControlPress;
                }
            }

            return(null);
        }
Пример #4
0
        internal void Load(BinaryReader reader, ushort dataFormatVersion)
        {
            ClearBindings();
            int num = reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                BindingSourceType bindingSourceType = (BindingSourceType)reader.ReadInt32();
                BindingSource     bindingSource;
                switch (bindingSourceType)
                {
                case BindingSourceType.DeviceBindingSource:
                    bindingSource = new DeviceBindingSource();
                    break;

                case BindingSourceType.KeyBindingSource:
                    bindingSource = new KeyBindingSource();
                    break;

                case BindingSourceType.MouseBindingSource:
                    bindingSource = new MouseBindingSource();
                    break;

                case BindingSourceType.UnknownDeviceBindingSource:
                    bindingSource = new UnknownDeviceBindingSource();
                    break;

                default:
                    throw new InControlException("Don't know how to load BindingSourceType: " + bindingSourceType);

                case BindingSourceType.None:
                    continue;
                }
                bindingSource.Load(reader, dataFormatVersion);
                AddBinding(bindingSource);
            }
        }
		public BindingSource Listen( BindingListenOptions listenOptions, InputDevice device )
		{
			if (!listenOptions.IncludeUnknownControllers || device.IsKnown)
			{
				return null;
			}

			if (detectPhase == DetectPhase.WaitForControlRelease && detectFound)
			{
				if (!IsPressed( detectFound, device ))
				{
					var bindingSource = new UnknownDeviceBindingSource( detectFound );
					Reset();
					return bindingSource;
				}
			}

			var control = ListenForControl( listenOptions, device );
			if (control)
			{
				if (detectPhase == DetectPhase.WaitForControlPress)
				{
					detectFound = control;
					detectPhase = DetectPhase.WaitForControlRelease;
				}
			}
			else
			{
				if (detectPhase == DetectPhase.WaitForInitialRelease)
				{
					detectPhase = DetectPhase.WaitForControlPress;
				}
			}

			return null;
		}
Пример #6
0
		internal void Load( BinaryReader reader )
		{
			ClearBindings();

			var bindingCount = reader.ReadInt32();
			for (int i = 0; i < bindingCount; i++)
			{
				var bindingSourceType = (BindingSourceType) reader.ReadInt32();
				BindingSource bindingSource;

				switch (bindingSourceType)
				{
					case BindingSourceType.DeviceBindingSource:
						bindingSource = new DeviceBindingSource();
						break;

					case BindingSourceType.KeyBindingSource:
						bindingSource = new KeyBindingSource();
						break;

					case BindingSourceType.MouseBindingSource:
						bindingSource = new MouseBindingSource();
						break;
					
					case BindingSourceType.UnknownDeviceBindingSource:
						bindingSource = new UnknownDeviceBindingSource();
						break;

					default:
						throw new InControlException( "Don't know how to load BindingSourceType: " + bindingSourceType );
				}

				bindingSource.Load( reader );
				AddBinding( bindingSource );
			}
		}