/// <summary>
        /// Set the status.
        /// Print it and increment the position.
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public long Go(TOPSTOP status)
        {
            Status = status;

            SW.Write(status.ToChar());
            return(++Position);
        }
        /// <summary>
        /// Set the status.<br/>
        /// Output it for (toWhere - Position) positions
        /// (and then set Position to toWhere),
        /// unless that value is not positive.<br/>
        /// Return the new Position.
        /// </summary>
        /// <param name="status"></param>
        /// <param name="toWhere"></param>
        /// <returns>Position</returns>
        public long Go(TOPSTOP status, long toWhere)
        {
            Status = status;

            int howMuch = (int)(toWhere - Position);

            if (howMuch <= 0)
            {
                return(Position);
            }

            var ch = status.ToChar();

            for (int i = 0; i < howMuch; i++)
            {
                SW.Write(ch);
            }
            return(Position = toWhere);
        }
Example #3
0
        public static char ToChar(this TOPSTOP ts)
        {
            switch (ts)
            {
            case TOPSTOP.S:
                return('s');

            case TOPSTOP.I:
                return('i');

            case TOPSTOP.P:
                return('p');

            case TOPSTOP.Y:
                return('y');

            case TOPSTOP.X:
                return('x');

            default:
                return('-');
            }
        }