Example #1
0
        private TreeNode MakeNode(IRomDataObject item)
        {
            TreeNode node = new TreeNode(item.DisplayName);

            node.Tag      = item;
            node.ImageKey = node.SelectedImageKey = node.StateImageKey = getImageKey(item);

            IRomDataParentObject p = item as IRomDataParentObject;

            if (p != null)
            {
                if (p.HasSubItems)
                {
                    List <IRomDataObject> objects = new List <IRomDataObject>();
                    objects.AddRange(p.GetSubItems());
                    objects.Sort(romDataItemOffsetCompare);
                    foreach (IRomDataObject subItem in objects)
                    {
                        node.Nodes.Add(MakeNode(subItem));
                    }
                }
            }

            return(node);
        }
Example #2
0
        private void DisplayNode(TreeNode node)
        {
            IRomDataParentObject data = node.Tag as IRomDataParentObject;

            if (data != null && data.HasListItems)
            {
                ShowObjectSubitems(data);
            }

            IRomDataObject obj = node.Tag as IRomDataObject;
            var            ex  = obj as IRomDataObjectEx;

            bool nonContiguous = false; // Assume data is contiguous if obj does not specify

            if (ex != null)
            {
                nonContiguous = !ex.Contiguous;
            }

            // Show hex data for an object that has contiguous data and a specified size
            if (!nonContiguous && (obj != null && obj.Size != 0))
            {
                DisplayDataString(RomDataObjects.FormatData(obj, rom.data), obj.Offset, obj.Size);
            }
        }
Example #3
0
        private void ShowObjectSubitems(IRomDataParentObject data)
        {
            PointerList.Items.Clear();

            IList <LineDisplayItem> items = data.GetListItems();

            foreach (LineDisplayItem item in items)
            {
                ListViewItem newItem = new ListViewItem(new string[] {
                    item.text,
                    item.offset.ToString("X"),
                    item.length.ToString("X"),
                    item.FormatData()
                });
                newItem.Tag = item;
                PointerList.Items.Add(newItem);
            }
        }