Exemplo n.º 1
0
        public void AddChild(CrackNode child)
        {
            child.Parent = this;
            Children.Add(child);

            Model.OnNodesChanged(this);
        }
Exemplo n.º 2
0
        public void OnStructureChanged(CrackNode sender)
        {
            if (StructureChanged == null)
            {
                return;
            }

            StructureChanged(sender, new TreePathEventArgs(sender.GetTreePath()));
        }
Exemplo n.º 3
0
        public void OnNodesRemoved(CrackNode sender)
        {
            if (NodesRemoved == null)
            {
                return;
            }

            NodesRemoved(sender, new TreeModelEventArgs(sender.GetTreePath(), (object[])sender.Children.ToArray()));
        }
Exemplo n.º 4
0
        public TreePath GetTreePath()
        {
            List <object> parents = new List <object>();

            parents.Add(this);
            CrackNode p = Parent;

            while (p != null)
            {
                parents.Add(p);
                p = p.Parent;
            }

            parents.Reverse();

            return(new TreePath((object[])parents.ToArray()));
        }
Exemplo n.º 5
0
        public static CrackNode BuildFromElement(CrackModel model, DataElementContainer container)
        {
            CrackNode node = new CrackNode(model, container, 0, 0);

            if (container is Choice)
            {
                foreach (var child in ((Choice)container).choiceElements.Values)
                {
                    if (child is DataElementContainer)
                    {
                        var childNode = BuildFromElement(model, child as DataElementContainer);
                        childNode.Parent = node;
                        node.Children.Add(childNode);
                    }
                    else
                    {
                        var childNode = new CrackNode(model, child, 0, 0);
                        childNode.Parent = node;
                        node.Children.Add(childNode);
                    }
                }
            }

            foreach (var child in container)
            {
                if (child is DataElementContainer)
                {
                    var childNode = BuildFromElement(model, child as DataElementContainer);
                    childNode.Parent = node;
                    node.Children.Add(childNode);
                }
                else
                {
                    var childNode = new CrackNode(model, child, 0, 0);
                    childNode.Parent = node;
                    node.Children.Add(childNode);
                }
            }

            return(node);
        }
Exemplo n.º 6
0
 void cracker_EnterHandleNodeEvent(DataElement element, long position, BitStream data)
 {
     crackMap[element] = new CrackNode(crackModel, element, position, 0);
 }
Exemplo n.º 7
0
 public void RemoveChild(CrackNode child)
 {
     Children.Remove(child);
     Model.OnNodesRemoved(this);
 }