Example #1
0
        private void AddToBuffer(Entry o)
        {
            if (InvokeRequired)
            {
                Invoke(new AddEntryDelegate(AddToBuffer), new object[] { o });
                return;
            }
            o.PostCreation();
            buffer.Add(o);
            foreach (string c in o.Categories)
            {
                if (!knownCategories.Contains(c))
                {
                    knownCategories.Add(c);
                }
            }

            if (!knownSeverities.Contains(o.Severity))
            {
                knownSeverities.Add(o.Severity);
            }

            if (parser != null || IsVisibleItem(o))
            {
                visibleItems.Add(o);
                autoScrollNeeded = true;
            }
        }
Example #2
0
        private Entry ParseTextLine(string line, Entry lastEntry, bool enable_format_detection)
        {
            Match m = textlineReg.Match(line);

            if (!m.Success && enable_format_detection)
            {
                int i = textLinePatterns.IndexOf(textlineReg) + 1;
                if (i > 0 && i < textLinePatterns.Count)
                {
                    textlineReg = textLinePatterns[i];
                    m           = textlineReg.Match(line);
                }
            }

            Entry test = null;

            if (m.Success)
            {
                test = new Entry();
                string[] gn = textlineReg.GetGroupNames();
                if (gn.Contains("y") && gn.Contains("m") && gn.Contains("d") && gn.Contains("h") && gn.Contains("i") && gn.Contains("s"))
                {
                    test.Created = new DateTime(
                        int.Parse(m.Groups["y"].Value), txtToMonth(m.Groups["m"].Value), int.Parse(m.Groups["d"].Value),
                        int.Parse(m.Groups["h"].Value), int.Parse(m.Groups["i"].Value), int.Parse(m.Groups["s"].Value)
                        );
                }
                else if (gn.Contains("date"))
                {
                    test.Created = DateTime.Parse(m.Groups["date"].Value);
                }

                test.Severity   = gn.Contains("sev")?m.Groups["sev"].Value:"";
                test.Categories = gn.Contains("sev")?new List <string>(m.Groups["cat"].Value.Split(categorySplitter)):new List <string>();
                test.Message    = gn.Contains("msg")?m.Groups["msg"].Value:"";
                return(test);
            }

            if (lastEntry == null)
            {
                lastEntry.Message += "\n" + line;
                lastEntry.PostCreation();
            }
            return(null);
        }
Example #3
0
        private Entry ParseTextLine(string line, Entry lastEntry, bool enable_format_detection)
        {
            Match m = textlineReg.Match(line);

            if (!m.Success && enable_format_detection)
            {
                textlineReg = textlineReg2;
                m           = textlineReg.Match(line);
            }

            Entry test = null;

            if (m.Success)
            {
                test         = new Entry();
                test.Created = DateTime.Parse(m.Groups[1].Value);
                if (m.Groups.Count < 4)
                {
                    test.Severity   = "";
                    test.Categories = new List <string>();
                    test.Message    = m.Groups[2].Value;
                }
                else
                {
                    test.Severity   = m.Groups[2].Value;
                    test.Categories = new List <string>(m.Groups[3].Value.Split(categorySplitter));
                    test.Message    = m.Groups[4].Value;
                }
                return(test);
            }

            if (lastEntry == null)
            {
                lastEntry.Message += "\n" + line;
                lastEntry.PostCreation();
            }
            return(null);
        }
Example #4
0
        private void AddToBuffer(Entry o)
        {
            if (InvokeRequired)
            {
                Invoke(new AddEntryDelegate(AddToBuffer), new object[] { o });
                return;
            }
            o.PostCreation();
            buffer.Add(o);
            foreach (string c in o.Categories)
            {
                if (!knownCategories.Contains(c))
                    knownCategories.Add(c);
            }

            if (!knownSeverities.Contains(o.Severity))
                knownSeverities.Add(o.Severity);

            if (parser != null || IsVisibleItem(o))
            {
                visibleItems.Add(o);
                autoScrollNeeded = true;
            }
        }
Example #5
0
        private Entry ParseTextLine(string line, Entry lastEntry, bool enable_format_detection)
        {
            Match m = textlineReg.Match(line);

            if (!m.Success && enable_format_detection)
            {
                int i = textLinePatterns.IndexOf(textlineReg) + 1;
                if (i > 0 && i < textLinePatterns.Count)
                {
                    textlineReg = textLinePatterns[i];
                    m = textlineReg.Match(line);
                }
            }

            Entry test = null;
            if (m.Success)
            {
                test = new Entry();
                string[] gn = textlineReg.GetGroupNames();
                if (gn.Contains("y") && gn.Contains("m") && gn.Contains("d") && gn.Contains("h") && gn.Contains("i") && gn.Contains("s"))
                {
                    test.Created = new DateTime(
                        int.Parse(m.Groups["y"].Value), txtToMonth(m.Groups["m"].Value), int.Parse(m.Groups["d"].Value),
                        int.Parse(m.Groups["h"].Value), int.Parse(m.Groups["i"].Value), int.Parse(m.Groups["s"].Value)
                        );
                }
                else if (gn.Contains("date"))
                    test.Created = DateTime.Parse(m.Groups["date"].Value);

                test.Severity = gn.Contains("sev")?m.Groups["sev"].Value:"";
                test.Categories = gn.Contains("cat") ? new List<string>(m.Groups["cat"].Value.Split(categorySplitter)) : new List<string>();
                test.Message = gn.Contains("msg")?m.Groups["msg"].Value:"";
                return test;
            }

            if (lastEntry == null)
            {
                lastEntry.Message += "\n" + line;
                lastEntry.PostCreation();
            }
            return null;
        }
Example #6
0
        private Entry ParseTextLine(string line, Entry lastEntry, bool enable_format_detection)
        {
            Match m = textlineReg.Match(line);

            if (!m.Success && enable_format_detection)
            {
                textlineReg = textlineReg2;
                m = textlineReg.Match(line);
            }

            Entry test = null;
            if (m.Success)
            {
                test = new Entry();
                test.Created = DateTime.Parse(m.Groups[1].Value);
                if (m.Groups.Count < 4)
                {
                    test.Severity = "";
                    test.Categories = new List<string>();
                    test.Message = m.Groups[2].Value;
                }
                else
                {
                    test.Severity = m.Groups[2].Value;
                    test.Categories = new List<string>(m.Groups[3].Value.Split(categorySplitter));
                    test.Message = m.Groups[4].Value;
                }
                return test;
            }

            if (lastEntry == null)
            {
                lastEntry.Message += "\n" + line;
                lastEntry.PostCreation();
            }
            return null;
        }