public BaseNode GetEquivalentNode(ClassNode classNode)
        {
            var classInstanceNode = new ClassInstanceNode();

            classInstanceNode.ChangeInnerNode(classNode);

            var pointerNode = new PointerNode();

            pointerNode.ChangeInnerNode(classInstanceNode);
            pointerNode.CopyFromNode(this);

            return(pointerNode);
        }
        public override BaseNode GetEquivalentNode(int count, ClassNode classNode)
        {
            var classInstanceNode = new ClassInstanceNode();

            classInstanceNode.ChangeInnerNode(classNode);

            var arrayNode = new ArrayNode {
                Count = count
            };

            arrayNode.ChangeInnerNode(classInstanceNode);
            arrayNode.CopyFromNode(this);

            return(arrayNode);
        }
        private void createClassFromNodesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (selectedNodes.Count > 0 && !(selectedNodes[0].Node is ClassNode))
            {
                var parentNode = selectedNodes[0].Node.ParentNode as ClassNode;
                if (parentNode != null)
                {
                    var classNode = ClassNode.Create();
                    selectedNodes.Select(h => h.Node).ForEach(classNode.AddNode);

                    var classInstanceNode = new ClassInstanceNode();
                    classInstanceNode.ChangeInnerNode(classNode);

                    parentNode.InsertNode(selectedNodes[0].Node, classInstanceNode);

                    selectedNodes.Select(h => h.Node).ForEach(c => parentNode.RemoveNode(c));

                    ClearSelection();
                }
            }
        }
Beispiel #4
0
        private void createClassFromNodesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var selectedNodes = memoryViewControl.GetSelectedNodes();

            if (selectedNodes.Count > 0 && !(selectedNodes[0].Node is ClassNode))
            {
                if (selectedNodes[0].Node.GetParentContainer() is ClassNode parentNode)
                {
                    var newClassNode = ClassNode.Create();
                    selectedNodes.Select(h => h.Node).ForEach(newClassNode.AddNode);

                    var classInstanceNode = new ClassInstanceNode();
                    classInstanceNode.ChangeInnerNode(newClassNode);

                    parentNode.InsertNode(selectedNodes[0].Node, classInstanceNode);

                    selectedNodes.Select(h => h.Node).ForEach(c => parentNode.RemoveNode(c));

                    ClearSelection();
                }
            }
        }