예제 #1
0
        public override void OnRenderDocumentHeader(FlatProject project, ParsedLog log)
        {
            CreateSheets();

            GenerateSummaryHeader(project, log);
            GenerateLogHeader(project);
        }
예제 #2
0
        private void ResizeLogColumns(FlatProject proj, ColumnDefinitionList colDefList)
        {
            int colPos = LG_COL_POS_CONTENT_START;

            if (proj.ShowFileName)
            {
                int fileColWidth = maxCellWidthDictionary[LG_COL_NAME_FILE];
                logSheet.SetColumnWidth(colPos, fileColWidth);
                colPos++;
            }

            int lineColWidth = maxCellWidthDictionary[LG_COL_NAME_LINE];

            logSheet.SetColumnWidth(colPos, lineColWidth);
            colPos++;

            foreach (ColumnDefinition colDef in colDefList)
            {
                if (!colDef.Visble)
                {
                    continue;
                }

                int width = maxCellWidthDictionary[colDef.ColumnName];
                logSheet.SetColumnWidth(colPos, width);
                colPos++;
            }
        }
예제 #3
0
        public override void OnRenderDocumentHeader(FlatProject project, ParsedLog log)
        {
            writer.WriteLine("*****************************************");
            writer.WriteLine(" Project name: " + project.ProjectName);
            writer.WriteLine(" Created date: " + DateTime.Now.ToString());
            writer.WriteLine("*****************************************");

            StringBuilder sb = new StringBuilder();

            if (project.ShowFileName)
            {
                sb.Append("FileName" + Delimiter);
            }

            sb.Append("Line" + Delimiter);

            foreach (ColumnDefinition colDef in project.PatternDefinition.ColumnDefinitionList)
            {
                sb.Append(colDef.ColumnName + Delimiter);
            }

            RemoveLastDelimiter(sb);

            writer.WriteLine(sb.ToString());
        }
예제 #4
0
        /// <summary>
        /// Export logs to specified format
        /// </summary>
        /// <param name="project">Target project</param>
        /// <param name="log">Target logs</param>
        public void Export(FlatProject project, ParsedLog log)
        {
            OnRenderDocumentHeader(project, log);

            OnRenderMain(project, log);

            OnRenderDocumentFooter(project, log);
        }
예제 #5
0
        public ViewColumnSettingDialog(FlatProject project)
        {
            InitializeComponent();
            columnDefList = project.PatternDefinition.ColumnDefinitionList;

            ShowFileNameCheckBox.Checked = project.ShowFileName;
            ShowColumnList();
        }
예제 #6
0
        public HighlightSettingDialog(FlatProject project)
        {
            InitializeComponent();

            if (project == null)
            {
                return;
            }

            columnDefList    = project.PatternDefinition.ColumnDefinitionList;
            highlightDefList = HighlightDefinitionList.Copy(project.HighlightDefinitionList);
        }
예제 #7
0
        public FilteringColumnSettingDialog(FlatProject project)
        {
            InitializeComponent();
            this.colDefList     = project.PatternDefinition.ColumnDefinitionList;
            this.searchCriteria = SearchCriteria.Copy(project.ColumnsSearchCriteria);

            if (this.searchCriteria == null)
            {
                this.searchCriteria = new SearchCriteria();
            }

            ShowColumnList();

            if (ColumnListBox.Items.Count > 0)
            {
                ColumnListBox.SelectedIndex = 0;
            }
        }
예제 #8
0
        public override void OnRenderMain(FlatProject project, ParsedLog log)
        {
            foreach (ParsedLogLine line in log.LogLineList)
            {
                StringBuilder sb = new StringBuilder();

                if (project.ShowFileName)
                {
                    sb.Append(line.File.Name);
                    sb.Append(this.Delimiter);
                }

                sb.Append(line.LineNumber);
                sb.Append(this.Delimiter);

                if (line.HasError)
                {
                    sb.Append(line.NotParsedLog);
                }
                else
                {
                    foreach (ParsedLogColumn col in line.ColumnList)
                    {
                        if (col.ColumnDefinition.IsDateTimeField)
                        {
                            DateTime time = new DateTime(long.Parse(col.Value));
                            sb.Append(time.ToString(DATE_TIME_FORMAT));
                        }
                        else
                        {
                            sb.Append(col.Value);
                        }

                        sb.Append(this.Delimiter);
                    }

                    RemoveLastDelimiter(sb);
                }

                writer.WriteLine(sb.ToString());
            }
        }
예제 #9
0
        public FilteringRangeSettingDialog(FlatProject project, List <FileValue> fileValueList)
        {
            InitializeComponent();

            this.patternDef    = project.PatternDefinition;
            this.rangeCriteria = SearchCriteria.Copy(project.RangeCriteria);

            this.fileValueList = fileValueList;

            foreach (FileValue value in fileValueList)
            {
                LogFileNameComboBox.Items.Add(value.Name);
            }

            if (LogFileNameComboBox.Items.Count > 0)
            {
                LogFileNameComboBox.SelectedIndex = 0;
            }

            ShowRangeFilterValues();
        }
예제 #10
0
        private void GenerateLogHeader(FlatProject project)
        {
            // Title
            ICell titleCell = GetCell(logSheet, LG_COL_POS_TITLE, LG_ROW_POS_TITLE);

            titleCell.SetCellValue("Exported logs");
            titleCell.CellStyle = titleStyle;


            // Header
            int colPos = LG_COL_POS_HEADER_START;

            if (project.ShowFileName)
            {
                ICell fileCell = GetLogHeaderCell(colPos, LG_ROW_POS_HEADER_START);
                fileCell.SetCellValue("File");
                logSheet.SetColumnWidth(colPos, LG_COL_WIDTH_FILE);
                colPos++;
            }

            ICell logLineCell = GetLogHeaderCell(colPos, LG_ROW_POS_HEADER_START);

            logLineCell.SetCellValue("Line");
            logSheet.SetColumnWidth(colPos, LG_COL_WIDTH_LINE_NUM);
            colPos++;

            foreach (ColumnDefinition colDef in project.PatternDefinition.ColumnDefinitionList)
            {
                if (colDef.Visble == false)
                {
                    continue;
                }

                ICell cell = GetLogHeaderCell(colPos, LG_ROW_POS_HEADER_START);
                cell.SetCellValue(colDef.ColumnName);
                logSheet.SetColumnWidth(colPos, LG_COL_WIDTH_CONTENT);
                colPos++;
            }
        }
예제 #11
0
 public abstract void OnRenderDocumentFooter(FlatProject project, ParsedLog log);
예제 #12
0
 public abstract void OnRenderMain(FlatProject project, ParsedLog log);
예제 #13
0
 public override void OnRenderDocumentFooter(FlatProject project, ParsedLog log)
 {
     // Nothing to do
 }
예제 #14
0
        public override void OnRenderMain(FlatProject project, ParsedLog log)
        {
            int rowPos = LG_ROW_POS_CONTENT_START;

            foreach (ParsedLogLine line in log.LogLineList)
            {
                int colPos = LG_COL_POS_CONTENT_START;

                if (project.ShowFileName)
                {
                    ICell fileCell = GetLogContentStringCell(colPos, rowPos);
                    fileCell.SetCellValue(line.File.Name);
                    SetCellWidthToDictionary(LG_COL_NAME_FILE, line.File.Name);
                    colPos++;
                }

                ICell lineNumCell = GetLogContentCenterCell(colPos, rowPos);
                lineNumCell.SetCellValue(line.LineNumber);
                SetCellWidthToDictionary(LG_COL_NAME_LINE, line.LineNumber.ToString());
                colPos++;

                if (line.HasError)
                {
                    ICell notParsedCell = GetLogContentStringCell(colPos, rowPos);
                    notParsedCell.SetCellValue(line.NotParsedLog);

                    if (line.ColumnList.Count > 1)
                    {
                        int cellRange = colPos;
                        foreach (ParsedLogColumn col in line.ColumnList)
                        {
                            if (col.ColumnDefinition.Visble)
                            {
                                cellRange++;
                            }
                        }

                        CellRangeAddress region = new CellRangeAddress(rowPos, rowPos, colPos, cellRange - 1);
                        logSheet.AddMergedRegion(region);

                        RegionUtil.SetBorderTop(BORDER_THIN, region, logSheet, workbook);
                        RegionUtil.SetBorderBottom(BORDER_THIN, region, logSheet, workbook);
                        RegionUtil.SetBorderRight(BORDER_THIN, region, logSheet, workbook);
                        RegionUtil.SetBorderLeft(BORDER_THIN, region, logSheet, workbook);
                    }
                }
                else
                {
                    foreach (ParsedLogColumn col in line.ColumnList)
                    {
                        if (!col.ColumnDefinition.Visble)
                        {
                            continue;
                        }

                        ICell cell = null;

                        if (col.ColumnDefinition.IsDateTimeField)
                        {
                            DateTime time = new DateTime(long.Parse(col.Value));

                            cell = GetLogContentDateCell(colPos, rowPos);
                            cell.SetCellValue(time);
                            SetCellWidthToDictionary(col.ColumnDefinition.ColumnName, time.ToString(FORMAT_STR_DATE));
                        }
                        else
                        {
                            cell = GetLogContentStringCell(colPos, rowPos);
                            cell.SetCellValue(col.Value);
                            SetCellWidthToDictionary(col.ColumnDefinition.ColumnName, col.Value);
                        }

                        colPos++;
                    }
                }

                rowPos++;
            }

            ResizeLogColumns(project, project.PatternDefinition.ColumnDefinitionList);
        }
예제 #15
0
        private void GenerateSummaryHeader(FlatProject project, ParsedLog log)
        {
            // Title
            ICell titleCell = GetSummaryCell(SM_COL_POS_TITLE, SM_ROW_POS_TITLE);

            titleCell.SetCellValue("Exported summary");
            titleCell.CellStyle = titleStyle;


            // Header
            ICell itemHeader = GetSummaryCell(SM_COL_POS_HEADER_START, SM_ROW_POS_HEADER_START);

            itemHeader.SetCellValue("Item");
            itemHeader.CellStyle = headerStyle;

            ICell valueHeader = GetSummaryCell(SM_COL_POS_HEADER_START + 1, SM_ROW_POS_HEADER_START);

            valueHeader.SetCellValue("Value");
            valueHeader.CellStyle = headerStyle;

            // Contents
            ICell nameTitleCell = GetSummaryCell(SM_COL_POS_CONTENT_START, SM_ROW_POS_CONTENT_START);

            nameTitleCell.SetCellValue("Project name");
            nameTitleCell.CellStyle = contentStringStyle;

            ICell nameCell = GetSummaryCell(SM_COL_POS_CONTENT_START + 1, SM_ROW_POS_CONTENT_START);

            nameCell.SetCellValue(project.ProjectName);
            nameCell.CellStyle = contentStringStyle;


            ICell expDateTitleCell = GetSummaryCell(SM_COL_POS_CONTENT_START, SM_ROW_POS_CONTENT_START + 1);

            expDateTitleCell.SetCellValue("Exported date");
            expDateTitleCell.CellStyle = contentStringStyle;

            ICell expDateCell = GetSummaryCell(SM_COL_POS_CONTENT_START + 1, SM_ROW_POS_CONTENT_START + 1);

            expDateCell.SetCellValue(DateTime.Now);
            expDateCell.CellStyle = contentDateStyle;


            ICell totalCountTitleCell = GetSummaryCell(SM_COL_POS_CONTENT_START, SM_ROW_POS_CONTENT_START + 2);

            totalCountTitleCell.SetCellValue("Total count");
            totalCountTitleCell.CellStyle = contentStringStyle;

            ICell totalCountCell = GetSummaryCell(SM_COL_POS_CONTENT_START + 1, SM_ROW_POS_CONTENT_START + 2);

            totalCountCell.SetCellValue(log.TotalLineCount);
            totalCountCell.CellStyle = contentNumberStyle;


            ICell expCountTitleCell = GetSummaryCell(SM_COL_POS_CONTENT_START, SM_ROW_POS_CONTENT_START + 3);

            expCountTitleCell.SetCellValue("Exported count");
            expCountTitleCell.CellStyle = contentStringStyle;

            ICell expCountCell = GetSummaryCell(SM_COL_POS_CONTENT_START + 1, SM_ROW_POS_CONTENT_START + 3);

            expCountCell.SetCellValue(log.TargetLineCount);
            expCountCell.CellStyle = contentNumberStyle;


            // Auto resize Item and Value column
            summarySheet.SetColumnWidth(SM_COL_POS_CONTENT_START, DEFAULT_CELL_WIDTH);
            summarySheet.AutoSizeColumn(SM_COL_POS_CONTENT_START);

            summarySheet.SetColumnWidth(SM_COL_POS_CONTENT_START + 1, DEFAULT_CELL_WIDTH);
            summarySheet.AutoSizeColumn(SM_COL_POS_CONTENT_START + 1);
        }