private void ActionRefreshFiles_Click(object sender, EventArgs e) { TextBoxPrevious.Clear(); SelectFile.Items.Clear(); foreach (var file in DebugManager.GetTraceFiles(false)) { if (!EditOnlyErrors.Checked) { SelectFile.Items.Add(file); } else { var content = File.ReadAllText(file); string str1 = $"{LogTraceEvent.Error} {DebugManager.EventSeparator}"; string str2 = $"{LogTraceEvent.Exception} {DebugManager.EventSeparator}"; if (content.IndexOf(str1, StringComparison.OrdinalIgnoreCase) >= 0 || content.IndexOf(str2, StringComparison.OrdinalIgnoreCase) >= 0) { SelectFile.Items.Add(file); } } } SelectFileNavigator.Refresh(); SelectFile.Enabled = SelectFile.Items.Count > 0; ActionDeleteFile.Enabled = SelectFile.Enabled; LabelFilesCount.Text = SysTranslations.TraceFilesCount.GetLang(SelectFile.Items.Count); if (SelectFile.Enabled) { SelectFile.SelectedIndex = SelectFile.Items.Count - 1; } }
private void SelectFile_SelectedIndexChanged(object sender, EventArgs e) { if (SelectFile.SelectedIndex < 0) { return; } TextBoxPrevious.Clear(); TextBoxPrevious.Lines = File.ReadAllLines((string)SelectFile.SelectedItem); }