Ejemplo n.º 1
0
        public int CompareTo(object obj)
        {
            if (obj is Panasonic3doFileStructure)
            {
                Panasonic3doFileStructure o = (Panasonic3doFileStructure)obj;

                return(this.FileName.CompareTo(o.FileName));
            }

            throw new ArgumentException("object is not an Panasonic3doFileStructure");
        }
Ejemplo n.º 2
0
        private void parseDirectoryRecord(
            FileStream isoStream,
            DateTime creationDateTime,
            long baseOffset,
            long directoryLba,
            uint logicalBlockSize,
            string parentDirectory,
            bool isRaw,
            int nonRawSectorSize)
        {
            uint recordSize;

            byte[] directorySector;
            byte[] directoryRecordBytes;
            uint   directoryRecordLength;
            uint   bytesRead;
            uint   currentOffset;
            long   currentLba = directoryLba;

            Panasonic3doDirectoryRecord    tempDirectoryRecord;
            Panasonic3doDirectoryStructure tempDirectory;
            Panasonic3doFileStructure      tempFile;

            // get the first sector
            directorySector       = CdRom.GetSectorByLba(isoStream, baseOffset, currentLba, isRaw, nonRawSectorSize);
            directorySector       = CdRom.GetDataChunkFromSector(directorySector, isRaw);
            directoryRecordLength = ByteConversion.GetUInt32BigEndian(ParseFile.ParseSimpleOffset(directorySector, 0xC, 4));

            bytesRead     = 0x14;
            currentOffset = 0x14;

            while (bytesRead < directoryRecordLength)
            {
                recordSize           = 0x48 + (4 * ByteConversion.GetUInt32BigEndian(ParseFile.ParseSimpleOffset(directorySector, (int)(currentOffset + 0x40), 4)));
                directoryRecordBytes = ParseFile.ParseSimpleOffset(directorySector, (int)currentOffset, (int)recordSize);
                tempDirectoryRecord  = new Panasonic3doDirectoryRecord(directoryRecordBytes);

                if (tempDirectoryRecord.DirectoryItemTypeBytes[3] == 0x07)
                {
                    //for (uint i = 0; i < tempDirectoryRecord.SubDirectoryCount; i++)
                    //{
                    tempDirectory =
                        new Panasonic3doDirectoryStructure(isoStream, isoStream.Name,
                                                           creationDateTime, baseOffset, tempDirectoryRecord.SubDirectoryLbas[0],
                                                           logicalBlockSize, tempDirectoryRecord.DirectoryItemName,
                                                           parentDirectory, isRaw, nonRawSectorSize);
                    this.SubDirectoryArray.Add(tempDirectory);
                    //}
                }
                else
                {
                    tempFile = new Panasonic3doFileStructure(parentDirectory,
                                                             this.SourceFilePath, tempDirectoryRecord.DirectoryItemName,
                                                             baseOffset, tempDirectoryRecord.SubDirectoryLbas[0],
                                                             tempDirectoryRecord.DirectoryItemSize, isRaw, nonRawSectorSize,
                                                             creationDateTime);

                    this.FileArray.Add(tempFile);
                }

                if (tempDirectoryRecord.DirectoryItemTypeBytes[0] == 0xC0)
                {
                    break;
                }
                else if (tempDirectoryRecord.DirectoryItemTypeBytes[0] == 0x40)
                {
                    directorySector       = CdRom.GetSectorByLba(isoStream, baseOffset, ++currentLba, isRaw, nonRawSectorSize);
                    directorySector       = CdRom.GetDataChunkFromSector(directorySector, isRaw);
                    directoryRecordLength = ByteConversion.GetUInt32BigEndian(ParseFile.ParseSimpleOffset(directorySector, 0xC, 4));

                    bytesRead     = 0x14;
                    currentOffset = 0x14;
                }
                else
                {
                    bytesRead     += recordSize;
                    currentOffset += recordSize;
                }
            }
        }