public string DequeueCommandEntry() { _stringBuilder.Clear(); for (int i = 0; i < _commandEntries.Count; i++) { OutputEntry entry = _commandEntries[i]; _stringBuilder.Append(entry.Value); //if (i != _commandEntries.Count - 1) _stringBuilder.Append(Console.NewlineSymbol); _entryPool.Release(entry); } _commandEntries.Clear(); return(_stringBuilder.ToString()); }
private void DrawRow(OutputEntry entry, ref Vector2 viewPosition, ref int rowCounter, bool drawPrefix) { for (int j = entry.Lines.Count - 1; j >= 0; j--) { Vector2 tempViewPos = viewPosition; if (drawPrefix) { Console.SpriteBatch.DrawString( Console.Font, Console.ConsoleInput.InputPrefix, tempViewPos, Console.ConsoleInput.InputPrefixColor); tempViewPos.X += Console.ConsoleInput.InputPrefixSize.X; } Console.SpriteBatch.DrawString( Console.Font, entry.Lines[j], tempViewPos, Console.FontColor); viewPosition.Y -= Console.FontSize.Y; rowCounter++; } }
private void RemoveOverflownBufferEntriesIfAllowed() { if (!RemoveOverflownEntries) { return; } while (_numRows > _maxNumRows) { OutputEntry entry = _entries.Peek(); // Remove entry only if it is completely hidden from view. if (_numRows - entry.Lines.Count >= _maxNumRows) { _numRows -= entry.Lines.Count; _entries.Dequeue(); _entryPool.Release(entry); } else { break; } } }