There is no such a method, but you can simply do it yourself like this:
bool FindText(VirtualTerminal terminal, string text, out int row, out int column)
{
TerminalScreen s = terminal.Screen;
// get all lines of the screen
string[] lines = s.GetRegionText(0, 0, s.Columns, s.Rows);
// iterate through all lines to find the text
for (int r = 0; r < lines.Length; r++)
{
// check whether the text is on the current line
int c = lines[r].IndexOf(text);
if (c >= 0)
{
row = r;
column = c;
return true;
}
}
// the text not found
row = 0;
column = 0;
return false;
}
It can be used like this:
int row, column;
string text = "login:";
if (FindText(terminal, text, out row, out column))
Console.WriteLine("Text '{0}' found at: {1}x{2}.", text, column, row);
else
Console.WriteLine("Text '{0}' not found.", text);
If you would like to search the text using a Regex
or using case insensitive search, adjust the int c = lines[r].IndexOf(text)
line appropriately.