/// <inheritdoc /> public StringBuilder Dump(InteropWindowCacheFlags cacheFlags = InteropWindowCacheFlags.CacheAll, StringBuilder dump = null, string indentation = "") { this.Fill(cacheFlags); dump = dump ?? new StringBuilder(); dump.AppendLine($"{indentation}{nameof(Handle)}={Handle}"); if (cacheFlags.HasFlag(InteropWindowCacheFlags.Classname)) { dump.AppendLine($"{indentation}{nameof(Classname)}={Classname}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Caption)) { dump.AppendLine($"{indentation}{nameof(Caption)}={Caption}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Text)) { dump.AppendLine($"{indentation}{nameof(Text)}={Text}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Info)) { dump.AppendLine($"{indentation}{nameof(Info)}={Info}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Maximized)) { dump.AppendLine($"{indentation}{nameof(IsMaximized)}={IsMaximized}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Minimized)) { dump.AppendLine($"{indentation}{nameof(IsMinimized)}={IsMinimized}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Visible)) { dump.AppendLine($"{indentation}{nameof(IsVisible)}={IsVisible}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Parent)) { dump.AppendLine($"{indentation}{nameof(Parent)}={Parent}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.ScrollInfo)) { dump.AppendLine($"{indentation}{nameof(CanScroll)}={CanScroll}"); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Children) && !HasParent) { foreach (var child in this.GetChildren()) { child.Dump(cacheFlags, dump, indentation + "\t"); } } if (!cacheFlags.HasFlag(InteropWindowCacheFlags.ZOrderedChildren)) { return(dump); } if (HasParent) { return(dump); } foreach (var child in this.GetZOrderedChildren()) { child.Dump(cacheFlags, dump, indentation + "\t"); } return(dump); }
/// <summary> /// Fill ALL the information of the InteropWindow /// </summary> /// <param name="interopWindow">InteropWindow</param> /// <param name="cacheFlags">InteropWindowCacheFlags to specify which information is retrieved and what not</param> public static IInteropWindow Fill(this IInteropWindow interopWindow, InteropWindowCacheFlags cacheFlags = InteropWindowCacheFlags.CacheAll) { if (cacheFlags.HasFlag(InteropWindowCacheFlags.Children) && cacheFlags.HasFlag(InteropWindowCacheFlags.ZOrderedChildren)) { throw new ArgumentException("Can't have both Children & ZOrderedChildren", nameof(cacheFlags)); } var forceUpdate = cacheFlags.HasFlag(InteropWindowCacheFlags.ForceUpdate); if (cacheFlags.HasFlag(InteropWindowCacheFlags.Info)) { interopWindow.GetInfo(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Caption)) { interopWindow.GetCaption(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Classname)) { interopWindow.GetClassname(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.ProcessId)) { interopWindow.GetProcessId(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Parent)) { interopWindow.GetParent(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Visible)) { interopWindow.IsVisible(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Maximized)) { interopWindow.IsMaximized(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Minimized)) { interopWindow.IsMinimized(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.ScrollInfo)) { interopWindow.GetWindowScroller(forceUpdate: forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Children)) { interopWindow.GetChildren(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.ZOrderedChildren)) { interopWindow.GetZOrderedChildren(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Placement)) { interopWindow.GetPlacement(forceUpdate); } if (cacheFlags.HasFlag(InteropWindowCacheFlags.Text)) { interopWindow.GetText(forceUpdate); } return(interopWindow); }