private async void this_Load(object sender, EventArgs e) { PropTree.BeginUpdate(); PropTree.Nodes.Clear(); var trunk = PropTree.Nodes.Add(_value.ToString()); trunk.ImageKey = "object"; if (_value.Tag == DValueTag.HeapPtr) { await PopulateTreeNode(trunk, (HeapPtr)_value); } trunk.Expand(); PropTree.EndUpdate(); }
public ObjectViewer(Inferior inferior, string objectName, DValue value) { InitializeComponent(); ObjectNameTextBox.Text = string.Format("eval('{0}') = {1};", objectName.Replace(@"\", @"\\").Replace("'", @"\'").Replace("\n", @"\n").Replace("\r", @"\r"), value.ToString()); TreeIconImageList.Images.Add("object", Resources.StackIcon); TreeIconImageList.Images.Add("prop", Resources.VisibleIcon); TreeIconImageList.Images.Add("hiddenProp", Resources.InvisibleIcon); _inferior = inferior; _value = value; }
private async Task PopulateTreeNode(TreeNode node, HeapPtr ptr) { PropTree.BeginUpdate(); var props = await _inferior.GetObjPropDescRange(ptr, 0, int.MaxValue); foreach (var key in props.Keys) { if (props[key].Flags.HasFlag(PropFlags.Accessor)) { DValue getter = props[key].Getter; DValue setter = props[key].Setter; var nodeText = string.Format("{0} = get: {1}, set: {2}", key, getter.ToString(), setter.ToString()); var valueNode = node.Nodes.Add(nodeText); valueNode.ImageKey = props[key].Flags.HasFlag(PropFlags.Enumerable) ? "prop" : "hiddenProp"; valueNode.SelectedImageKey = valueNode.ImageKey; valueNode.Tag = props[key]; } else { DValue value = props[key].Value; var nodeText = string.Format("{0} = {1}", key, value.ToString()); var valueNode = node.Nodes.Add(nodeText); valueNode.ImageKey = props[key].Flags.HasFlag(PropFlags.Enumerable) ? "prop" : "hiddenProp"; valueNode.SelectedImageKey = valueNode.ImageKey; valueNode.Tag = props[key]; if (value.Tag == DValueTag.HeapPtr) { valueNode.Nodes.Add(""); } } } if (node.Nodes.Count > 0 && node.Nodes[0].Text == "") { node.Nodes.RemoveAt(0); } PropTree.EndUpdate(); }
public int GetHashCode([DisallowNull] DValue <JsonElement> obj) => obj.ToString()?.GetHashCode(StringComparison.Ordinal) ?? 0;
public bool Equals([AllowNull] DValue <JsonElement> x, [AllowNull] DValue <JsonElement> y) => string.Equals(x?.ToString(), y?.ToString(), StringComparison.Ordinal);