Esempio n. 1
0
        private LoglineObject GetLoglineObject(int index)
        {
            LogPos logPos = positionList[index];
            String line   = LoglineObject.ReadLine(logPos);

            return(LoglineObject.CreateLoglineObject(line, logPos));
        }
Esempio n. 2
0
        private void copyLoglinesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            lock (listViewLog)
            {
                StringBuilder sb = new StringBuilder();
                foreach (int index in listViewLog.SelectedIndices)
                {
                    if (positionList != null && positionList.Count > index)
                    {
                        sb.AppendLine(LoglineObject.ReadLine(positionList[index]));
                    }
                }

                if (sb.Length > 0)
                {
                    Clipboard.SetText(sb.ToString());
                }
            }
        }
Esempio n. 3
0
        private void OrderByDuration()
        {
            lock (lockObject)
            {
                if (listViewLog.VirtualListSize > 0)
                {
                    if (durationToolStripMenuItem.Checked == true)
                    {
                        return;
                    }

                    timestampToolStripMenuItem.Checked = false;
                    durationToolStripMenuItem.Checked  = true;

                    this.Cursor  = Cursors.WaitCursor;
                    Follow       = false;
                    backupList   = positionList;
                    positionList = positionList.OrderByDescending(x => LoglineObject.GetDurationFromLogPos(LoglineObject.ReadLine(x))).ThenBy(x => x.TimeStamp).ThenBy(x => x.Order).ToList();
                    SelectIndexVisible(0);
                    listViewLog.Refresh();
                    this.Cursor = Cursors.Default;
                }
            }
        }
Esempio n. 4
0
        private void listViewLog_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            LogPos logPos = positionList[e.ItemIndex];
            String line   = LoglineObject.ReadLine(logPos);

            ListViewItem lvi = new ListViewItem();

            lvi.BackColor = GetAgeColor(logPos.TimeStamp);
            lvi.UseItemStyleForSubItems = false;
            LoglineObject loglineObject = LoglineObject.CreateLoglineObject(line, logPos);

            lvi.Text = loglineObject.Timestamp;

            ListViewItem.ListViewSubItem lvsuLevel = new ListViewItem.ListViewSubItem();
            lvsuLevel.Text      = loglineObject.Level;
            lvsuLevel.BackColor = loglineObject.GetLevelBackColor();
            lvsuLevel.ForeColor = loglineObject.GetLevelFrontColor();
            lvi.SubItems.Add(lvsuLevel);

            ListViewItem.ListViewSubItem lvsuDuration = new ListViewItem.ListViewSubItem();
            if (loglineObject.Duration.HasValue)
            {
                lvsuDuration.Text = $"{loglineObject.Duration.Value:n0} ms";
                if (loglineObject.Duration.Value > 1000)
                {
                    lvsuDuration.BackColor = loglineObject.Duration.Value > 5000 ? Color.LightCoral : Color.LightYellow;
                }
            }

            lvi.SubItems.Add(lvsuDuration);
            lvi.SubItems.Add(new ListViewItem.ListViewSubItem()
            {
                Text = loglineObject.ClassnameShort
            });
            lvi.SubItems.Add(new ListViewItem.ListViewSubItem()
            {
                Text = loglineObject.Message
            });
            lvi.SubItems.Add(new ListViewItem.ListViewSubItem()
            {
                Text = loglineObject.Threadname
            });
            lvi.SubItems.Add(new ListViewItem.ListViewSubItem()
            {
                Text = logPos.LogSource.ToString()
            });

            if (logPos.LoglineType == LoglineType.CHILD_LINE)
            {
                foreach (String kv in LogUtils.LineMarkerFont)
                {
                    if (line.Contains(kv))
                    {
                        lvi.SubItems[4].BackColor = Color.LightGreen;
                        lvi.SubItems[4].Font      = new Font(listViewLog.Font, FontStyle.Bold);
                    }
                }
            }

            e.Item = lvi;
        }