Esempio n. 1
0
        protected override IList<BTreeNodeRecord> ReadRecords(byte[] buffer, int offset)
        {
            int totalRecords = Descriptor.NumRecords;
            int nodeSize = Tree.NodeSize;

            int headerRecordOffset = Utilities.ToUInt16BigEndian(buffer, nodeSize - 2);
            int userDataRecordOffset = Utilities.ToUInt16BigEndian(buffer, nodeSize - 4);
            int mapRecordOffset = Utilities.ToUInt16BigEndian(buffer, nodeSize - 6);

            BTreeNodeRecord[] results = new BTreeNodeRecord[3];
            results[0] = new BTreeHeaderRecord();
            results[0].ReadFrom(buffer, offset + headerRecordOffset);

            results[1] = new BTreeGenericRecord(mapRecordOffset - userDataRecordOffset);
            results[1].ReadFrom(buffer, offset + userDataRecordOffset);

            results[2] = new BTreeGenericRecord(nodeSize - ((totalRecords * 2) + mapRecordOffset));
            results[2].ReadFrom(buffer, offset + mapRecordOffset);

            return results;
        }
Esempio n. 2
0
        protected override IList <BTreeNodeRecord> ReadRecords(byte[] buffer, int offset)
        {
            int totalRecords = Descriptor.NumRecords;
            int nodeSize     = Tree.NodeSize;

            int headerRecordOffset   = Utilities.ToUInt16BigEndian(buffer, nodeSize - 2);
            int userDataRecordOffset = Utilities.ToUInt16BigEndian(buffer, nodeSize - 4);
            int mapRecordOffset      = Utilities.ToUInt16BigEndian(buffer, nodeSize - 6);

            BTreeNodeRecord[] results = new BTreeNodeRecord[3];
            results[0] = new BTreeHeaderRecord();
            results[0].ReadFrom(buffer, offset + headerRecordOffset);

            results[1] = new BTreeGenericRecord(mapRecordOffset - userDataRecordOffset);
            results[1].ReadFrom(buffer, offset + userDataRecordOffset);

            results[2] = new BTreeGenericRecord(nodeSize - ((totalRecords * 2) + mapRecordOffset));
            results[2].ReadFrom(buffer, offset + mapRecordOffset);

            return(results);
        }