Пример #1
0
 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;
         }
     }
 }
Пример #2
0
 private static int GetTraceArgument(List<object> arguments, char[] buffer, ref int startIndex)
 {
     int result = 0;
     int nextCharInTraceBuffer = (int)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex);
     if (nextCharInTraceBuffer == 0)
     {
         int num = (int)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex);
         num += (int)((int)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex) << 16);
         result = 3;
         arguments.Add(num);
     }
     else if (nextCharInTraceBuffer == 1)
     {
         long num2 = (long)((ulong)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex));
         num2 += (long)((long)((ulong)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex)) << 16);
         num2 += (long)((long)((ulong)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex)) << 32);
         num2 += (long)((long)((ulong)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex)) << 48);
         result = 5;
         arguments.Add(num2);
     }
     else if (nextCharInTraceBuffer == 2)
     {
         byte[] array = new byte[16];
         for (int i = 0; i < 16; i += 2)
         {
             char nextCharInTraceBuffer2 = MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex);
             array[i] = (byte)nextCharInTraceBuffer2;
             array[i + 1] = (byte)(nextCharInTraceBuffer2 >> 8);
         }
         Guid guid = new Guid(array);
         arguments.Add(guid);
         result = 9;
     }
     else if (nextCharInTraceBuffer == 3)
     {
         int nextCharInTraceBuffer3 = (int)MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex);
         StringBuilder stringBuilder = new StringBuilder();
         for (int j = 0; j < nextCharInTraceBuffer3; j++)
         {
             stringBuilder.Append(MemoryTraceBuilder.GetNextCharInTraceBuffer(buffer, ref startIndex));
         }
         result = nextCharInTraceBuffer3 + 2;
         arguments.Add(stringBuilder.ToString());
     }
     return result;
 }