public void ExecuteCommandBuffer()
{
idCmdArgs args = null;
while(_cmdBuffer.Length > 0)
{
if(_wait > 0)
{
// skip out while text still remains in buffer, leaving it for next frame.
_wait--;
break;
}
int quotes = 0, i;
int len = _cmdBuffer.Length;
for(i = 0; i < len; i++)
{
if(_cmdBuffer[i] == '"')
{
quotes++;
}
if(((quotes & 1) == 0) && (_cmdBuffer[i] == ';'))
{
break; // don't break if inside a quoted string.
}
if((_cmdBuffer[i] == '\n') || (_cmdBuffer[i] == '\r'))
{
break;
}
}
string cmd = _cmdBuffer.ToString().Substring(0, i);
_cmdBuffer = _cmdBuffer.Remove(0, i + 1);
if(cmd == "_execTokenized")
{
args = _tokenizedCommands[0];
_tokenizedCommands.RemoveAt(0);
}
else
{
args = new idCmdArgs(cmd, false);
}
// execute the command line that we have already tokenized.
ExecuteTokenizedString(args);
}
}