示例#1
0
 private void ReallocateBufferIfNeeded()
 {
     using (History._trace.TraceMethod())
     {
         int historySize = this.GetHistorySize();
         if (historySize == this._capacity)
         {
             return;
         }
         HistoryInfo[] historyInfoArray = new HistoryInfo[historySize];
         int           num = this._countEntriesInBuffer;
         if ((long)num < this._countEntriesAdded)
         {
             num = (int)this._countEntriesAdded;
         }
         if (this._countEntriesInBuffer > historySize)
         {
             num = historySize;
         }
         for (int index = num; index > 0; --index)
         {
             long id = this._countEntriesAdded - (long)index + 1L;
             historyInfoArray[History.GetIndexFromId(id, historySize)] = this._buffer[this.GetIndexFromId(id)];
         }
         this._countEntriesInBuffer = num;
         this._capacity             = historySize;
         this._buffer = historyInfoArray;
     }
 }