示例#1
0
        public static bool IsWriteAddress(string address, ActionSwitchType type)
        {
            if (string.IsNullOrEmpty(address))
            {
                return(false);
            }

            switch (type)
            {
            case ActionSwitchType.MACRO:
                return(rxMacro.IsMatch(address));

            case ActionSwitchType.SCRIPT:
                return(rxScript.IsMatch(address));

            case ActionSwitchType.CONTROL:
                return(rxControl.IsMatch(address) || rxControlSeq.IsMatch(address));

            case ActionSwitchType.LVAR:
                return(rxLvar.IsMatch(address));

            case ActionSwitchType.OFFSET:
                return(rxOffset.IsMatch(address));

            case ActionSwitchType.VJOY:
                return(rxVjoy.IsMatch(address));

            default:
                return(false);
            }
        }
示例#2
0
        public static bool RunAction(IPCManager ipcManager, string Address, ActionSwitchType actionType, string newValue, bool useControlDelay)
        {
            if (ipcManager.IsConnected && IsWriteAddress(Address, actionType))
            {
                Log.Logger.Debug($"IPCTools: Writing to {Address}");
                switch (actionType)
                {
                case ActionSwitchType.MACRO:
                    return(RunMacros(ipcManager, Address));

                case ActionSwitchType.SCRIPT:
                    return(RunScript(ipcManager, Address));

                case ActionSwitchType.LVAR:
                    return(WriteLvar(ipcManager, Address, newValue));

                case ActionSwitchType.CONTROL:
                    return(SendControls(ipcManager, Address, useControlDelay));

                case ActionSwitchType.OFFSET:
                    return(WriteOffset(ipcManager, Address, newValue));

                case ActionSwitchType.VJOY:
                    if (IsVjoyToggle(Address, (int)actionType))
                    {
                        return(VjoyToggle(ipcManager, Address));
                    }
                    else
                    {
                        return(false);
                    }

                default:
                    return(false);
                }
            }
            else
            {
                Log.Logger.Error($"IPCTools: not connected or Address not passed {Address}");
            }

            return(false);
        }