public TableContext(NodeDataDTO nodeData) { NodeData = nodeData; HeapNode = new HN(NodeData); var tcinfoHID = HeapNode.HeapNodes[0].Header.UserRoot; var tcinfoHIDbytes = HeapNode.GetHIDBytes(tcinfoHID); TCHeader = new TCINFOHEADER(tcinfoHIDbytes.Data); RowIndexBTH = new BTH(HeapNode, TCHeader.RowIndexLocation); ReverseRowIndex = new Dictionary <uint, uint>(); foreach (var prop in RowIndexBTH.Properties) { var temp = BitConverter.ToUInt32(prop.Value.Data, 0); ReverseRowIndex.Add(temp, BitConverter.ToUInt32(prop.Key, 0)); } RowMatrix = new TCRowMatrix(this, RowIndexBTH); }
public BTH(HN heapNode, HID userRoot = null) { HeapNode = heapNode; var bthHeaderHID = userRoot ?? heapNode.HeapNodes[0].Header.UserRoot; Header = new BTHHEADER(HeapNodeBO.GetHNHIDBytes(heapNode, bthHeaderHID)); Root = new BTHIndexNode(Header.BTreeRoot, this, (int)Header.NumLevels); Properties = new Dictionary <byte[], BTHDataEntry>(new ArrayUtilities.ByteArrayComparer()); var stack = new Stack <BTHIndexNode>(); stack.Push(Root); while (stack.Count > 0) { var cur = stack.Pop(); try { if (cur.Data != null) { foreach (var entry in cur.Data.DataEntries) { Properties.Add(entry.Key, entry); } } } catch (Exception ex) { throw new Exception("Cannot display this view. Failed to create all properties in this location", ex); } if (cur.Children != null) { foreach (var child in cur.Children) { stack.Push(child); } } } }
public static HNDataDTO GetHNHIDBytes(HN heapNode, HID hid) { var hnblock = heapNode.HeapNodes[(int)hid.hidBlockIndex]; return(hnblock.GetAllocation(hid)); }