Пример #1
0
        public BTHIndexEntry(byte[] bytes, int offset, BTHHEADER header)
        {
            this.Key = bytes.RangeSubset(offset, (int)header.KeySize);
            var temp = offset + (int)header.KeySize;

            this.HID = new HID(bytes.RangeSubset(temp, 4));
        }
Пример #2
0
        public BTHDataRecord(byte[] bytes, BTHHEADER header)
        {
            var keySize  = (int)header.KeySize;
            var dataSize = (int)header.DataSize;

            this.Key   = BitConverter.ToUInt16(bytes.Take(keySize).ToArray(), 0);
            this.Value = BitConverter.ToUInt32(bytes.Skip(keySize).Take(dataSize).ToArray(), 0);
        }
Пример #3
0
        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);
                    }
                }
            }
        }