Exemple #1
0
        public HexNode FindNode(HexVM structure, HexField field)
        {
            if (structure is MetaDataTableRecordVM mdTblRecord)
            {
                return(FindTokenNode(mdTblRecord.Token.Raw));
            }

            TreeNode.EnsureChildrenLoaded();
            foreach (var child in TreeNode.DataChildren.OfType <HexNode>())
            {
                var node = child.FindNode(structure, field);
                if (node != null)
                {
                    return(node);
                }
            }
            return(null);
        }
Exemple #2
0
        public HexNode FindNode(HexVM structure, HexField field)
        {
            Debug.Assert(!(structure is MetaDataTableRecordVM), "Use " + nameof(PENode) + "'s method instead");
            bool found = false;

            foreach (var span in Spans)
            {
                if (span.Contains(field.Span))
                {
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                return(null);
            }

            foreach (var vm in HexVMs)
            {
                foreach (var f in vm.HexFields)
                {
                    if (f == field)
                    {
                        return(this);
                    }
                }
            }

            TreeNode.EnsureChildrenLoaded();
            foreach (var child in TreeNode.DataChildren.OfType <HexNode>())
            {
                var node = child.FindNode(structure, field);
                if (node != null)
                {
                    return(node);
                }
            }

            return(null);
        }