예제 #1
0
        private void setFileTreeFromImage(absImageStream i)
        {
            TreeNode partitionTN = new TreeNode();

            fileTree = null;
            fileTree = new TreeNode();

            switch (i.scheme)
            {
            case absImageStream.schemeType.GPT:
                GPTScheme ps = new GPTScheme(i);

                foreach (GPTScheme.entry partition in ps.getValidTable())
                {
                    GPTScheme.partitionType type = ps.findPartitionType(partition);

                    partitionTN      = getVolumeTree(partition, type);
                    partitionTN.Text = partition.name;
                    fileTree.Nodes.Add(partitionTN);
                }
                break;

            default:
                break;
            }
        }
예제 #2
0
        public void generateListViewContent(TreeNode startDirectory)
        {
            TreeNode partitionTN = new TreeNode();

            if (startDirectory.Tag is absImageStream.imageProperties)
            {
                switch (i.scheme)
                {
                case absImageStream.schemeType.GPT:
                    GPTScheme ps = new GPTScheme(i);

                    foreach (GPTScheme.entry partition in ps.getValidTable())
                    {
                        GPTScheme.partitionType type = ps.findPartitionType(partition);

                        partitionTN      = getVolumeTree(partition, type);
                        partitionTN.Text = partition.name;
                    }
                    break;

                default:
                    break;
                }
            }
            else if (startDirectory.Tag is HFSPlusCatalogFolder)
            {
                HFSPlusCatalogFolder tag = (HFSPlusCatalogFolder)startDirectory.Tag;
                switch (i.scheme)
                {
                case absImageStream.schemeType.GPT:
                    GPTScheme ps = new GPTScheme(i);

                    // if used, the following line causes the program to display only the direct children of the selected directory
                    partitionTN = getSubDirectories(startDirectory);

                    // if used, the following line will cause the program to display the entire contents of a directory tree branch recursively
                    // partitionTN = getVolumeTree(ps.getValidTable()[tag.partitionAssoc], GPTScheme.partitionType.HFSPlus, tag);
                    partitionTN.Text = startDirectory.Text;

                    break;

                default:
                    break;
                }
            }
            else if (startDirectory.Tag is HFSPlus.volumeHeader)
            {
                HFSPlus.volumeHeader tag = (HFSPlus.volumeHeader)startDirectory.Tag;
                switch (i.scheme)
                {
                case absImageStream.schemeType.GPT:
                    GPTScheme ps = new GPTScheme(i);


                    partitionTN      = getVolumeTree(ps.getValidTable()[tag.partitionNo], GPTScheme.partitionType.HFSPlus);
                    partitionTN.Text = startDirectory.Text;

                    break;

                default:
                    break;
                }
            }

            if (startDirectory.Tag != null)
            {
                addRowsToList(partitionTN);
            }
        }
예제 #3
0
        public imageMap(absImageStream ais)
        {
            if (ais.scheme == absImageStream.schemeType.GPT)
            {
                GPTScheme gpts = new GPTScheme(ais);

                mapBlock block = new mapBlock();
                block.location = 0;

                if (gpts.protectiveMBRExists)
                {
                    block.length = 1;
                    block.name = "MBR";
                    block.type = tileType.MBR;

                    partitionblocks.Add(block);
                }

                if (gpts.headerFound)
                {
                    block.location = 1;
                    block.length = 1;
                    block.name = "GPT Header";
                    block.type = tileType.GPT;

                    partitionblocks.Add(block);

                    block.location = gpts.tablestart;
                    block.length = gpts.tablelength / ais.sectorSize;
                    if (block.length < 1) block.length = 1;
                    block.name = "GPT Primary Table";
                    block.type = tileType.GPT;

                    partitionblocks.Add(block);
                }

                if (gpts.backupFound)
                {
                    block.location = gpts.backupHeader.mainheader;
                    block.length = 1;
                    block.name = "Backup GPT Header";
                    block.type = tileType.GPT;

                    partitionblocks.Add(block);

                    block.location = gpts.backupHeader.tablestart;
                    block.length = gpts.tablelength / ais.sectorSize;
                    if (block.length < 1) block.length = 1;
                    block.name = "GPT Backup Table";
                    block.type = tileType.GPT;

                    partitionblocks.Add(block);
                }

                foreach (GPTScheme.entry entry in gpts.entries)
                {
                    block.location = entry.partStartLBA;
                    block.length = entry.partLength;
                    block.name = entry.name;
                    block.type = tileType.vol_unknown;

                    if (gpts.findPartitionType(entry) == GPTScheme.partitionType.HFSPlus)
                    {
                        HFSPlus hfsp = new HFSPlus(ais, entry);

                        block.mapSectorsPerBlock = (int)hfsp.volHead.blockSize / ais.sectorSize;
                        forkStream fs = new forkStream(new volumeStream(hfsp), new HFSPlusFile(hfsp.volHead.allocationFile, forkStream.forkType.data), forkStream.forkType.data);

                        block.allocationMap = new byte[(int)fs.Length];
                        fs.Read(block.allocationMap, 0, (int)fs.Length);
                    }
                    else
                    {
                        block.allocationMap = null;
                    }

                    partitionblocks.Add(block);
                }

            }

            partitionblocks.Sort(CompareBlocksByPosition);
        }
예제 #4
0
        private void setFileTreeFromImage(absImageStream i)
        {
            TreeNode partitionTN = new TreeNode();

            fileTree = null;
            fileTree = new TreeNode();

            switch (i.scheme)
            {
                case absImageStream.schemeType.GPT:
                    GPTScheme ps = new GPTScheme(i);

                    foreach (GPTScheme.entry partition in ps.getValidTable())
                    {
                        GPTScheme.partitionType type = ps.findPartitionType(partition);

                        partitionTN = getVolumeTree(partition, type);
                        partitionTN.Text = partition.name;
                        fileTree.Nodes.Add(partitionTN);
                    }
                    break;
                default:
                    break;
            }
        }
예제 #5
0
        public void generateListViewContent(TreeNode startDirectory)
        {
            TreeNode partitionTN = new TreeNode();

            if (startDirectory.Tag is absImageStream.imageProperties)
            {
                switch (i.scheme)
                {
                    case absImageStream.schemeType.GPT:
                        GPTScheme ps = new GPTScheme(i);

                        foreach (GPTScheme.entry partition in ps.getValidTable())
                        {
                            GPTScheme.partitionType type = ps.findPartitionType(partition);

                            partitionTN = getVolumeTree(partition, type);
                            partitionTN.Text = partition.name;
                        }
                        break;
                    default:
                        break;
                }
            }
            else if (startDirectory.Tag is HFSPlusCatalogFolder)
            {
                HFSPlusCatalogFolder tag = (HFSPlusCatalogFolder)startDirectory.Tag;
                switch (i.scheme)
                {
                    case absImageStream.schemeType.GPT:
                        GPTScheme ps = new GPTScheme(i);

                        // if used, the following line causes the program to display only the direct children of the selected directory
                        partitionTN = getSubDirectories(startDirectory);

                        // if used, the following line will cause the program to display the entire contents of a directory tree branch recursively
                        // partitionTN = getVolumeTree(ps.getValidTable()[tag.partitionAssoc], GPTScheme.partitionType.HFSPlus, tag);
                        partitionTN.Text = startDirectory.Text;

                        break;
                    default:
                        break;
                }
            }
            else if (startDirectory.Tag is HFSPlus.volumeHeader)
            {
                HFSPlus.volumeHeader tag = (HFSPlus.volumeHeader) startDirectory.Tag;
                switch (i.scheme)
                {
                    case absImageStream.schemeType.GPT:
                        GPTScheme ps = new GPTScheme(i);

                        partitionTN = getVolumeTree(ps.getValidTable()[tag.partitionNo], GPTScheme.partitionType.HFSPlus);
                        partitionTN.Text = startDirectory.Text;

                        break;
                    default:
                        break;
                }
            }

            if (startDirectory.Tag != null)
            {
                addRowsToList(partitionTN);
            }
        }
예제 #6
0
        public imageMap(absImageStream ais)
        {
            if (ais.scheme == absImageStream.schemeType.GPT)
            {
                GPTScheme gpts = new GPTScheme(ais);

                mapBlock block = new mapBlock();
                block.location = 0;

                if (gpts.protectiveMBRExists)
                {
                    block.length = 1;
                    block.name   = "MBR";
                    block.type   = tileType.MBR;

                    partitionblocks.Add(block);
                }

                if (gpts.headerFound)
                {
                    block.location = 1;
                    block.length   = 1;
                    block.name     = "GPT Header";
                    block.type     = tileType.GPT;

                    partitionblocks.Add(block);

                    block.location = gpts.tablestart;
                    block.length   = gpts.tablelength / ais.sectorSize;
                    if (block.length < 1)
                    {
                        block.length = 1;
                    }
                    block.name = "GPT Primary Table";
                    block.type = tileType.GPT;

                    partitionblocks.Add(block);
                }

                if (gpts.backupFound)
                {
                    block.location = gpts.backupHeader.mainheader;
                    block.length   = 1;
                    block.name     = "Backup GPT Header";
                    block.type     = tileType.GPT;

                    partitionblocks.Add(block);

                    block.location = gpts.backupHeader.tablestart;
                    block.length   = gpts.tablelength / ais.sectorSize;
                    if (block.length < 1)
                    {
                        block.length = 1;
                    }
                    block.name = "GPT Backup Table";
                    block.type = tileType.GPT;

                    partitionblocks.Add(block);
                }

                foreach (GPTScheme.entry entry in gpts.entries)
                {
                    block.location = entry.partStartLBA;
                    block.length   = entry.partLength;
                    block.name     = entry.name;
                    block.type     = tileType.vol_unknown;

                    if (gpts.findPartitionType(entry) == GPTScheme.partitionType.HFSPlus)
                    {
                        HFSPlus hfsp = new HFSPlus(ais, entry);

                        block.mapSectorsPerBlock = (int)hfsp.volHead.blockSize / ais.sectorSize;
                        forkStream fs = new forkStream(new volumeStream(hfsp), new HFSPlusFile(hfsp.volHead.allocationFile, forkStream.forkType.data), forkStream.forkType.data);

                        block.allocationMap = new byte[(int)fs.Length];
                        fs.Read(block.allocationMap, 0, (int)fs.Length);
                    }
                    else
                    {
                        block.allocationMap = null;
                    }

                    partitionblocks.Add(block);
                }
            }

            partitionblocks.Sort(CompareBlocksByPosition);
        }