public void CopyTo(MemoryTraceBuilder destination, int startIndex)
 {
     if ((this.startEntry < this.freeEntry && (startIndex < this.startEntry || startIndex >= this.freeEntry)) || (this.startEntry > this.freeEntry && startIndex < this.startEntry && startIndex >= this.freeEntry))
     {
         throw new ArgumentOutOfRangeException("startIndex");
     }
     int num = startIndex;
     while (num != this.freeEntry)
     {
         TraceEntry traceEntry = this.entries[num];
         destination.BeginEntry(traceEntry);
         if (destination.ReserveSpace(traceEntry.Length))
         {
             int startIndex2 = traceEntry.StartIndex;
             for (int i = traceEntry.Length; i > 0; i--)
             {
                 char nextCharInTraceBuffer = MemoryTraceBuilder.GetNextCharInTraceBuffer(this.traceBuffer, ref startIndex2);
                 destination.AppendWithoutCheck(nextCharInTraceBuffer);
             }
         }
         destination.EndEntry();
         if (++num == this.entryArrayLength)
         {
             num = 0;
         }
     }
 }
 public void Dump(TextWriter writer, bool addHeader, bool verbose)
 {
     if (writer == null)
     {
         return;
     }
     if (addHeader)
     {
         if (verbose)
         {
             writer.WriteLine("ThreadId;ComponentGuid;Instance ID;TraceTag;TraceType;TimeStamp;Message;");
         }
         else
         {
             writer.WriteLine("ThreadId;TimeStamp;Message;");
         }
     }
     List<KeyValuePair<TraceEntry, List<object>>> traceEntries = this.GetTraceEntries();
     foreach (KeyValuePair<TraceEntry, List<object>> keyValuePair in traceEntries)
     {
         TraceEntry key = keyValuePair.Key;
         writer.Write(key.NativeThreadId);
         writer.Write(';');
         if (verbose)
         {
             writer.Write(key.ComponentGuid);
             writer.Write(';');
             writer.Write(key.Id);
             writer.Write(';');
             writer.Write(key.TraceTag);
             writer.Write(';');
             writer.Write(key.TraceType);
             writer.Write(';');
         }
         writer.Write(key.Timestamp.ToString("yyyy-MM-dd HH:mm:ss.fffffff"));
         writer.Write(';');
         if (keyValuePair.Value.Count == 0)
         {
             writer.Write(key.FormatString);
         }
         else
         {
             writer.Write(string.Format(key.FormatString, keyValuePair.Value.ToArray()));
         }
         writer.WriteLine(';');
     }
 }
 public int FindLastEntryIndex(int entriesToFind, TraceType traceType, int traceTag, Guid componentGuid, string formatString)
 {
     int num = 0;
     int num2 = this.freeEntry - 1;
     if (num2 < 0)
     {
         num2 = this.entryArrayLength - 1;
     }
     while (num2 != this.startEntry)
     {
         TraceEntry traceEntry = this.entries[num2];
         if (traceEntry.TraceType == traceType && traceEntry.TraceTag == traceTag && traceEntry.ComponentGuid == componentGuid && object.Equals(traceEntry.FormatString, formatString) && ++num == entriesToFind)
         {
             break;
         }
         if (--num2 < 0)
         {
             num2 = this.entryArrayLength - 1;
         }
     }
     return num2;
 }
 public IEnumerable<TraceEntry> GetTraces()
 {
     List<KeyValuePair<TraceEntry, List<object>>> entries = this.GetTraceEntries();
     foreach (KeyValuePair<TraceEntry, List<object>> pair in entries)
     {
         KeyValuePair<TraceEntry, List<object>> keyValuePair = pair;
         TraceEntry entry = keyValuePair.Key;
         KeyValuePair<TraceEntry, List<object>> keyValuePair2 = pair;
         string traceMessage;
         if (keyValuePair2.Value.Count == 0)
         {
             traceMessage = entry.FormatString;
         }
         else
         {
             string formatString = entry.FormatString;
             KeyValuePair<TraceEntry, List<object>> keyValuePair3 = pair;
             traceMessage = string.Format(formatString, keyValuePair3.Value.ToArray());
         }
         TraceEntry result = new TraceEntry(entry.TraceType, entry.ComponentGuid, entry.TraceTag, entry.Id, traceMessage, 0, entry.NativeThreadId);
         yield return result;
     }
     yield break;
 }
 private void BeginEntry(TraceEntry traceEntry)
 {
     this.PrepareForBeginEntry();
     this.entries[this.freeEntry] = new TraceEntry(traceEntry.TraceType, traceEntry.ComponentGuid, traceEntry.TraceTag, traceEntry.Id, traceEntry.FormatString, this.freeBufferIndex, traceEntry.NativeThreadId);
 }