public Record(DataFlags dataflags, ulong msgNum, DateTime time, ReaderThreadInfo threadInfo, Reader.Session session, string msg) { MsgNum = msgNum; Time = time; Thread = threadInfo.Thread; ThreadName = threadInfo.ThreadName; TLevel = threadInfo.TLevel; Logger = threadInfo.Logger; StackDepth = threadInfo.Depth; MethodName = threadInfo.MethodName; Caller = threadInfo.StackTop; Session = session; if ((dataflags & DataFlags.MethodEntry) != DataFlags.None) { // This is a method entry record. It always contains exactly one line of text. IsEntry = true; Lines = new string[] { string.Format("{{{0}: entered", MethodName.Name) }; } else if ((dataflags & DataFlags.MethodExit) != DataFlags.None) { // Method exit records always contain exactly one line of text. IsExit = true; Lines = new string[] { string.Format("}}{0}: exiting", MethodName.Name) }; } else { // The message text for this record may contain newlines. Split the // message into one or more lines. Lines = msg.Split(_splitArg); if (Lines.Length > 1) { // It's common for a carriage return to exist at the // end of each line. Remove them. for (int i = 0; i < Lines.Length; ++i) { Lines[i] = Lines[i].TrimEnd('\r'); } // It's common for the last line to be empty. If so, remove it. if (Lines.Last().Trim() == string.Empty) { Lines = Lines.Take(Lines.Length - 1).ToArray(); } } IsCollapsed = Lines.Length > 1 && !Settings.Default.ExpandNewlines; } // Each line also has a bool to indicate if it is bookmarked // and a row index it may map to. IsBookmarked = new bool[Lines.Length]; RowIndices = new int[Lines.Length]; }
// This constructs a missing MethodEntry Record from the given ReaderStackEntry. // This is for MethodEntry records lost due to wrapping. public Record(ReaderThreadInfo threadInfo, ExplicitStackEntry methodEntry, Reader.Session session) { IsEntry = true; //IsExit = false; MsgNum = 0; // TBD Time = DateTime.MinValue; // TBD Index = 0; // TBD Thread = threadInfo.Thread; ThreadName = threadInfo.ThreadName; TLevel = methodEntry.TLevel; Logger = methodEntry.Logger; StackDepth = methodEntry.Depth; MethodName = methodEntry.Method; Lines = new string[] { string.Format("{{{0}: entered (replaces record lost due to wrapping)", MethodName.Name) }; Session = session; // Each record also has a bool to indicate if it is bookmarked // and a row index it may map to. IsBookmarked = new bool[1]; RowIndices = new int[1]; }