internal AsmView(BaseNode node) { InitializeComponent(); tvAsm.ImageList = MainFrame.ilObjTree; AddRoot(node); }
internal void AddRoot(BaseNode node) { BaseNode newnode = (BaseNode)node.Clone(); tvAsm.Nodes.Add(newnode); Text = node.ToString(); }
//this actually indicates whether we need to check subnodes -- foldernodes need not have 'generatechildren' //called but their children are still checked. public bool NeedToExpandNode(BaseNode node) { if (node is AsmNode || node is NamespaceNode) return true; if (node is ModuleNode || node is FileRegionNode || node is TableNode || node is ErrorNode || node is ObjNode || node is AsmRefNode || node is RelationshipNode) return false; if (node is FolderNode && node.Parent is AsmNode) return true; if (_findProperties || _findEvents || _findFields || _findMethods || _findParameters) { if (node is TypeNode) return true; if (node is FolderNode && node.Parent is TypeNode) return true; } if (_findParameters) { if (node is MethodNode || node is ConsNode) return true; if (node is FolderNode && (node.Parent is MethodNode || node.Parent is ConsNode) && node.Text.StartsWith("Param")) return true; } if (_findResources) { if (node is ManResNode) return true; } return false; }
//You can't match a constructor as it has no name. public bool Match(BaseNode node) { if (node is ModuleNode || node is TableNode || node is RowNode || node is ObjNode || node is FileNode || node is FileRegionNode || node is FolderNode || node is AsmNode || node is AsmRefNode || node is RelationshipNode || node is ConsNode) return false; if (node is TypeNode && !_findTypes) return false; if (node is NamespaceNode && !_findTypes) return false; if (node is MethodNode && !_findMethods) return false; if (node is ParamNode && !_findParameters) return false; if (node is FieldNode && !_findFields) return false; if (node is EventNode && !_findEvents) return false; if ((node is ResNode || node is ManResNode) && !_findResources) return false; if (node is PropNode && !_findProperties) return false; string a, b; a = _str; b = node.MatchingString; if (!_caseful) { a = a.ToLower(); b = b.ToLower(); } if (_wholeWord) { return a == b; } return (b.IndexOf(a) != -1); }
internal BaseNode GetSuccessorNode(BaseNode bn, FindState f) { BaseNode succ = bn; //maybe, check to find a child 'successor' if (f.NeedToExpandNode(bn)) { bn.GenerateChildren(); if (bn.Nodes.Count != 0) { return (BaseNode)bn.Nodes[0]; } } //make sure there is a sib, going up tree if necessary while(succ.NextNode == null) { //give up if we reach top. if (succ.Parent == null) return null; succ = (BaseNode)succ.Parent; } succ = (BaseNode)succ.NextNode; return succ; }