Пример #1
0
        public Subnode GetSubnode(uint subnodeID)
        {
            SubnodeLeafEntry entry = GetLeafEntry(subnodeID);

            if (entry != null)
            {
                Subnode result = Subnode.GetSubnode(this.File, entry);
                return(result);
            }
            return(null);
        }
Пример #2
0
        public int GetDataLengthOfAllSubnodes()
        {
            List <SubnodeLeafBlock> leaves = GetLeafBlocks();
            int result = 0;

            foreach (SubnodeLeafBlock leaf in leaves)
            {
                foreach (SubnodeLeafEntry entry in leaf.rgentries)
                {
                    Subnode subnode = Subnode.GetSubnode(this.File, entry);
                    result += subnode.DataTree.TotalDataLength;
                    if (subnode.SubnodeBTree != null)
                    {
                        result += subnode.SubnodeBTree.GetDataLengthOfAllSubnodes();
                    }
                }
            }
            return(result);
        }
Пример #3
0
        public void Delete()
        {
            List <SubnodeLeafBlock> leaves = GetLeafBlocks();

            foreach (SubnodeLeafBlock leaf in leaves)
            {
                foreach (SubnodeLeafEntry entry in leaf.rgentries)
                {
                    Subnode subnode = Subnode.GetSubnode(this.File, entry);
                    subnode.Delete();
                }
                DeleteBlock(leaf);
            }

            // we could have already deleted our root block (if it's a leaf)
            if (m_rootBlock is SubnodeIntermediateBlock)
            {
                DeleteBlock(m_rootBlock);
            }
            m_rootBlock = null;

            SaveChanges();
        }