Example #1
0
        protected virtual MessageStruct ParseLine(string inputLine)
        {
            if (inputLine == null)
            {
                MessageStruct.Swap(ref this.lastMS, ref this.currentMS);
                this.currentMS.Clear();
                return(this.lastMS);
            }
            if (string.IsNullOrWhiteSpace(inputLine))
            {
                return(null);
            }
            bool flag = false;

            foreach (Regex regex in this.errorListRegexListExclusion)
            {
                try
                {
                    if (regex.Match(inputLine).Success)
                    {
                        flag = true;
                        break;
                    }
                }
                catch (RegexMatchTimeoutException)
                {
                }
            }
            if (!flag)
            {
                using (List <Regex> .Enumerator enumerator2 = this.errorListRegexList.GetEnumerator())
                {
                    while (true)
                    {
                        if (!enumerator2.MoveNext())
                        {
                            break;
                        }
                        Regex current = enumerator2.Current;
                        try
                        {
                            Match match2 = current.Match(inputLine);
                            if (match2.Success)
                            {
                                int result = 0;
                                int num2   = 0;
                                if (!int.TryParse(match2.Groups["LINE"].Value, out result))
                                {
                                    result = 0;
                                }
                                if (!int.TryParse(match2.Groups["COLUMN"].Value, out num2))
                                {
                                    num2 = 0;
                                }
                                MessageStruct.Swap(ref this.lastMS, ref this.currentMS);
                                this.currentMS.Clear();
                                this.currentMS.Category = match2.Groups["CATEGORY"].Value.ToLowerInvariant();
                                this.currentMS.Filename = match2.Groups["FILENAME"].Value;
                                this.currentMS.Code     = match2.Groups["CODE"].Value;
                                this.currentMS.Line     = result;
                                this.currentMS.Column   = num2;
                                this.currentMS.Text     = this.currentMS.Text + match2.Groups["TEXT"].Value.TrimEnd(new char[0]) + Environment.NewLine;
                                flag = true;
                                return(this.lastMS);
                            }
                        }
                        catch (RegexMatchTimeoutException)
                        {
                        }
                    }
                }
            }
            if (!flag && !string.IsNullOrEmpty(this.currentMS.Filename))
            {
                this.currentMS.Text = this.currentMS.Text + inputLine.TrimEnd(new char[0]) + Environment.NewLine;
                return(null);
            }
            this.lastMS.Text = inputLine;
            return(this.lastMS);
        }