Exemple #1
0
 public static bool RunButtonDown(IPCManager ipcManager, IModelSwitch switchSettings)
 {
     if (IPCTools.IsVjoyAddress(switchSettings.AddressAction, switchSettings.ActionType) && !IPCTools.IsVjoyToggle(switchSettings.AddressAction, switchSettings.ActionType))
     {
         return(IPCTools.VjoyClearSet(ipcManager, switchSettings.AddressAction, false));
     }
     else if (IPCTools.IsWriteAddress(switchSettings.AddressAction, (ActionSwitchType)switchSettings.ActionType))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
        public static bool RunButtonUp(IPCManager ipcManager, bool longPress, string lastState, string lastStateLong, IModelSwitch switchSettings, out string[] newValues)
        {
            bool result = false;

            newValues    = new string[2];
            newValues[0] = lastState;
            newValues[1] = lastStateLong;

            if (IPCTools.IsVjoyAddress(switchSettings.AddressAction, switchSettings.ActionType) && !IPCTools.IsVjoyToggle(switchSettings.AddressAction, switchSettings.ActionType))
            {
                result = IPCTools.VjoyClearSet(ipcManager, switchSettings.AddressAction, true);
            }
            else if (!longPress)
            {
                string newValue = ToggleValue(lastState, switchSettings.SwitchOffState, switchSettings.SwitchOnState);
                result = IPCTools.RunAction(ipcManager, switchSettings.AddressAction, (ActionSwitchType)switchSettings.ActionType, newValue, switchSettings.UseControlDelay);
                if (result)
                {
                    newValues[0] = newValue;
                }
            }
            else if (longPress && switchSettings.HasLongPress)
            {
                if (IPCTools.IsVjoyAddress(switchSettings.AddressActionLong, switchSettings.ActionTypeLong) && IPCTools.IsVjoyToggle(switchSettings.AddressActionLong, switchSettings.ActionTypeLong))
                {
                    result = IPCTools.VjoyToggle(ipcManager, switchSettings.AddressActionLong);
                }
                else if (IPCTools.IsWriteAddress(switchSettings.AddressActionLong, (ActionSwitchType)switchSettings.ActionTypeLong) && !IPCTools.IsVjoyAddress(switchSettings.AddressActionLong, switchSettings.ActionTypeLong))
                {
                    string newValue = ToggleValue(lastStateLong, switchSettings.SwitchOffStateLong, switchSettings.SwitchOnStateLong);
                    result = IPCTools.RunAction(ipcManager, switchSettings.AddressActionLong, (ActionSwitchType)switchSettings.ActionTypeLong, newValue, switchSettings.UseControlDelay);
                    if (result)
                    {
                        newValues[1] = newValue;
                    }
                }
            }

            return(result);
        }