public TreeViewItem BuildTree(PackedMemorySnapshot snapshot, RootPathUtility paths) { m_Snapshot = snapshot; m_UniqueId = 1; var root = new TreeViewItem { id = 0, depth = -1, displayName = "Root" }; if (m_Snapshot == null || paths == null || paths.count == 0) { root.AddChild(new TreeViewItem { id = 1, depth = -1, displayName = "" }); return(root); } for (var j = 0; j < paths.count; ++j) { if (window.isClosing) // the window is closing { break; } var path = paths[j]; var parent = root; for (var n = path.count - 1; n >= 0; --n) { var obj = path[n]; Item newItem = null; if (obj.native.isValid) { newItem = AddNativeUnityObject(parent, obj.native.packed); } else if (obj.managed.isValid) { newItem = AddManagedObject(parent, obj.managed.packed); } else if (obj.gcHandle.isValid) { newItem = AddGCHandle(parent, obj.gcHandle.packed); } else if (obj.staticField.isValid) { newItem = AddStaticField(parent, obj.staticField.packed); } if (parent == root) { parent = newItem; newItem.rootPath = path; } } } return(root); }
public void Clear() { m_RootPathControl.SetTree(null); m_Selected = null; m_RootPaths.Abort(); m_RootPaths = new RootPathUtility(); ScheduleJob(new RootPathJob() { control = m_RootPathControl }); }