Beispiel #1
0
        public static Subnode GetSubnode(PSTFile file, SubnodeLeafEntry entry)
        {
            DataTree dataTree = null;

            if (entry.bidData.Value != 0)
            {
                Block rootDataBlock = file.FindBlockByBlockID(entry.bidData);
                if (rootDataBlock == null)
                {
                    throw new Exception("Cannot get subnode: missing data tree root block");
                }
                dataTree = new DataTree(file, rootDataBlock);
            }

            SubnodeBTree subnodeBTree = null;

            if (entry.bidSub.Value != 0)
            {
                Block rootSubnodeBlock = file.FindBlockByBlockID(entry.bidSub);
                if (rootSubnodeBlock == null)
                {
                    throw new Exception("Missing Subnode BTree Root Block");
                }
                subnodeBTree = new SubnodeBTree(file, rootSubnodeBlock);
            }
            return(new Subnode(file, entry.nid, dataTree, subnodeBTree));
        }
Beispiel #2
0
        public static PSTNode GetPSTNode(PSTFile file, NodeID nodeID)
        {
            NodeBTreeEntry entry = file.FindNodeEntryByNodeID(nodeID.Value);

            if (entry != null)
            {
                DataTree dataTree = null;
                if (entry.bidData.Value != 0)
                {
                    Block rootDataBlock = file.FindBlockByBlockID(entry.bidData);
                    dataTree = new DataTree(file, rootDataBlock);
                }

                SubnodeBTree subnodeBTree = null;
                if (entry.bidSub.Value != 0)
                {
                    Block rootSubnodeBlock = file.FindBlockByBlockID(entry.bidSub);
                    subnodeBTree = new SubnodeBTree(file, rootSubnodeBlock);
                }
                return(new PSTNode(file, nodeID, dataTree, subnodeBTree));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// Will get a block from the buffer,
 /// A cloned copy of the block will be returned
 /// </summary>
 protected Block GetBlock(ulong blockID)
 {
     if (m_blockBuffer.ContainsKey(blockID))
     {
         return(m_blockBuffer[blockID].Clone());
     }
     else
     {
         Block block = m_file.FindBlockByBlockID(blockID);
         m_blockBuffer.Add(blockID, block);
         return(block.Clone());
     }
 }