private void UpdateUI() { // FIXME: Only run the full update once. Afterwards, traverse the // tree checking for visibility changes, and stop descending when // visible = false if (this.uiObjects != null) { return; } Dictionary <int, D3UIObject> d3UIObjects = memReader.GetUIObjects(); Dictionary <int, UIObject> uiObjects = new Dictionary <int, UIObject>(d3UIObjects.Count); foreach (D3UIObject d3UIObj in d3UIObjects.Values) { uiObjects.Add(d3UIObj.ID, new UIObject(memReader, d3UIObj.Pointer, d3UIObj.ID, d3UIObj.Name, d3UIObj.VTable, d3UIObj.Visible)); } foreach (D3UIObject d3UIObj in d3UIObjects.Values) { UIObject uiObj = uiObjects[d3UIObj.ID]; UIObject parent; if (uiObjects.TryGetValue(d3UIObj.ParentID, out parent)) { uiObj.parent = parent; parent.children.Add(uiObj); } } this.uiObjects = uiObjects; }