Example #1
0
        /// <summary>
        /// Locates and fills RawError.Path property with the first
        /// Windows path values found from RawError.Input property.
        /// </summary>
        /// <param name="parser">The stack trace parser. This parameter
        /// must not be null.</param>
        /// <param name="args">The RawError from which retrieving and
        /// filling Input and Path properties. This parameter cannot not
        /// be null.</param>
        /// <returns>True if a match occured, false otherwise.</returns>
        public bool TryParse(StackTraceParser parser, RawError args)
        {
            int    posDriveLetter;
            int    posTrailingColon;
            string path;

            UiExceptionHelper.CheckNotNull(parser, "parser");
            UiExceptionHelper.CheckNotNull(args, "args");

            posDriveLetter = lookForDriveLetter(args.Input, 0);
            if (posDriveLetter == -1)
            {
                return(false);
            }

            posTrailingColon = PathCompositeParser.IndexOfTrailingColon(args.Input, posDriveLetter + 3);
            if (posTrailingColon == -1)
            {
                return(false);
            }

            path = args.Input.Substring(posDriveLetter, posTrailingColon - posDriveLetter);
            path = path.Trim();

            if (path.Length <= 3)
            {
                return(false);
            }

            args.Path = path;

            return(true);
        }
        /// <summary>
        /// Locates and fills RawError.Path property with the first
        /// Unix path values found from RawError.Input property.
        /// </summary>
        /// <param name="parser">The stack trace parser. This parameter
        /// must not be null.</param>
        /// <param name="args">The RawError from which retrieving and
        /// filling Input and Path properties. This parameter cannot not
        /// be null.</param>
        /// <returns>True if a match occured, false otherwise.</returns>
        public bool TryParse(StackTraceParser parser, RawError args)
        {
            int    posSlash;
            int    posColon;
            string path;

            UiExceptionHelper.CheckNotNull(parser, "parser");
            UiExceptionHelper.CheckNotNull(args, "args");

            if ((posSlash = indexOfFirstSlash(args.Input, 0)) == -1)
            {
                return(false);
            }

            if ((posColon = PathCompositeParser.IndexOfTrailingColon(args.Input, posSlash + 1)) == -1)
            {
                return(false);
            }

            path = args.Input.Substring(posSlash, posColon - posSlash);
            path = path.Trim();

            if (path.Length <= 1)
            {
                return(false);
            }

            args.Path = path;

            return(true);
        }
Example #3
0
        public new void SetUp()
        {
            _parser = new PathCompositeParser();

            Assert.That(_parser.UnixPathParser, Is.Not.Null);
            Assert.That(_parser.WindowsPathParser, Is.Not.Null);                

            return;
        }
Example #4
0
        public void SetUp()
        {
            PathCompositeParser pathParser;

            pathParser = new PathCompositeParser();

            _array = new IErrorParser[]  {
                pathParser.UnixPathParser,
                pathParser.WindowsPathParser,
                new FunctionParser(),
                new PathCompositeParser(),
                new LineNumberParser()
            };

            return;
        }