/// <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); }