public MemoryElement GetNextNode()
{
MemoryElement result;
if (this.expanded && this.children.Count > 0)
{
result = this.children[0];
}
else
{
int num = this.GetChildIndexInList() + 1;
if (num < this.parent.children.Count)
{
result = this.parent.children[num];
}
else
{
MemoryElement memoryElement = this.parent;
while (memoryElement.parent != null)
{
int num2 = memoryElement.GetChildIndexInList() + 1;
if (num2 < memoryElement.parent.children.Count)
{
result = memoryElement.parent.children[num2];
return(result);
}
memoryElement = memoryElement.parent;
}
result = null;
}
}
return(result);
}