private List<string> ParseInclude(List<string> lines)
{
for (int i = 0; i < lines.Count; i++)
{
if (!lines[i].ToUpper().StartsWith("#INCLUDE")) continue;
string[] split = lines[i].Split(' ');
string path = Path.Combine(Settings.EnvirPath, split[1].Substring(1, split[1].Length - 2));
string page = ("[" + split[2] + "]").ToUpper();
bool start = false, finish = false;
var parsedLines = new List<string>();
if (!File.Exists(path))
{
MessageQueue.Enqueue(string.Format("INCLUDE Script Not Found: {0}", path));
return parsedLines;
}
IList<string> extLines = File.ReadAllLines(path);
for (int j = 0; j < extLines.Count; j++)
{
if (!extLines[j].ToUpper().StartsWith(page)) continue;
for (int x = j + 1; x < extLines.Count; x++)
{
if (extLines[x].Trim() == ("{"))
{
start = true;
continue;
}
if (extLines[x].Trim() == ("}"))
{
finish = true;
break;
}
parsedLines.Add(extLines[x]);
}
}
if (start && finish)
{
lines.InsertRange(i + 1, parsedLines);
parsedLines.Clear();
}
}
lines.RemoveAll(str => str.ToUpper().StartsWith("#INCLUDE"));
return lines;
}