/// <summary>
        /// The item at the top of the stack is copied and inserted before the second-to-top item. Return value indicates success.
        /// </summary>
        /// <param name="opData">Data to use</param>
        /// <param name="error">Error message (null if sucessful, otherwise will contain information about the failure)</param>
        /// <returns>True if operation was successful, false if otherwise</returns>
        public override bool Run(IOpData opData, out string error)
        {
            if (opData.ItemCount < 2)
            {
                error = Err.OpNotEnoughItems;
                return(false);
            }

            byte[] data = opData.Peek();
            opData.Insert(data, 2);

            return(CheckItemCount(opData, out error));
        }
예제 #2
0
        /// <summary>
        /// The item at the top of the stack is copied and inserted before the second-to-top item. Return value indicates success.
        /// </summary>
        /// <param name="opData">Data to use</param>
        /// <param name="error">Error message (null if sucessful, otherwise will contain information about the failure)</param>
        /// <returns>True if operation was successful, false if otherwise</returns>
        public override bool Run(IOpData opData, out string error)
        {
            if (opData.ItemCount < 2)
            {
                error = "There was not enough items left in the stack to tuck.";
                return(false);
            }

            byte[] data = opData.Peek();
            opData.Insert(data, 2);

            error = null;
            return(true);
        }