Exemple #1
0
        public int CompareTo(object obj)
        {
            if (obj is NintendoGameCubeDirectoryStructure)
            {
                NintendoGameCubeDirectoryStructure o = (NintendoGameCubeDirectoryStructure)obj;

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

            throw new ArgumentException("object is not an NintendoGameCubeDirectoryStructure");
        }
Exemple #2
0
        public void LoadDirectories(FileStream isoStream)
        {
            byte[] rootDirectoryBytes;
            NintendoGameCubeDirectoryRecord    rootDirectoryRecord;
            NintendoGameCubeDirectoryStructure rootDirectory;

            // Get name table offset
            rootDirectoryBytes   = ParseFile.ParseSimpleOffset(isoStream, this.RootDirectoryOffset, 0xC);
            rootDirectoryRecord  = new NintendoGameCubeDirectoryRecord(rootDirectoryBytes, this.OffsetBitShiftValue);
            this.NameTableOffset = this.RootDirectoryOffset + ((long)rootDirectoryRecord.FileSize * 0xC);

            rootDirectory = new NintendoGameCubeDirectoryStructure(isoStream,
                                                                   isoStream.Name, rootDirectoryRecord, this.ImageCreationTime,
                                                                   this.VolumeBaseOffset, this.RootDirectoryOffset,
                                                                   this.RootDirectoryOffset, this.NameTableOffset,
                                                                   String.Empty, String.Empty, this.OffsetBitShiftValue);

            this.DirectoryStructureArray.Add(rootDirectory);
        }
Exemple #3
0
        private void parseDirectoryRecord(
            FileStream isoStream,
            NintendoGameCubeDirectoryRecord directoryRecord,
            DateTime creationDateTime,
            long baseOffset,
            long rootDirectoryOffset,
            long directoryOffset,
            long nameTableOffset,
            string parentDirectory,
            int offsetBitShiftValue)
        {
            long directoryRecordEndOffset;
            long newDirectoryEndOffset;
            long currentOffset = baseOffset + directoryOffset;

            int itemNameSize;

            byte[] itemNameBytes;
            string itemName;

            NintendoGameCubeDirectoryRecord    newDirectoryRecord;
            NintendoGameCubeDirectoryStructure newDirectory;
            NintendoGameCubeFileStructure      newFile;

            directoryRecordEndOffset = rootDirectoryOffset + (directoryRecord.FileSize * 0xC);
            currentOffset           += 0xC;

            while (currentOffset < directoryRecordEndOffset)
            {
                newDirectoryRecord = new NintendoGameCubeDirectoryRecord(ParseFile.ParseSimpleOffset(isoStream, currentOffset, 0xC), offsetBitShiftValue);

                itemNameSize  = ParseFile.GetSegmentLength(isoStream, (int)(nameTableOffset + newDirectoryRecord.NameOffset), Constants.NullByteArray);
                itemNameBytes = ParseFile.ParseSimpleOffset(isoStream, nameTableOffset + newDirectoryRecord.NameOffset, itemNameSize);
                itemName      = ByteConversion.GetEncodedText(itemNameBytes, ByteConversion.GetPredictedCodePageForTags(itemNameBytes));

                if (!newDirectoryRecord.IsDirectory)
                {
                    newFile = new NintendoGameCubeFileStructure(parentDirectory,
                                                                this.SourceFilePath, itemName,
                                                                baseOffset, newDirectoryRecord.FileOffset,
                                                                newDirectoryRecord.FileSize, creationDateTime);

                    this.FileArray.Add(newFile);
                    currentOffset += 0xC;
                }
                else
                {
                    newDirectory =
                        new NintendoGameCubeDirectoryStructure(isoStream,
                                                               isoStream.Name, newDirectoryRecord,
                                                               creationDateTime, baseOffset, rootDirectoryOffset,
                                                               currentOffset, nameTableOffset,
                                                               itemName, parentDirectory, offsetBitShiftValue);

                    this.SubDirectoryArray.Add(newDirectory);

                    newDirectoryEndOffset = rootDirectoryOffset + (newDirectoryRecord.FileSize * 0xC);
                    currentOffset         = newDirectoryEndOffset;
                }
            }
        }