Example #1
0
        public TreeNode getDirectoryChildren(HFSPlusCatalogFolder folderRecord, catalogFile cf, extentsOverflowFile eof)
        {
            TreeNode returnDir = new TreeNode();

            // get every file and directory inside the current one
            returnDir = cf.getDirectoryAndChildren(folderRecord, eof, this.partitionNo);

            foreach (TreeNode child in returnDir.Nodes)
            {
                if (child.Tag is HFSPlusCatalogFolder)
                {
                    TreeNode tn      = cf.getDirectoryAndChildren((HFSPlusCatalogFolder)child.Tag, eof, this.partitionNo);
                    int      counter = 0;
                    foreach (TreeNode childNode in tn.Nodes)
                    {
                        if (childNode.Tag is HFSPlusCatalogFolder)
                        {
                            counter++;
                        }
                    }

                    if (counter > 0)
                    {
                        // if there are children, add a placeholder
                        child.Nodes.Add("");
                    }
                }
            }

            return(returnDir);
        }
Example #2
0
        public TreeNode getFullDirectoryList()
        {
            TreeNode result = new TreeNode();

            HFSPlusFile rawExtentsOverflow = new HFSPlusFile(volHead.extentsFile, forkStream.forkType.data);
            HFSPlusFile rawCatalog         = new HFSPlusFile(volHead.catalogFile, forkStream.forkType.data);
            HFSPlusFile rawAttributesFile  = new HFSPlusFile(volHead.attributesFile, forkStream.forkType.data);

            volumeStream        hfsp_vs = new volumeStream(this);
            catalogFile         cf      = new catalogFile(rawCatalog, hfsp_vs);
            extentsOverflowFile eof     = new extentsOverflowFile(rawExtentsOverflow, hfsp_vs);
            attributesFile      af      = new attributesFile(rawAttributesFile, hfsp_vs);

            addMetaFilesToTree(ref result);

            result = buildDirectoryTree(result, cf, eof, af);

            if (filecount == volHead.fileCount + 5)
            {
                volumeHeader vh = this.volHead;
                vh.fileCountVerified = true;
                this.volHead         = vh;
            }

            if (foldercount == volHead.folderCount)
            {
                volumeHeader vh = this.volHead;
                vh.folderCountVerified = true;
                this.volHead           = vh;
            }

            return(result);
        }
Example #3
0
        public TreeNode getFullDirectoryList(HFSPlusCatalogFolder folderRecord, catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            TreeNode returnDir = new TreeNode();

            returnDir.Tag  = folderRecord;
            returnDir.Text = System.Text.Encoding.BigEndianUnicode.GetString(folderRecord.key.nodeName);

            returnDir = getDirectoryChildren(folderRecord, cf, eof, af);

            returnDir = buildDirectoryTree(returnDir, cf, eof, af);

            return(returnDir);
        }
Example #4
0
        public TreeNode getDirectoryChildren(HFSPlusCatalogFolder folderRecord, catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            TreeNode returnDir = new TreeNode();

            // get every file and directory inside the current one
            returnDir = cf.getDirectoryAndChildren(folderRecord, eof, this.partitionNo);

            foreach (TreeNode child in returnDir.Nodes)
            {
                // check if there are any alternate data streams for the files
                if (child.Tag is HFSPlusCatalogFile)
                {
                    HFSPlusCatalogFile data = (HFSPlusCatalogFile)child.Tag;

                    attributesFile.HFSPlusAttrKey attrKey = new attributesFile.HFSPlusAttrKey();

                    attrKey.fileID     = data.fileID;
                    attrKey.startBlock = 0;
                    attributesLeafNode.attributesDataForFile allAttributes = af.getAttrFileDataWithKey(attrKey);

                    foreach (attributesLeafNode.HFSPlusAttrForkData fork in allAttributes.forks)
                    {
                        TreeNode attribute = new TreeNode();

                        attributesLeafNode.HFSPlusAttrForkData tag = fork;
                        tag.partitionAssoc = folderRecord.partitionAssoc;

                        attribute.Text = child.Text + " > " + System.Text.Encoding.BigEndianUnicode.GetString(fork.key.attrName);
                        attribute.Tag  = tag;

                        returnDir.Nodes.Add(attribute);
                    }
                    foreach (attributesLeafNode.HFSPlusAttrInlineData inline in allAttributes.inline)
                    {
                        TreeNode attribute = new TreeNode();

                        attributesLeafNode.HFSPlusAttrInlineData tag = inline;
                        tag.partitionAssoc = folderRecord.partitionAssoc;

                        attribute.Text = child.Text + " > " + System.Text.Encoding.BigEndianUnicode.GetString(inline.key.attrName);
                        attribute.Tag  = tag;
                        returnDir.Nodes.Add(attribute);
                    }
                }
            }

            return(returnDir);
        }
        public TreeNode getSubDirectories(TreeNode tn)
        {
            TreeNode  result = tn;
            GPTScheme gpts   = new GPTScheme(i);

            if (tn.Tag is HFSPlusCatalogFolder)
            {
                HFSPlusCatalogFolder folder = (HFSPlusCatalogFolder)tn.Tag;
                HFSPlus             hfsp    = new HFSPlus(i, gpts.getValidTable()[folder.partitionAssoc]);
                volumeStream        vs      = new volumeStream(hfsp);
                extentsOverflowFile eof     = new extentsOverflowFile(new HFSPlusFile(hfsp.volHead.extentsFile, forkStream.forkType.data), vs);
                catalogFile         cf      = new catalogFile(new HFSPlusFile(hfsp.volHead.catalogFile, forkStream.forkType.data), vs);

                result     = hfsp.getDirectoryChildren(folder, cf, eof);
                result.Tag = tn.Tag;
            }
            return(result);
        }
Example #6
0
        public TreeNode getRootDirectoryContents(catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            HFSPlusCatalogFolder rootFolderParentRecord = new HFSPlusCatalogFolder();

            rootFolderParentRecord.folderID       = 1;
            rootFolderParentRecord.partitionAssoc = this.partitionNo;

            TreeNode rootDirParent = getDirectoryChildren(rootFolderParentRecord, cf, eof);

            HFSPlusCatalogFolder rootFolderRecord = new HFSPlusCatalogFolder();

            rootFolderRecord      = (HFSPlusCatalogFolder)rootDirParent.Nodes[0].Tag;
            rootFolderRecord.path = this.volHead.path;

            TreeNode rootDir = getDirectoryChildren(rootFolderRecord, cf, eof, af);

            addMetaFilesToTree(ref rootDir);

            foreach (TreeNode child in rootDir.Nodes)
            {
                if (child.Tag is HFSPlusCatalogFolder)
                {
                    TreeNode tn      = getDirectoryChildren((HFSPlusCatalogFolder)child.Tag, cf, eof);
                    int      counter = 0;
                    foreach (TreeNode childNode in tn.Nodes)
                    {
                        if (childNode.Tag is HFSPlusCatalogFolder)
                        {
                            counter++;
                        }
                    }

                    if (counter > 0)
                    {
                        // if there are children, add a placeholder
                        child.Nodes.Add("");
                    }
                }
            }

            return(rootDir);
        }
        private TreeNode getHFSPTree(HFSPlus hfsp, HFSPlusCatalogFolder folderID)
        {
            TreeNode     tn      = new TreeNode();
            volumeStream hfsp_vs = new volumeStream(hfsp);

            HFSPlusFile rawCatalog         = new HFSPlusFile(hfsp.volHead.catalogFile, forkStream.forkType.data);
            HFSPlusFile rawAttributes      = new HFSPlusFile(hfsp.volHead.attributesFile, forkStream.forkType.data);
            HFSPlusFile rawExtentsOverflow = new HFSPlusFile(hfsp.volHead.extentsFile, forkStream.forkType.data);
            // need to get all attributes files

            HFSPlusCatalogFolder folderRecord = folderID;

            catalogFile         catalog    = new catalogFile(rawCatalog, hfsp_vs);
            attributesFile      attributes = new attributesFile(rawAttributes, hfsp_vs);
            extentsOverflowFile eof        = new extentsOverflowFile(rawExtentsOverflow, hfsp_vs);

            displayTree = hfsp.getFullDirectoryList(folderRecord, catalog, eof, attributes);

            tn = displayTree;

            return(tn);
        }
        private TreeNode getVolumeTree(GPTScheme.entry partition, GPTScheme.partitionType type)
        {
            TreeNode tn = new TreeNode();

            if (type == GPTScheme.partitionType.HFSPlus)
            {
                HFSPlus      hfsp    = new HFSPlus(i, partition);
                volumeStream hfsp_vs = new volumeStream(hfsp);

                HFSPlusFile rawCatalog    = new HFSPlusFile(hfsp.volHead.catalogFile, forkStream.forkType.data);
                HFSPlusFile rawAttributes = new HFSPlusFile(hfsp.volHead.attributesFile, forkStream.forkType.data);
                HFSPlusFile rawExtents    = new HFSPlusFile(hfsp.volHead.extentsFile, forkStream.forkType.data);

                extentsOverflowFile extentsOverflow = new extentsOverflowFile(rawExtents, hfsp_vs);
                catalogFile         catalog         = new catalogFile(rawCatalog, hfsp_vs);
                attributesFile      attributes      = new attributesFile(rawAttributes, hfsp_vs);

                tn     = hfsp.getRootDirectoryContents(catalog, extentsOverflow, attributes);
                tn.Tag = hfsp.volHead;
            }

            return(tn);
        }
Example #9
0
        private TreeNode buildDirectoryTree(TreeNode parent, catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            TreeNode replaceParent = new TreeNode();

            replaceParent.Tag  = parent.Tag;
            replaceParent.Text = parent.Text;

            foreach (TreeNode childItem in parent.Nodes)
            {
                if (childItem.Tag is HFSPlusCatalogFolder)
                {
                    HFSPlusCatalogFolder childDirectoryRecord = (HFSPlusCatalogFolder)childItem.Tag;

                    TreeNode contents = getDirectoryChildren(childDirectoryRecord, cf, eof, af);

                    contents = buildDirectoryTree(contents, cf, eof, af);

                    replaceParent.Nodes.Add(contents);
                    foldercount++;
                }
                else if (childItem.Tag is HFSPlusCatalogFile)
                {
                    replaceParent.Nodes.Add(childItem);
                    filecount++;
                }
                else if (childItem.Tag is attributesLeafNode.HFSPlusAttrInlineData)
                {
                    replaceParent.Nodes.Add(childItem);
                }
                else if (childItem.Tag is attributesLeafNode.HFSPlusAttrForkData)
                {
                    replaceParent.Nodes.Add(childItem);
                }
            }

            return(replaceParent);
        }
Example #10
0
        public TreeNode getFullDirectoryList()
        {
            TreeNode result = new TreeNode();

            HFSPlusFile rawExtentsOverflow = new HFSPlusFile(volHead.extentsFile, forkStream.forkType.data);
            HFSPlusFile rawCatalog = new HFSPlusFile(volHead.catalogFile, forkStream.forkType.data);
            HFSPlusFile rawAttributesFile = new HFSPlusFile(volHead.attributesFile, forkStream.forkType.data);

            volumeStream hfsp_vs = new volumeStream(this);
            catalogFile cf = new catalogFile(rawCatalog, hfsp_vs);
            extentsOverflowFile eof = new extentsOverflowFile(rawExtentsOverflow, hfsp_vs);
            attributesFile af = new attributesFile(rawAttributesFile, hfsp_vs);

            addMetaFilesToTree(ref result);

            result = buildDirectoryTree(result, cf, eof, af);

            if (filecount == volHead.fileCount + 5)
            {
                volumeHeader vh = this.volHead;
                vh.fileCountVerified = true;
                this.volHead = vh;
            }

            if (foldercount == volHead.folderCount)
            {
                volumeHeader vh = this.volHead;
                vh.folderCountVerified = true;
                this.volHead = vh;
            }

            return result;
        }
Example #11
0
        public TreeNode getDirectoryChildren(HFSPlusCatalogFolder folderRecord, catalogFile cf, extentsOverflowFile eof)
        {
            TreeNode returnDir = new TreeNode();

            // get every file and directory inside the current one
            returnDir = cf.getDirectoryAndChildren(folderRecord, eof, this.partitionNo);

            foreach (TreeNode child in returnDir.Nodes)
            {
                if (child.Tag is HFSPlusCatalogFolder)
                {
                    TreeNode tn = cf.getDirectoryAndChildren((HFSPlusCatalogFolder)child.Tag, eof, this.partitionNo);
                    int counter = 0;
                    foreach (TreeNode childNode in tn.Nodes)
                    {
                        if (childNode.Tag is HFSPlusCatalogFolder)
                        {
                            counter++;
                        }
                    }

                    if (counter > 0)
                    {
                        // if there are children, add a placeholder
                        child.Nodes.Add("");
                    }
                }
            }

            return returnDir;
        }
Example #12
0
        public TreeNode getRootDirectoryContents(catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            HFSPlusCatalogFolder rootFolderParentRecord = new HFSPlusCatalogFolder();

            rootFolderParentRecord.folderID = 1;
            rootFolderParentRecord.partitionAssoc = this.partitionNo;

            TreeNode rootDirParent = getDirectoryChildren(rootFolderParentRecord, cf, eof);

            HFSPlusCatalogFolder rootFolderRecord = new HFSPlusCatalogFolder();
            rootFolderRecord = (HFSPlusCatalogFolder)rootDirParent.Nodes[0].Tag;
            rootFolderRecord.path = this.volHead.path;

            TreeNode rootDir = getDirectoryChildren(rootFolderRecord, cf, eof, af);

            addMetaFilesToTree(ref rootDir);

            foreach (TreeNode child in rootDir.Nodes)
            {
                if (child.Tag is HFSPlusCatalogFolder)
                {
                    TreeNode tn = getDirectoryChildren((HFSPlusCatalogFolder)child.Tag, cf, eof);
                    int counter = 0;
                    foreach(TreeNode childNode in tn.Nodes)
                    {
                        if (childNode.Tag is HFSPlusCatalogFolder)
                        {
                            counter++;
                        }
                    }

                    if (counter > 0)
                    {
                        // if there are children, add a placeholder
                        child.Nodes.Add("");
                    }
                }
            }

            return rootDir;
        }
Example #13
0
        public TreeNode getFullDirectoryList(HFSPlusCatalogFolder folderRecord, catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            TreeNode returnDir = new TreeNode();
            returnDir.Tag = folderRecord;
            returnDir.Text = System.Text.Encoding.BigEndianUnicode.GetString(folderRecord.key.nodeName);

            returnDir = getDirectoryChildren(folderRecord, cf, eof, af);

            returnDir = buildDirectoryTree(returnDir, cf, eof, af);

            return returnDir;
        }
Example #14
0
        private TreeNode buildDirectoryTree(TreeNode parent, catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            TreeNode replaceParent = new TreeNode();

            replaceParent.Tag = parent.Tag;
            replaceParent.Text = parent.Text;

            foreach (TreeNode childItem in parent.Nodes)
            {
                if(childItem.Tag is HFSPlusCatalogFolder)
                {
                    HFSPlusCatalogFolder childDirectoryRecord = (HFSPlusCatalogFolder)childItem.Tag;

                    TreeNode contents = getDirectoryChildren(childDirectoryRecord, cf, eof, af);

                    contents = buildDirectoryTree(contents, cf, eof, af);

                    replaceParent.Nodes.Add(contents);
                    foldercount++;
                }
                else if (childItem.Tag is HFSPlusCatalogFile)
                {
                    replaceParent.Nodes.Add(childItem);
                    filecount++;
                }
                else if (childItem.Tag is attributesLeafNode.HFSPlusAttrInlineData)
                {
                    replaceParent.Nodes.Add(childItem);
                }
                else if (childItem.Tag is attributesLeafNode.HFSPlusAttrForkData)
                {
                    replaceParent.Nodes.Add(childItem);
                }
            }

            return replaceParent;
        }
        public TreeNode getSubDirectories(TreeNode tn)
        {
            TreeNode result = tn;
            GPTScheme gpts = new GPTScheme(i);

            if (tn.Tag is HFSPlusCatalogFolder)
            {
                HFSPlusCatalogFolder folder = (HFSPlusCatalogFolder)tn.Tag;
                HFSPlus hfsp = new HFSPlus(i, gpts.getValidTable()[folder.partitionAssoc]);
                volumeStream vs = new volumeStream(hfsp);
                extentsOverflowFile eof = new extentsOverflowFile(new HFSPlusFile(hfsp.volHead.extentsFile, forkStream.forkType.data), vs);
                catalogFile cf = new catalogFile(new HFSPlusFile(hfsp.volHead.catalogFile, forkStream.forkType.data), vs);

                result = hfsp.getDirectoryChildren(folder, cf, eof);
                result.Tag = tn.Tag;
            }
            return result;
        }
        private TreeNode getHFSPTree(HFSPlus hfsp, HFSPlusCatalogFolder folderID)
        {
            TreeNode tn = new TreeNode();
            volumeStream hfsp_vs = new volumeStream(hfsp);

            HFSPlusFile rawCatalog = new HFSPlusFile(hfsp.volHead.catalogFile, forkStream.forkType.data);
            HFSPlusFile rawAttributes = new HFSPlusFile(hfsp.volHead.attributesFile, forkStream.forkType.data);
            HFSPlusFile rawExtentsOverflow = new HFSPlusFile(hfsp.volHead.extentsFile, forkStream.forkType.data);
            // need to get all attributes files

            HFSPlusCatalogFolder folderRecord = folderID;

            catalogFile catalog = new catalogFile(rawCatalog, hfsp_vs);
            attributesFile attributes = new attributesFile(rawAttributes, hfsp_vs);
            extentsOverflowFile eof = new extentsOverflowFile(rawExtentsOverflow, hfsp_vs);
            displayTree = hfsp.getFullDirectoryList(folderRecord, catalog, eof, attributes);

            tn = displayTree;

            return tn;
        }
        private TreeNode getVolumeTree(GPTScheme.entry partition, GPTScheme.partitionType type)
        {
            TreeNode tn = new TreeNode();

            if (type == GPTScheme.partitionType.HFSPlus)
            {
                HFSPlus hfsp = new HFSPlus(i, partition);
                volumeStream hfsp_vs = new volumeStream(hfsp);

                HFSPlusFile rawCatalog = new HFSPlusFile(hfsp.volHead.catalogFile, forkStream.forkType.data);
                HFSPlusFile rawAttributes = new HFSPlusFile(hfsp.volHead.attributesFile, forkStream.forkType.data);
                HFSPlusFile rawExtents = new HFSPlusFile(hfsp.volHead.extentsFile, forkStream.forkType.data);

                extentsOverflowFile extentsOverflow = new extentsOverflowFile(rawExtents, hfsp_vs);
                catalogFile catalog = new catalogFile(rawCatalog, hfsp_vs);
                attributesFile attributes = new attributesFile(rawAttributes, hfsp_vs);

                tn = hfsp.getRootDirectoryContents(catalog, extentsOverflow, attributes);
                tn.Tag = hfsp.volHead;
            }

            return tn;
        }
Example #18
0
        public TreeNode getDirectoryChildren(HFSPlusCatalogFolder folderRecord, catalogFile cf, extentsOverflowFile eof, attributesFile af)
        {
            TreeNode returnDir = new TreeNode();

            // get every file and directory inside the current one
            returnDir = cf.getDirectoryAndChildren(folderRecord, eof, this.partitionNo);

            foreach (TreeNode child in returnDir.Nodes)
            {
                // check if there are any alternate data streams for the files
                if (child.Tag is HFSPlusCatalogFile)
                {
                    HFSPlusCatalogFile data = (HFSPlusCatalogFile)child.Tag;

                    attributesFile.HFSPlusAttrKey attrKey = new attributesFile.HFSPlusAttrKey();

                    attrKey.fileID = data.fileID;
                    attrKey.startBlock = 0;
                    attributesLeafNode.attributesDataForFile allAttributes = af.getAttrFileDataWithKey(attrKey);

                    foreach (attributesLeafNode.HFSPlusAttrForkData fork in allAttributes.forks)
                    {
                        TreeNode attribute = new TreeNode();

                        attributesLeafNode.HFSPlusAttrForkData tag = fork;
                        tag.partitionAssoc = folderRecord.partitionAssoc;

                        attribute.Text = child.Text + " > " + System.Text.Encoding.BigEndianUnicode.GetString(fork.key.attrName);
                        attribute.Tag = tag;

                        returnDir.Nodes.Add(attribute);
                    }
                    foreach (attributesLeafNode.HFSPlusAttrInlineData inline in allAttributes.inline)
                    {
                        TreeNode attribute = new TreeNode();

                        attributesLeafNode.HFSPlusAttrInlineData tag = inline;
                        tag.partitionAssoc = folderRecord.partitionAssoc;

                        attribute.Text = child.Text + " > " + System.Text.Encoding.BigEndianUnicode.GetString(inline.key.attrName);
                        attribute.Tag = tag;
                        returnDir.Nodes.Add(attribute);
                    }
                }
            }

            return returnDir;
        }