private void File_Load(string strFileName, string strFilePath) { // Create Log File Object clsLog_File obLogFile = new clsLog_File(); // Read Data To It clsFileReader obReader = new clsFileReader(strFilePath, obLogFile); // Read Data obReader.File_Read(); // Display File File_Display(obLogFile); }
// Constructor public clsFileReader(string strPath, clsLog_File obLogFile) { file_path = strPath; file_data = obLogFile; module_list = new clsLog_ModuleList(); }
private void File_Display(clsLog_File obLogFile) { this.Cursor = Cursors.WaitCursor; Color colText; // Reset txtRaw.SuspendLayout(); txtRaw.Clear(); foreach (clsLog_Line obLine in obLogFile.log_lines) { colText = Color.White; // Extra Line Break For Time Gaps if (obLine.line_type == Enum_LogLine.type_notation) { txtRaw.AppendText(Environment.NewLine); } // Date PrintColorText(obLine.line_time.ToShortDateString() + " - " + obLine.line_time.ToShortTimeString(), Color.White); switch (obLine.line_type) { case Enum_LogLine.type_error: colText = Color.Red; break; case Enum_LogLine.type_warn: colText = Color.Yellow; break; case Enum_LogLine.type_debug: colText = Color.DimGray; break; case Enum_LogLine.type_info: colText = Color.Silver; break; case Enum_LogLine.type_notation: colText = Color.ForestGreen; break; default: colText = Color.White; break; } // Print Module Name PrintColorText(" [", Color.White); if (obLine.line_module_enum != Enum_ModuleCategory.mod_unknown) { PrintColorText(obLine.line_module_name, obLine.line_module_color); } else { PrintColorText("?" + obLine.line_module_name + "?", Color.Orange); } PrintColorText("]: ", Color.White); // Print Color PrintColorText(obLine.line_formated, colText); // New Line txtRaw.AppendText(Environment.NewLine); // Extra Line Break For Time Gaps if (obLine.line_type == Enum_LogLine.type_notation) { txtRaw.AppendText(Environment.NewLine); } } // Post Processing Color Highlights PostProcess_UUIDs(); // Enable Draw txtRaw.ResumeLayout(); this.Cursor = Cursors.Default; }