private uint getLeafNodeContainingRecord(HFSPlusAttrKey recordKeyID) { byte[] nodeRawData = new byte[this.nodeSize]; uint currentNodeNumber = this.header.headerInfo.rootNode; absNode.nodeType currentNodeType = getNodeType(currentNodeNumber); // why is currentNodeType showing as 255 when it should be -1? while (currentNodeType != absNode.nodeType.leaf) { fs.Seek(currentNodeNumber * this.nodeSize, SeekOrigin.Begin); fs.Read(nodeRawData, 0, this.nodeSize); attributesIndexNode currentNode = new attributesIndexNode(ref nodeRawData); attributesIndexNode.attrIndexRecord perhapsThisRecord = currentNode.records[0]; foreach (attributesIndexNode.attrIndexRecord record in currentNode.records) { bool equalsSearch = attrKeyCompare(record.attrKey, recordKeyID, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.equalsTrialKey; bool lessThanSearch = attrKeyCompare(record.attrKey, recordKeyID, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.greaterThanTrialKey; bool greaterThanOrEqualToBestKnown = attrKeyCompare(record.attrKey, perhapsThisRecord.attrKey, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.lessThanTrialKey || attrKeyCompare(record.attrKey, perhapsThisRecord.attrKey, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.equalsTrialKey; if (equalsSearch) { return(record.pointer); } else if (lessThanSearch && greaterThanOrEqualToBestKnown) { perhapsThisRecord = record; } } currentNodeNumber = perhapsThisRecord.pointer; currentNodeType = (absNode.nodeType)getNodeType(currentNodeNumber); } return(currentNodeNumber); }
private uint getLeafNodeContainingRecord(HFSPlusAttrKey recordKeyID) { byte[] nodeRawData = new byte[this.nodeSize]; uint currentNodeNumber = this.header.headerInfo.rootNode; absNode.nodeType currentNodeType = getNodeType(currentNodeNumber); // why is currentNodeType showing as 255 when it should be -1? while (currentNodeType != absNode.nodeType.leaf) { fs.Seek(currentNodeNumber * this.nodeSize, SeekOrigin.Begin); fs.Read(nodeRawData, 0, this.nodeSize); attributesIndexNode currentNode = new attributesIndexNode(ref nodeRawData); attributesIndexNode.attrIndexRecord perhapsThisRecord = currentNode.records[0]; foreach (attributesIndexNode.attrIndexRecord record in currentNode.records) { bool equalsSearch = attrKeyCompare(record.attrKey, recordKeyID, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.equalsTrialKey; bool lessThanSearch = attrKeyCompare(record.attrKey, recordKeyID, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.greaterThanTrialKey; bool greaterThanOrEqualToBestKnown = attrKeyCompare(record.attrKey, perhapsThisRecord.attrKey, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.lessThanTrialKey || attrKeyCompare(record.attrKey, perhapsThisRecord.attrKey, this.header.headerInfo.keyCompareType == 0xBC) == dataOperations.keyCompareResult.equalsTrialKey; if (equalsSearch) { return record.pointer; } else if (lessThanSearch && greaterThanOrEqualToBestKnown) { perhapsThisRecord = record; } } currentNodeNumber = perhapsThisRecord.pointer; currentNodeType = (absNode.nodeType)getNodeType(currentNodeNumber); } return currentNodeNumber; }