public bool ProcessLine(string line)
{
// Statements inside braces will be compiled together
if (line == null)
return false;
if (line == "")
return true;
if ((line[0] == '/') && ((line.Length < 2) || (line[1] != '*'))) // Let comment segments through: "/*"
{
if ((line.Length < 2) || (line[1] != '/')) // Ignore comment lines: "//"
ProcessCommand(line);
return true;
}
Match usingMatch = usingDirectiveRegex.Match(line);
if (usingMatch.Success)
{
AddNamespace(usingMatch.Groups["namespace"].Value);
return true;
}
sb.Append(line);
// ignore {} inside strings! Otherwise keep track of our block level
bool insideQuote = false;
for (int i = 0; i < line.Length; i++)
{
if (line[i] == '\"')
insideQuote = !insideQuote;
if (!insideQuote)
{
if (line[i] == '{') bcount++;
else
if (line[i] == '}') bcount--;
}
}
if (bcount == 0)
{
string code = sb.ToString();
sb = new StringBuilder();
if (code != "")
ExecuteLine(code);
}
return true;
}