public void 加载日志(List <FileInfo> __日志路径列表) { var __日志路径 = __日志路径列表[0]; 择版本(__日志路径); _当前分析.加载日志(__日志路径列表); }
private void 加载日志文件() { this.out详细信息列表.DataSource = null; this.out概要信息列表.DataSource = null; this.out警告信息列表.DataSource = null; this.out起始时间.Text = string.Empty; this.out启动次数.Text = string.Empty; this.out结束时间.Text = string.Empty; this.out警告数量.Text = string.Empty; this.in启动次数_次数.Value = 0; _日志路径 = this.out文件路径.Text.Trim(); if (string.IsNullOrEmpty(_日志路径)) { if (Environment.GetCommandLineArgs().Length > 1) { _日志路径 = Environment.GetCommandLineArgs()[1]; this.out文件路径.Text = _日志路径; } else { _日志路径 = U路径.获取绝对路径("详细信息.log"); if (!File.Exists(_日志路径)) { _日志路径 = U路径.获取绝对路径("日志\\详细信息.log"); if (!File.Exists(_日志路径)) { //XtraMessageBox.Show("请将'详细日志.log'复制到程序目录,然后刷新", "未找到日志文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); _日志路径 = string.Empty; return; } } } } if (!string.IsNullOrEmpty(_日志路径)) { SplashScreenManager.ShowForm(this.ParentForm, typeof(DemoWaitForm), true, true, false); try { this.out文件路径.Text = _日志路径; var __目录路径 = Path.GetDirectoryName(_日志路径); var __文件名称 = Path.GetFileName(_日志路径); var __路径列表 = new DirectoryInfo(__目录路径).GetFiles(__文件名称 + ".*").ToList(); //__路径列表.Sort((m, n) => m.LastWriteTime.CompareTo(n.LastWriteTime)); _I文本分析.加载日志(__路径列表); On加载事件(__路径列表); try { _概要信息 = _I文本分析.初步分析(); } catch (ArgumentException ex) { XtraMessageBox.Show(ex.Message, "文件分析错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); _日志路径 = string.Empty; return; } this.out起始时间.Text = _概要信息.起始时间.ToString("MM-dd HH:mm"); this.out启动次数.Text = _概要信息.启动次数.ToString(); this.out结束时间.Text = _概要信息.结束时间.ToString("MM-dd HH:mm"); this.out警告数量.Text = _概要信息.警告列表.Count.ToString(); this.out警告信息列表.DataSource = _概要信息.警告列表; this.out警告信息表格.FocusedRowHandle = -1; this.in启动次数_次数.Value = _概要信息.启动次数; this.in指定时间_起始时间.Time = _概要信息.启动列表[0].时间; this.out文件路径.ShowToolTips = true; this.out文件路径.ToolTip = _日志路径; } catch (Exception ex) { XtraMessageBox.Show("分析出错: " + ex.Message); } finally { SplashScreenManager.CloseForm(false); } } }