예제 #1
0
        /// <summary>
        /// Copy return the action while reassigning the JsN Tag
        /// </summary>
        /// <param name="newJsList">The JsN reassign list</param>
        /// <returns>The action copy with reassigned input</returns>
        public ActionCommandCls ReassignJsN(JsReassingList newJsList)
        {
            ActionCommandCls newAc = (ActionCommandCls)this.Clone();

            // reassign the jsX part for Joystick commands
            if (this.DevID.StartsWith("js"))
            {
                int oldJsN = JoystickCls.JSNum(this.DevID);
                if (JoystickCls.IsJSValid(oldJsN))
                {
                    if (newJsList.ContainsOldJs(oldJsN))
                    {
                        newAc.DevID = JoystickCls.ReassignJSTag(this.DevID, newJsList.newJsFromOldJs(oldJsN));
                    }
                }
            }

            return(newAc);
        }
예제 #2
0
        /// <summary>
        /// Copy return the action while reassigning the JsN Tag
        /// </summary>
        /// <param name="newJsList">The JsN reassign list</param>
        /// <returns>The action copy with reassigned input</returns>
        public ActionCommandCls ReassignJsN(JsReassingList newJsList)
        {
            ActionCommandCls newAc = new ActionCommandCls( );

            // full copy from 'this'
            newAc.input = this.input;

            // reassign the jsX part for Joystick commands  (silly but rather fast comparison)
            if (this.input.Contains("js1_") || this.input.Contains("js2_") || this.input.Contains("js3_") || this.input.Contains("js4_"))
            {
                int oldJsN = JoystickCls.JSNum(this.input);
                if (JoystickCls.IsJSValid(oldJsN))
                {
                    if (newJsList.ContainsOldJs(oldJsN))
                    {
                        newAc.input = JoystickCls.ReassignJSTag(this.input, newJsList.newJsFromOldJs(oldJsN));
                    }
                }
            }

            return(newAc);
        }