public bool ApplyLinesInternal(string[] lines, int startingIndex, int count, IElement element,
CodeContext codeContext, string fileName = null, bool addStackVariables = true, bool removeStackVariables = true)
{
LastErrorLine = -1;
bool returnValue = true;
mCallStackVariables.Add(new Dictionary<string, object>());
for(int i = startingIndex; i < startingIndex + count && i < lines.Length; i++)
{
string line = lines[i];
try
{
int iBefore = i;
ApplyLine(line.Trim(), codeContext, lines, fileName, ref i);
if (iBefore != i)
{
// ApplyLine may increment the lines if in a
// conditional code block. If so we need to subtract
// 1 because our for-loop will automatically add one.
i--;
}
}
catch (StateSettingException e)
{
string errorText = null;
if (string.IsNullOrEmpty(fileName))
{
errorText = "Error setting state for line: ";
}
else
{
errorText = "Error setting state for line in the file " + fileName + ": ";
}
AddErrorText(errorText + line);
}
catch (Exception)
{
// There was a scripting error
// Eventually we want to log this
AddErrorText("Unknown line: " + line);
returnValue = false;
LastErrorLine = i;
break;
}
}
mCallStackVariables.Remove(TopOfVariableStack);
return returnValue;
}