Пример #1
0
        /// <summary>
        /// Parses string to WorldLocation.
        /// </summary>
        /// <param name="input">String in X.Y.Z format.</param>
        /// <returns>Read WorldLocation object.</returns>
        /// <exception cref="System.ArgumentNullException">Input argument is null.</exception>
        /// <exception cref="System.FormatException">Unable to parse input string.</exception>
        public static WorldLocation Parse(string input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            Match match = regex.Match(input);

            if (!match.Success)
            {
                throw new FormatException("Unable to parse input string.");
            }

            try
            {
                WorldLocation loc = new WorldLocation();
                loc.x = UInt16.Parse(match.Groups[0].Value);
                loc.y = UInt16.Parse(match.Groups[1].Value);
                loc.z = SByte.Parse(match.Groups[2].Value);
                return(loc);
            }
            catch (Exception e)
            {
                throw new FormatException("Unable to parse input string.", e);
            }
        }
Пример #2
0
        internal static void ClearStack()
        {
            lock (World.SyncRoot) {
                stepStack.Clear();

                desiredPos = new WorldLocation(World.RealPlayer.X, World.RealPlayer.Y, World.RealPlayer.Z);
                desiredDir = World.RealPlayer.Direction;
                sequence   = 0;

                Debug.WriteLine("Step stack cleared.", "World");
            }
        }