public int CompareTo(object obj) { if (obj is NintendoWiiOpticalDiscDirectoryStructure) { NintendoWiiOpticalDiscDirectoryStructure o = (NintendoWiiOpticalDiscDirectoryStructure)obj; return(this.DirectoryName.CompareTo(o.DirectoryName)); } throw new ArgumentException("object is not an NintendoWiiOpticalDiscDirectoryStructure"); }
public void LoadDirectories(FileStream isoStream) { byte[] rootDirectoryBytes; NintendoWiiOpticalDiscDirectoryRecord rootDirectoryRecord; NintendoWiiOpticalDiscDirectoryStructure rootDirectory; // Get name table offset rootDirectoryBytes = DiscReader.GetBytes(isoStream, this.VolumeBaseOffset, this.DataOffset, this.RootDirectoryOffset, 0xC, this.PartitionKey); rootDirectoryRecord = new NintendoWiiOpticalDiscDirectoryRecord(rootDirectoryBytes); this.NameTableOffset = this.RootDirectoryOffset + ((long)rootDirectoryRecord.FileSize * 0xC); rootDirectory = new NintendoWiiOpticalDiscDirectoryStructure(isoStream, isoStream.Name, rootDirectoryRecord, this.ImageCreationTime, this.VolumeBaseOffset, this.DataOffset, this.RootDirectoryOffset, this.RootDirectoryOffset, this.NameTableOffset, String.Empty, String.Empty, this.DiscReader, this.PartitionKey); this.DirectoryStructureArray.Add(rootDirectory); }
private void parseDirectoryRecord( FileStream isoStream, NintendoWiiOpticalDiscDirectoryRecord directoryRecord, DateTime creationDateTime, long baseOffset, long dataSectionOffset, long rootDirectoryOffset, long directoryOffset, long nameTableOffset, string parentDirectory, NintendoWiiEncryptedDiscReader discReader, byte[] partitionKey) { long directoryRecordEndOffset; long newDirectoryEndOffset; long currentOffset = directoryOffset; int itemNameSize; byte[] itemNameBytes; string itemName; byte[] newDirectoryRecordBytes; NintendoWiiOpticalDiscDirectoryRecord newDirectoryRecord; NintendoWiiOpticalDiscDirectoryStructure newDirectory; NintendoWiiOpticalDiscFileStructure newFile; directoryRecordEndOffset = rootDirectoryOffset + (directoryRecord.FileSize * 0xC); currentOffset += 0xC; while (currentOffset < directoryRecordEndOffset) { newDirectoryRecordBytes = discReader.GetBytes(isoStream, baseOffset, dataSectionOffset, currentOffset, 0xC, partitionKey); newDirectoryRecord = new NintendoWiiOpticalDiscDirectoryRecord(newDirectoryRecordBytes); itemNameBytes = discReader.GetBytes(isoStream, baseOffset, dataSectionOffset, nameTableOffset + newDirectoryRecord.NameOffset, 512, partitionKey); itemNameSize = ParseFile.GetSegmentLength(itemNameBytes, 0, Constants.NullByteArray); itemNameBytes = discReader.GetBytes(isoStream, baseOffset, dataSectionOffset, nameTableOffset + newDirectoryRecord.NameOffset, itemNameSize, partitionKey); itemName = ByteConversion.GetEncodedText(itemNameBytes, ByteConversion.GetPredictedCodePageForTags(itemNameBytes)); if (!newDirectoryRecord.IsDirectory) { newFile = new NintendoWiiOpticalDiscFileStructure(parentDirectory, this.SourceFilePath, itemName, baseOffset, dataSectionOffset, newDirectoryRecord.FileOffset, newDirectoryRecord.FileSize, creationDateTime, discReader, partitionKey); this.FileArray.Add(newFile); currentOffset += 0xC; } else { newDirectory = new NintendoWiiOpticalDiscDirectoryStructure(isoStream, isoStream.Name, newDirectoryRecord, creationDateTime, baseOffset, dataSectionOffset, rootDirectoryOffset, currentOffset, nameTableOffset, itemName, parentDirectory, discReader, partitionKey); this.SubDirectoryArray.Add(newDirectory); newDirectoryEndOffset = rootDirectoryOffset + (newDirectoryRecord.FileSize * 0xC); currentOffset = newDirectoryEndOffset; } } }