private byte[] GetData(int len)
{
try
{
var buf = new byte[len];
Array.Copy(_program, _cursor, buf, 0, len);
_cursor += len;
return buf;
}
catch (IndexOutOfRangeException e)
{
// We want running out of data in the array to be treated as a recoverable script parsing exception,
// not something that abnormally terminates the app.
throw new ScriptException("Failed read of " + len + " bytes", e);
}
}