public void NotifyInstanceAdded(InstanceTreeNode parent, InstanceTreeNode child) { if (InstanceAdded != null) { InstanceAdded(this, new InstanceAddedEventArgs(parent, child)); } }
public void NotifyNodeNameChanged(InstanceTreeNode node) { if (NodeNameChanged != null) { NodeNameChanged(this, new NodeNameChangedEventArgs(node)); } }
public override void AddChild(InstanceTreeNode instance) { _children.Add(instance); if (_notifyChildren) { GetInstanceTree().NotifyInstanceAdded(this, instance); } }
public override void AddChild(InstanceTreeNode instance) { _children.Add(instance); if (_notifyChildren) { GetInstanceTree().NotifyInstanceAdded(this, instance); } }
public StructInstance(StructDef def, InstanceTreeNode parent, Stream stream, long offset) { if (offset < 0) throw new ArgumentOutOfRangeException("offset"); SequenceIndex = -1; _def = def; _parent = parent; _stream = stream; _offset = offset; }
public InstanceTree GetInstanceTree() { InstanceTreeNode parent = this; while (!(parent is InstanceTree)) { parent = parent.Parent; } return((InstanceTree)parent); }
public StructInstance(StructDef def, InstanceTreeNode parent, Stream stream, StructInstance followInstance, bool followChildren) { SequenceIndex = -1; _def = def; _parent = parent; _stream = stream; _followInstance = followInstance; _followChildren = followChildren; }
public StructInstance(StructDef def, InstanceTreeNode parent, Stream stream, StructInstance followInstance, bool followChildren) { SequenceIndex = -1; _def = def; _parent = parent; _stream = stream; _followInstance = followInstance; _followChildren = followChildren; }
public static StructInstance EvaluateParent(StructInstance context, IConvertible[] parameters) { InstanceTreeNode parent = context.Parent; while (parent != null && !(parent is StructInstance)) { parent = parent.Parent; } return((StructInstance)parent); }
private static IEvaluateContext EvaluateRoot(StructInstance context, IConvertible[] parameters) { InstanceTreeNode root = context; while (!(root.Parent is InstanceTree)) { root = root.Parent; } return((StructInstance)root); }
private void CheckMatch(InstanceTreeNode node) { if (node is StructInstance) { var instance = (StructInstance) node; if (instance.Def == _def && (_expr == null || _expr.EvaluateBool(instance))) { _results.Add(instance); } } }
private void CheckMatch(InstanceTreeNode node) { if (node is StructInstance) { var instance = (StructInstance)node; if (instance.Def == _def && (_expr == null || _expr.EvaluateBool(instance))) { _results.Add(instance); } } }
public StructInstance(StructDef def, InstanceTreeNode parent, Stream stream, long offset) { if (offset < 0) { throw new ArgumentOutOfRangeException("offset"); } SequenceIndex = -1; _def = def; _parent = parent; _stream = stream; _offset = offset; }
private static IEvaluateContext EvaluateChild(StructInstance context, IConvertible[] parameters) { int childIndex; InstanceTreeNode parent = context; context.NeedChildren(); if (parameters.Length == 1) { childIndex = parameters[0].ToInt32(null); } else if (parameters.Length == 2) { string groupName = parameters[0].ToString(null); bool groupFound = false; foreach (InstanceTreeNode child in context.Children) { if (child is GroupContainer && child.NodeName == groupName) { parent = child; groupFound = true; } } if (!groupFound) { throw new LoadDataException("Could not find child group " + groupName); } try { childIndex = parameters[1].ToInt32(null); } catch (OverflowException e) { throw new LoadDataException(e.Message); } } else { throw new LoadDataException("'child' context requires 1 or 2 parameters"); } parent.NeedChildren(); var children = parent.Children; if (childIndex < 0 || childIndex >= children.Count) { throw new LoadDataException("Invalid child index " + childIndex + ": child count " + children.Count); } return((IEvaluateContext)children[childIndex]); }
private void PreloadChildren() { int i = 0; while (i < _children.Count) { InstanceTreeNode child = _children [i]; if (child is StructInstance) { (child as StructInstance).Preloading = true; try { child.NeedData(); } finally { (child as StructInstance).Preloading = false; } } i++; } }
private void SaveBlobCells(InstanceTreeNode node) { string name = null; foreach(StructCell cell in node.Cells) { if (cell.GetValue() is string) { name = (string) cell.GetValue(); } else if (cell is BlobCell && name != null) { try { SaveBlobCell((BlobCell) cell, name); } catch (Exception e) { _errors.Add("Failed to extract data for " + name + ": " + e.Message); } } } }
private void SaveBlobCells(InstanceTreeNode node) { string name = null; foreach (StructCell cell in node.Cells) { if (cell.GetValue() is string) { name = (string)cell.GetValue(); } else if (cell is BlobCell && name != null) { try { SaveBlobCell((BlobCell)cell, name); } catch (Exception e) { _errors.Add("Failed to extract data for " + name + ": " + e.Message); } } } }
public abstract void AddChild(InstanceTreeNode instance);
public override void AddChild(InstanceTreeNode node) { _instances.Add(node); NotifyInstanceAdded(this, node); }
public NodeNameChangedEventArgs(InstanceTreeNode node) { _node = node; }
private void AddInstanceNode(TreeNode parent, InstanceTreeNode instance) { TreeNode node; if (parent == null) { string fileName = FindDataFile(instance).Name; node = _structTreeView.Nodes.Add(instance.NodeName + " (" + Path.GetFileName(fileName) + ")"); } else { node = parent.Nodes.Add(AppendSequenceIndex(instance)); } _nodeMap.Add(instance, node); node.Tag = instance; if (instance.HasChildren) { WindowsAPI.SetHasChildren(node, true); } }
public InstanceAddedEventArgs(InstanceTreeNode parent, InstanceTreeNode child) { _parent = parent; _child = child; }
private void UpdateNodeName(InstanceTreeNode instance) { TreeNode node; if (_nodeMap.TryGetValue(instance, out node)) { if (InvokeRequired) { _nameChangedNodes.Add(instance); } else { node.Text = AppendSequenceIndex(instance); } } }
private DataFile FindDataFile(InstanceTreeNode instance) { InstanceTree tree = instance.GetInstanceTree(); return _dataFiles.Find(f => f.InstanceTree == tree); }
public NodeNameChangedEventArgs(InstanceTreeNode node) { _node = node; }
public InstanceAddedEventArgs(InstanceTreeNode parent, InstanceTreeNode child) { _parent = parent; _child = child; }
public void NotifyNodeNameChanged(InstanceTreeNode node) { if (NodeNameChanged != null) { NodeNameChanged(this, new NodeNameChangedEventArgs(node)); } }
private static NodeUI FindNodeUI(InstanceTreeNode instance) { foreach(var cell in instance.Cells) { var ui = NodeUIRegistry.GetNodeUI(cell); if (ui != null) return ui; } return null; }
public abstract void AddChild(InstanceTreeNode instance);
public GroupContainer(InstanceTreeNode parent, string groupName) { _parent = parent; _groupName = groupName; }
private void _structTreeView_AfterSelect(object sender, TreeViewEventArgs e) { _activeInstance = (InstanceTreeNode)e.Node.Tag; if (_nodeControl != null) { _nodeControl.Parent.Controls.Remove(_nodeControl); _nodeControl.Dispose(); _nodeControl = null; } _structTreeView.BeginUpdate(); try { if (_activeInstance == null) { _structGridView.DataSource = new List<StructCell>(); } else { NodeUI ui = FindNodeUI(_activeInstance); if (ui != null) { _nodeControl = ui.CreateControl(); _nodeControl.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(_nodeControl); _structGridView.Visible = false; } else { _structGridView.Visible = true; _structGridView.DataSource = _activeInstance.Cells; } // while we're in BeginUpdate, pre-evaluate all cell values _activeInstance.Cells.ToList().ForEach(cell => cell.Value.ToString()); } } finally { _structTreeView.EndUpdate(); } var instance = _activeInstance as StructInstance; if (instance == null) { InstanceTree tree = ActiveInstanceTree; if (tree != null) { _hexDump.Stream = FindDataFile(tree).Stream; } _currentStructureHighlighter.SetRange(-1, -1); } else { _hexDump.Stream = instance.Stream; _currentStructureHighlighter.SetRange(instance.Offset, instance.EndOffset); } }
public override void AddChild(InstanceTreeNode node) { _instances.Add(node); NotifyInstanceAdded(this, node); }
public void NotifyInstanceAdded(InstanceTreeNode parent, InstanceTreeNode child) { if (InstanceAdded != null) { InstanceAdded(this, new InstanceAddedEventArgs(parent, child)); } }
public GroupContainer(InstanceTreeNode parent, string groupName) { _parent = parent; _groupName = groupName; }
private static string AppendSequenceIndex(InstanceTreeNode node) { string name = node.NodeName; var structInstance = node as StructInstance; if (structInstance != null && structInstance.SequenceIndex >= 0) { name = structInstance.SequenceIndex + ". " + name; } return name; }