public override void OnRenderDocumentHeader(FlatProject project, ParsedLog log) { CreateSheets(); GenerateSummaryHeader(project, log); GenerateLogHeader(project); }
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++; } }
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()); }
/// <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); }
public ViewColumnSettingDialog(FlatProject project) { InitializeComponent(); columnDefList = project.PatternDefinition.ColumnDefinitionList; ShowFileNameCheckBox.Checked = project.ShowFileName; ShowColumnList(); }
public HighlightSettingDialog(FlatProject project) { InitializeComponent(); if (project == null) { return; } columnDefList = project.PatternDefinition.ColumnDefinitionList; highlightDefList = HighlightDefinitionList.Copy(project.HighlightDefinitionList); }
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; } }
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()); } }
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(); }
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++; } }
public abstract void OnRenderDocumentFooter(FlatProject project, ParsedLog log);
public abstract void OnRenderMain(FlatProject project, ParsedLog log);
public override void OnRenderDocumentFooter(FlatProject project, ParsedLog log) { // Nothing to do }
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); }
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); }