Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
 public HNHDR(byte[] bytes)
 {
     this.ClientSigType   = (ClientSig)bytes[3];
     this.bSig            = bytes[2];
     this.OffsetHNPageMap = BitConverter.ToUInt16(bytes, 0);
     this.UserRoot        = new HID(bytes.Skip(4).Take(4).ToArray());
     this.FillLevel_raw   = BitConverter.ToUInt32(bytes, 8);
 }
Ejemplo n.º 3
0
        public BTHHEADER(HNDataDTO block)
        {
            var bytes = block.Data;

            this.BType     = bytes[0];
            this.KeySize   = bytes[1];
            this.DataSize  = bytes[2];
            this.NumLevels = bytes[3];
            this.BTreeRoot = new HID(bytes.RangeSubset(4, 4));
        }
Ejemplo n.º 4
0
        public HNDataDTO GetAllocation(HID hid)
        {
            var begOffset = PageMap.AllocationTable[(int)hid.hidIndex - 1];
            var endOffset = PageMap.AllocationTable[(int)hid.hidIndex];

            return(new HNDataDTO
            {
                Data = _bytes.Data.RangeSubset(begOffset, endOffset - begOffset),
                BlockOffset = begOffset,
                Parent = _bytes
            });
        }
Ejemplo n.º 5
0
        public BTHDataNode(HID hid, BTH tree)
        {
            this.Tree = tree;

            var bytes = tree.GetHIDBytes(hid);

            this._data       = bytes;
            this.DataEntries = new List <BTHDataEntry>();
            for (int i = 0; i < bytes.Data.Length; i += (int)(tree.Header.KeySize + tree.Header.DataSize))
            {
                this.DataEntries.Add(new BTHDataEntry(bytes, i, tree));
            }
        }
Ejemplo n.º 6
0
 public TCINFOHEADER(byte[] bytes)
 {
     this.Type               = bytes[0];
     this.ColumnCount        = bytes[1];
     this.EndOffset48        = BitConverter.ToUInt16(bytes, 2);
     this.EndOffset2         = BitConverter.ToUInt16(bytes, 4);
     this.EndOffset1         = BitConverter.ToUInt16(bytes, 6);
     this.EndOffsetCEB       = BitConverter.ToUInt16(bytes, 8);
     this.RowIndexLocation   = new HID(bytes, 10);
     this.RowMatrixLocation  = BitConverter.ToUInt32(bytes, 14);
     this.ColumnsDescriptors = new List <TCOLDESC>();
     for (var i = 0; i < this.ColumnCount; i++)
     {
         this.ColumnsDescriptors.Add(new TCOLDESC(bytes, 22 + i * 8));
     }
 }
Ejemplo n.º 7
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);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public BTHIndexNode(HID hid, BTH tree, int level)
        {
            this.Level = level;
            this.HID   = hid;
            if (hid.hidBlockIndex == 0 && hid.hidIndex == 0)
            {
                return;
            }

            this.Entries = new List <BTHIndexEntry>();

            if (level == 0)
            {
                this.Data = new BTHDataNode(hid, tree);

                /*
                 * for (int i = 0; i < bytes.Length; i += (int)tree.Header.KeySize + 4)
                 *  this.Entries.Add(new BTHIndexEntry(bytes, i, tree.Header));
                 * this.DataChildren = new List<BTHDataNode>();
                 * foreach(var entry in this.Entries)
                 *  this.DataChildren.Add(new BTHDataNode(entry.HID, tree));*/
            }
            else
            {
                var bytes = tree.GetHIDBytes(hid);
                for (int i = 0; i < bytes.Data.Length; i += (int)tree.Header.KeySize + 4)
                {
                    this.Entries.Add(new BTHIndexEntry(bytes.Data, i, tree.Header));
                }
                this.Children = new List <BTHIndexNode>();
                foreach (var entry in this.Entries)
                {
                    this.Children.Add(new BTHIndexNode(entry.HID, tree, level - 1));
                }
            }
        }
Ejemplo n.º 9
0
 public HNDataDTO GetHIDBytes(HID hid)
 {
     return(HeapNodes[(int)hid.hidBlockIndex].GetAllocation(hid));
 }
Ejemplo n.º 10
0
 public HNDataDTO GetHIDBytes(HID hid)
 {
     return(HeapNode.GetHIDBytes(hid));
 }
Ejemplo n.º 11
0
        public static HNDataDTO GetHNHIDBytes(HN heapNode, HID hid)
        {
            var hnblock = heapNode.HeapNodes[(int)hid.hidBlockIndex];

            return(hnblock.GetAllocation(hid));
        }