public static int FunctionLength(MyStream sr, string s)
{
int count = 0;
uint curPos = sr.Pos;
Stack myStack = new Stack();
s = sr.ReadLine();
myStack.Push(s);
bool found = false;
while ((s != null && myStack.Count > 0))
{
count++;
s = sr.ReadLine();
if (s.IndexOf("{") != -1)
{
myStack.Push(s);
}
if (s.IndexOf("}") != -1)
{
myStack.Pop();
}
}
if (myStack.Count == 0)
{
found = true;
}
count = count - 1;
myStack.Clear();
sr.Seek(curPos);
return(count);
}