object GetKeyFromBuffer(bool cooked)
{
if (readpos >= writepos)
{
return(null);
}
int next = buffer [readpos];
if (!cooked || !rootmap.StartsWith(next))
{
readpos++;
AdjustBuffer();
return(CreateKeyInfoFromInt(next));
}
int used;
TermInfoStrings str = rootmap.Match(buffer, readpos, writepos - readpos, out used);
if ((int)str == -1)
{
return(null);
}
ConsoleKeyInfo key;
if (keymap [str] != null)
{
key = (ConsoleKeyInfo)keymap [str];
}
else
{
readpos++;
AdjustBuffer();
return(CreateKeyInfoFromInt(next));
}
readpos += used;
AdjustBuffer();
return(key);
}