Esempio n. 1
0
        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();
        }