/// <summary>
        /// Set Highlight values to specified column value
        /// </summary>
        /// <param name="col">Target column value</param>
        /// <param name="defList">Highlight definition list</param>
        private void SetHighlights(ParsedLogColumn col, HighlightDefinitionList defList)
        {
            log.InPrivate(col, defList);

            if (col.ColumnDefinition.IsDateTimeField)
            {
                log.OutPrivate();
                return;
            }

            List <HighlightDefinition> targetDefList = defList.Find(col.ColumnDefinition);

            foreach (HighlightDefinition def in targetDefList)
            {
                string key = def.Keyword;
                string val = col.Value;

                if (!def.CaseSensitive)
                {
                    key = key.ToLower();
                    val = val.ToLower();
                }

                if (val.Contains(key))
                {
                    SetAllHightlightItems(key, val, col, def);
                }
            }

            log.OutPrivate();
        }
Example #2
0
        public HighlightSettingDialog(FlatProject project)
        {
            InitializeComponent();

            if (project == null)
            {
                return;
            }

            columnDefList    = project.PatternDefinition.ColumnDefinitionList;
            highlightDefList = HighlightDefinitionList.Copy(project.HighlightDefinitionList);
        }
        /// <summary>
        /// Read log lines from database
        /// </summary>
        /// <param name="criteria">Search condition</param>
        /// <param name="colDefList">Column definition list</param>
        /// <param name="highlightDefList">Highlight definition list</param>
        /// <param name="offset">Read start position</param>
        /// <param name="limit">Read log lines limit</param>
        /// <returns>Parsed log lines</returns>
        public ParsedLog ReadLines(SearchCriteria criteria, ColumnDefinitionList colDefList,
                                   HighlightDefinitionList highlightDefList, int offset, int limit)
        {
            log.In(criteria, offset, limit);

            SQLiteCommand comm = connection.CreateCommand();

            SetSelectStatement(comm, colDefList, criteria, offset, limit);

            ParsedLog parsedLog = new ParsedLog();

            List <ParsedLogLine> lineList = new List <ParsedLogLine>();

            using (SQLiteDataReader reader = comm.ExecuteReader())
            {
                while (reader.Read())
                {
                    ParsedLogLine logLine = new ParsedLogLine();
                    logLine.File         = new FileValue();
                    logLine.File.Name    = GetStringValue(reader, IntermediateLogConstants.COL_NAME_LF_FILE_NAME);
                    logLine.LineNumber   = GetIntValue(reader, IntermediateLogConstants.COL_NAME_PL_LINE_NUM);
                    logLine.HasError     = GetBooleanValue(reader, IntermediateLogConstants.COL_NAME_PL_HAS_ERROR);
                    logLine.NotParsedLog = GetStringValue(reader, IntermediateLogConstants.COL_NAME_PL_NOT_PARSED_LINE);

                    foreach (ColumnDefinition colDef in colDefList)
                    {
                        ParsedLogColumn col = new ParsedLogColumn();
                        col.ColumnDefinition = colDef;
                        col.Value            = GetStringValue(reader, colDef.ColumnName);

                        if (highlightDefList != null)
                        {
                            SetHighlights(col, highlightDefList);
                        }

                        logLine.ColumnList.Add(col);
                    }

                    lineList.Add(logLine);
                }
            }

            parsedLog.TotalLineCount  = GetTotalLineCount();
            parsedLog.TargetLineCount = GetLineCount(criteria);
            parsedLog.LogLineList     = lineList;

            log.Out(lineList);

            return(parsedLog);
        }