static GUIDumpData BuildDumpTree(Control rootControl)
{
var data = new GUIDumpData
{
Control = rootControl.GetType().Name,
Name = rootControl.Name,
X = rootControl.X,
Y = rootControl.Y,
Width = rootControl.Width,
Height = rootControl.Height,
IsHidden = rootControl.IsHidden,
Focused = rootControl.HasFocus,
};
if (rootControl.Children.Count != 0)
data.Children = new List<GUIDumpData>();
// Recursively go through each child to build the dump tree.
foreach (var child in rootControl.Children)
data.Children.Add(BuildDumpTree(child));
return data;
}