Beispiel #1
0
        public static DateTime GetIsoDateTime(byte[] isoDateArray)
        {
            DateTime dateValue = new DateTime();
            string   dateString;

            if (ParseFile.CompareSegment(isoDateArray, 0, EMPTY_DATETIME))
            {
                dateValue = DateTime.MinValue;
            }
            // Easy CD Creator v4.2 (310), and maybe others,
            //  doesn't set the Grenwich Mean Time offset to zero as it should
            else if (ParseFile.CompareSegmentUsingSourceOffset(isoDateArray, 0, EMPTY_DATETIME_HACK.Length, EMPTY_DATETIME_HACK))
            {
                dateValue = DateTime.MinValue;
            }
            else
            {
                dateString = ByteConversion.GetAsciiText(isoDateArray);
                dateValue  = new DateTime(Int32.Parse(dateString.Substring(0, 4).Replace("0000", "2000")),
                                          Int16.Parse(dateString.Substring(4, 2)),
                                          Int16.Parse(dateString.Substring(6, 2)),
                                          Int16.Parse(dateString.Substring(8, 2)),
                                          Int16.Parse(dateString.Substring(10, 2)),
                                          Int16.Parse(dateString.Substring(12, 2)),
                                          Int16.Parse(dateString.Substring(14, 2)));
            }

            return(dateValue);
        }
Beispiel #2
0
        public bool IsGameCubeDisc(FileStream isoStream)
        {
            bool ret = false;

            byte[] SignatureBytes = ParseFile.ParseSimpleOffset(isoStream, this.VolumeBaseOffset + 0x18, 8);

            if (ParseFile.CompareSegmentUsingSourceOffset(SignatureBytes, 4, NintendoGameCube.STANDARD_IDENTIFIER.Length, NintendoGameCube.STANDARD_IDENTIFIER))
            {
                ret = true;
            }

            return(ret);
        }
        public static bool IsPotentialAdpcm(Stream searchStream, long offset,
                                            int rowsToCheck, bool doAdditionalChecks, ref bool previousRowIsZeroes)
        {
            bool ret = true;

            byte[] checkBytes = new byte[0x10 * rowsToCheck];
            int    bytesRead;

            searchStream.Position = offset;
            bytesRead             = searchStream.Read(checkBytes, 0, checkBytes.Length);

            // check for rows meeting criteria
            for (int i = 0; i < rowsToCheck; i++)
            {
                if (ParseFile.CompareSegmentUsingSourceOffset(checkBytes, (i * 0x10),
                                                              Psf.SONY_ADPCM_ROW_SIZE, Psf.VB_START_BYTES))
                {
                    if (previousRowIsZeroes)
                    {
                        ret = false;
                        break;
                    }
                    else
                    {
                        previousRowIsZeroes = true;
                    }
                }
                else
                {
                    previousRowIsZeroes = false;

                    if ((bytesRead < ((i * 0x10) + 0x10)) ||
                        (!IsSonyAdpcmRow(checkBytes, doAdditionalChecks, i)))
                    {
                        ret = false;
                        break;
                    }
                }
            }

            return(ret);
        }
Beispiel #4
0
        public NullDcGdi(string gdiPath)
        {
            CdAudio         audioVolume;
            NullDcGdiVolume gdiVolume;

            long currentOffset;
            long fileSize;

            byte[] sectorBytes;
            byte[] sectorDataBytes;
            byte[] volumeIdBytes;

            try
            {
                // parse GDI
                this.ParseGdiFile(gdiPath);

                // create volumes
                this.VolumeList = new ArrayList();

                if (this.TrackEntries != null)
                {
                    for (int i = 0; i < this.TrackEntries.Length; i++)
                    {
                        if (this.TrackEntries[i].EntryType == TrackType.Audio)
                        {
                            audioVolume = new CdAudio();
                            audioVolume.Initialize(null, 0, true);
                            audioVolume.VolumeIdentifier = String.Format("Track {0}", this.TrackEntries[i].TrackNumber.ToString("D2"));
                            this.VolumeList.Add(audioVolume);
                        }
                        else
                        {
                            currentOffset = 0;
                            fileSize      = this.TrackEntries[i].TrackStream.Length;

                            while (currentOffset < fileSize)
                            {
                                // get sector
                                sectorBytes = ParseFile.ParseSimpleOffset(this.TrackEntries[i].TrackStream, currentOffset, (int)this.TrackEntries[i].SectorSize);

                                // get data bytes from sector
                                sectorDataBytes = CdRom.GetDataChunkFromSector(sectorBytes, (this.TrackEntries[i].SectorSize == CdRom.RAW_SECTOR_SIZE));

                                // get header bytes
                                volumeIdBytes = ParseFile.ParseSimpleOffset(sectorDataBytes, 0, 0x100);

                                if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0, Iso9660.VOLUME_DESCRIPTOR_IDENTIFIER.Length, Iso9660.VOLUME_DESCRIPTOR_IDENTIFIER))
                                {
                                    gdiVolume = new NullDcGdiVolume(this);
                                    gdiVolume.Initialize(this.TrackEntries[i].TrackStream, currentOffset, (this.TrackEntries[i].SectorSize == CdRom.RAW_SECTOR_SIZE));
                                    this.VolumeList.Add((IVolume)gdiVolume);
                                }

                                currentOffset += this.TrackEntries[i].SectorSize;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new FileLoadException(String.Format("Error loading GDI: {0}.", ex.Message));
            }
            finally
            {
                // close all streams
                if (this.TrackEntries != null)
                {
                    for (int i = 0; i < this.TrackEntries.Length; i++)
                    {
                        if (this.TrackEntries[i].TrackStream.CanRead)
                        {
                            this.TrackEntries[i].TrackStream.Close();
                            this.TrackEntries[i].TrackStream.Dispose();
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public NullDcGdiDirectoryRecord(byte[] directoryBytes, bool volumeContainsXaData)
        {
            byte[] xaAttributes;
            ushort xaItemDetails;

            this.LengthOfDirectoryRecord = directoryBytes[0];

            if (this.LengthOfDirectoryRecord > 0)
            {
                this.ExtendedAttributeRecordLength = directoryBytes[1];

                this.LocationOfExtent = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(directoryBytes, 2, 4), 0);
                this.DataLength       = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(directoryBytes, 0x0A, 4), 0);

                if (ParseFile.CompareSegmentUsingSourceOffset(directoryBytes, 0x12, Iso9660.EMPTY_FILE_DATETIME.Length, Iso9660.EMPTY_FILE_DATETIME))
                {
                    this.RecordingDateAndTime = DateTime.MinValue;
                }
                else
                {
                    this.RecordingDateAndTime = new DateTime(directoryBytes[0x12] + 1900,
                                                             directoryBytes[0x13],
                                                             directoryBytes[0x14],
                                                             directoryBytes[0x15],
                                                             directoryBytes[0x16],
                                                             directoryBytes[0x17]);
                }
                this.FileFlags = directoryBytes[0x19];

                this.FlagExistance      = (this.FileFlags & 0x1) == 0x1 ? true : false;
                this.FlagDirectory      = (this.FileFlags & 0x2) == 0x2 ? true : false;
                this.FlagAssociatedFile = (this.FileFlags & 0x4) == 0x4 ? true : false;
                this.FlagRecord         = (this.FileFlags & 0x08) == 0x08 ? true : false;
                this.FlagProtection     = (this.FileFlags & 0x10) == 0x10 ? true : false;
                this.FlagMultiExtent    = (this.FileFlags & 0x80) == 0x80 ? true : false;

                this.FileUnitSize           = directoryBytes[0x1A];
                this.InterleaveGapSize      = directoryBytes[0x1B];
                this.VolumeSequenceNumber   = BitConverter.ToUInt16(ParseFile.ParseSimpleOffset(directoryBytes, 0x1C, 2), 0);
                this.LengthOfFileIdentifier = directoryBytes[0x20];

                this.FileIdentifier = ParseFile.ParseSimpleOffset(directoryBytes, 0x21, this.LengthOfFileIdentifier);

                // parse identifier
                if ((this.LengthOfFileIdentifier == 1) && (this.FileIdentifier[0] == 0))
                {
                    this.FileIdentifierString = ".";
                }
                else if ((this.LengthOfFileIdentifier == 1) && (this.FileIdentifier[0] == 1))
                {
                    this.FileIdentifierString = "..";
                }
                else if (this.LengthOfFileIdentifier > 0)
                {
                    this.FileIdentifierString =
                        ByteConversion.GetEncodedText(this.FileIdentifier,
                                                      ByteConversion.GetPredictedCodePageForTags(this.FileIdentifier));
                }

                if (this.LengthOfFileIdentifier % 2 == 0)
                {
                    this.PaddingField = ParseFile.ParseSimpleOffset(directoryBytes, 0x21 + this.LengthOfFileIdentifier, 1);
                }
                else
                {
                    this.PaddingField = new byte[0];
                }

                this.ItemMode = CdSectorType.Unknown;

                // CD-XA
                if (volumeContainsXaData)
                {
                    if (directoryBytes.Length >=
                        (0x21 + this.LengthOfFileIdentifier + this.PaddingField.Length + 0xE))
                    {
                        xaAttributes = ParseFile.ParseSimpleOffset(directoryBytes, 0x21 + this.LengthOfFileIdentifier + this.PaddingField.Length, 0xE); //verify cut size

                        // verify this is an XA entry
                        if (ParseFile.CompareSegmentUsingSourceOffset(xaAttributes, 6, XA_SIGNATURE.Length, XA_SIGNATURE))
                        {
                            xaItemDetails = ByteConversion.GetUInt16BigEndian(ParseFile.ParseSimpleOffset(xaAttributes, 4, 2));

                            if ((xaItemDetails & XA_ATTR_INTERLEAVED) == XA_ATTR_INTERLEAVED)
                            {
                                this.ItemMode   = CdSectorType.XaInterleaved;
                                this.DataLength = (uint)(this.DataLength / (uint)CdRom.NON_RAW_SECTOR_SIZE) * (uint)CdRom.RAW_SECTOR_SIZE;
                            }
                            else if ((xaItemDetails & XA_ATTR_MODE2FORM1) == XA_ATTR_MODE2FORM1)
                            {
                                this.ItemMode = CdSectorType.Mode2Form1;
                            }
                            else if ((xaItemDetails & XA_ATTR_MODE2FORM2) == XA_ATTR_MODE2FORM2)
                            {
                                this.ItemMode   = CdSectorType.Mode2Form2;
                                this.DataLength = (uint)(this.DataLength / (uint)CdRom.NON_RAW_SECTOR_SIZE) * (uint)CdRom.RAW_SECTOR_SIZE;
                            }
                            else if ((xaItemDetails & XA_ATTR_CDDA) == XA_ATTR_CDDA)
                            {
                                this.ItemMode   = CdSectorType.Audio;
                                this.DataLength = (uint)(this.DataLength / (uint)CdRom.NON_RAW_SECTOR_SIZE) * (uint)CdRom.RAW_SECTOR_SIZE;
                            }
                            else
                            {
                                this.ItemMode = CdSectorType.Unknown;
                            }
                        }
                    }
                }

                /*
                 * public byte[] SystemUse { set; get; }
                 */
            }
        }
Beispiel #6
0
        public virtual void Initialize(FileStream isoStream, long offset, bool isRawDump)
        {
            byte[] sectorBytes;
            byte[] sectorDataBytes;

            this.FormatDescription       = NullDcGdi.FORMAT_DESCRIPTION_STRING;
            this.VolumeType              = VolumeDataType.Data;
            this.IsRawDump               = isRawDump;
            this.DirectoryStructureArray = new ArrayList();

            this.VolumeBaseOffset =
                this.IsRawDump ? (offset - Iso9660.EMPTY_HEADER_SIZE_RAW) : (offset - Iso9660.EMPTY_HEADER_SIZE);
            this.SectorSize =
                this.IsRawDump ? (int)CdRom.RAW_SECTOR_SIZE : (int)CdRom.NON_RAW_SECTOR_SIZE;

            // parse inital level sector
            sectorBytes     = ParseFile.ParseSimpleOffset(isoStream, offset, this.SectorSize);
            sectorDataBytes = CdRom.GetDataChunkFromSector(sectorBytes, this.IsRawDump);

            // check for CDXA marker
            this.ContainsCdxaData = ParseFile.CompareSegmentUsingSourceOffset(sectorDataBytes, (int)Iso9660.CDXA_IDENTIFIER_OFFSET, Iso9660.CDXA_IDENTIFIER.Length, Iso9660.CDXA_IDENTIFIER);

            this.VolumeDescriptorType    = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x00, 1)[0];
            this.StandardIdentifier      = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x01, 5);
            this.VolumeDescriptorVersion = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x06, 1)[0];

            this.UnusedField1 = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x07, 1)[0];

            this.SystemIdentifier = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x08, 0x20)).Trim();
            this.VolumeIdentifier = ByteConversion.GetAsciiText(FileUtil.ReplaceNullByteWithSpace(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x28, 0x20))).Trim();

            this.UnusedField2 = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x48, 0x08);

            this.VolumeSpaceSize = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x50, 0x04), 0);

            this.UnusedField3 = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x58, 0x20);

            this.VolumeSetSize        = BitConverter.ToUInt16(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x78, 0x02), 0);
            this.VolumeSequenceNumber = BitConverter.ToUInt16(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x7C, 0x02), 0);
            this.LogicalBlockSize     = BitConverter.ToUInt16(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x80, 0x02), 0);

            this.PathTableSize = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x84, 0x04), 0);
            this.LocationOfOccurrenceOfTypeLPathTable         = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x8C, 0x04), 0);
            this.LocationOfOptionalOccurrenceOfTypeLPathTable = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x90, 0x04), 0);
            this.LocationOfOccurrenceOfTypeMPathTable         = ByteConversion.GetUInt32BigEndian(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x94, 0x04));
            this.LocationOfOptionalOccurrenceOfTypeMPathTable = ByteConversion.GetUInt32BigEndian(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x98, 0x04));

            this.DirectoryRecordForRootDirectoryBytes = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x9C, 0x22);
            this.DirectoryRecordForRootDirectory      = new NullDcGdiDirectoryRecord(this.DirectoryRecordForRootDirectoryBytes, this.ContainsCdxaData);

            this.VolumeSetIdentifier         = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0xBE, 0x80)).Trim();
            this.PublisherIdentifier         = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x13E, 0x80)).Trim();
            this.DataPreparerIdentifier      = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x1BE, 0x80)).Trim();
            this.ApplicationIdentifier       = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x23E, 0x80)).Trim();
            this.CopyrightFileIdentifier     = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x2BE, 0x25)).Trim();
            this.AbstractFileIdentifier      = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x2E3, 0x25)).Trim();
            this.BibliographicFileIdentifier = ByteConversion.GetAsciiText(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x308, 0x25)).Trim();

            this.VolumeCreationDateAndTime     = Iso9660.GetIsoDateTime(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x32D, 0x11));
            this.VolumeModificationDateAndTime = Iso9660.GetIsoDateTime(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x33E, 0x11));
            this.VolumeExpirationDateAndTime   = Iso9660.GetIsoDateTime(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x34F, 0x11));
            this.VolumeEffectiveDateAndTime    = Iso9660.GetIsoDateTime(ParseFile.ParseSimpleOffset(sectorDataBytes, 0x360, 0x11));

            this.FileStructureVersion = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x371, 1)[0];

            this.Reserved1 = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x372, 1)[0];

            this.ApplicationUse = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x373, 0x200);

            this.Reserved2 = ParseFile.ParseSimpleOffset(sectorDataBytes, 0x573, 0x28D);

            this.LoadDirectories(isoStream);
        }
Beispiel #7
0
        public static IVolume[] GetDataVolumes(string pPath, long startingOffset)
        {
            ArrayList volumeList = new ArrayList();

            // read the file, scanning for identifying bytes
            using (FileStream fs = File.OpenRead(pPath))
            {
                long currentOffset = startingOffset;
                long fileSize      = fs.Length;

                byte[] sectorBytes;
                byte[] sectorDataBytes;
                byte[] volumeIdBytes;
                byte[] secondaryHeaderBytes;

                bool isRawFormat = false;
                int  sectorSize  = 0x800;
                // CdSectorType mode;

                //----------------------
                // check for sync bytes
                //----------------------
                byte[] syncCheckBytes = ParseFile.ParseSimpleOffset(fs, 0, CdRom.SYNC_BYTES.Length);

                if (ParseFile.CompareSegment(syncCheckBytes, 0, CdRom.SYNC_BYTES))
                {
                    isRawFormat = true;
                    sectorSize  = 0x930;
                }

                while (currentOffset < fileSize)
                {
                    // get sector
                    sectorBytes = ParseFile.ParseSimpleOffset(fs, currentOffset, sectorSize);

                    // get data bytes from sector
                    sectorDataBytes = CdRom.GetDataChunkFromSector(sectorBytes, isRawFormat);

                    // get header bytes
                    volumeIdBytes = ParseFile.ParseSimpleOffset(sectorDataBytes, 0, MAX_ID_BYTES_LENGTH);

                    //----------
                    // ISO 9660
                    //----------
                    if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0, Iso9660.VOLUME_DESCRIPTOR_IDENTIFIER.Length, Iso9660.VOLUME_DESCRIPTOR_IDENTIFIER))
                    {
                        Iso9660Volume isoVolume;
                        isoVolume = new Iso9660Volume();
                        isoVolume.Initialize(fs, currentOffset, isRawFormat);
                        volumeList.Add((IVolume)isoVolume);

                        if ((isoVolume.Directories.Length == 1) &&
                            (isoVolume.Directories[0].SubDirectories.Length == 0) &&
                            ((isoVolume.Directories[0].Files.Length == 0) ||
                             ((isoVolume.Directories[0].Files.Length == 1) && (isoVolume.Directories[0].Files[0].FileName.Equals(XDvdFs.XGD3_WARNING_FILE_NAME)))
                            )
                            )
                        {
                            // possible empty/dummy volume (XBOX)
                            currentOffset += sectorSize;
                        }
                        else
                        {
                            currentOffset = isoVolume.VolumeBaseOffset + ((long)isoVolume.VolumeSpaceSize * (long)sectorSize);
                        }
                    }
                    //-----------------
                    // Green Book CD-I
                    //-----------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0, GreenBookCdi.VOLUME_DESCRIPTOR_IDENTIFIER.Length, GreenBookCdi.VOLUME_DESCRIPTOR_IDENTIFIER))
                    {
                        GreenBookCdiVolume isoVolume;
                        isoVolume = new GreenBookCdiVolume();
                        isoVolume.Initialize(fs, currentOffset, isRawFormat);
                        volumeList.Add((IVolume)isoVolume);

                        break;
                    }

                    //-----------------------
                    // XDVDFS (XBOX/XBOX360)
                    //-----------------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0, XDvdFs.STANDARD_IDENTIFIER.Length, XDvdFs.STANDARD_IDENTIFIER))
                    {
                        if (isRawFormat)
                        {
                            throw new FormatException("Raw dumps not supported for XDVDFS (XBOX/XBOX360) format.");
                        }
                        else
                        {
                            XDvdFsVolume isoVolume;
                            isoVolume = new XDvdFsVolume();
                            isoVolume.Initialize(fs, currentOffset, isRawFormat);
                            volumeList.Add((IVolume)isoVolume);

                            // XDVDFS should be the last volume
                            break;
                        }
                    }

                    //---------------
                    // PANASONIC 3DO
                    //---------------
                    else if ((ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0, Panasonic3do.STANDARD_IDENTIFIER.Length, Panasonic3do.STANDARD_IDENTIFIER)) ||
                             (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0, Panasonic3do.STANDARD_IDENTIFIER2.Length, Panasonic3do.STANDARD_IDENTIFIER2)) ||
                             (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0, Panasonic3do.STANDARD_IDENTIFIER2.Length, Panasonic3do.STANDARD_IDENTIFIER3)))
                    {
                        Panasonic3doVolume isoVolume;
                        isoVolume = new Panasonic3doVolume();
                        isoVolume.Initialize(fs, currentOffset, isRawFormat);
                        volumeList.Add((IVolume)isoVolume);

                        // should be the last volume
                        break;
                    }

                    //-------------------
                    // NINTENDO GAMECUBE
                    //-------------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)NintendoGameCube.IDENTIFIER_OFFSET, NintendoGameCube.STANDARD_IDENTIFIER.Length, NintendoGameCube.STANDARD_IDENTIFIER))
                    {
                        NintendoGameCubeVolume isoVolume;
                        isoVolume = new NintendoGameCubeVolume();
                        isoVolume.Initialize(fs, currentOffset, isRawFormat);
                        volumeList.Add((IVolume)isoVolume);

                        // should be the last volume
                        break;
                    }

                    //--------------
                    // NINTENDO WII
                    //--------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)NintendoWiiOpticalDisc.IDENTIFIER_OFFSET, NintendoWiiOpticalDisc.STANDARD_IDENTIFIER.Length, NintendoWiiOpticalDisc.STANDARD_IDENTIFIER))
                    {
                        if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, 0x60, 1, Constants.NullByteArray))
                        {
                            NintendoWiiOpticalDisc wiiDisc = new NintendoWiiOpticalDisc();
                            wiiDisc.Initialize(fs, currentOffset, isRawFormat);

                            foreach (NintendoWiiOpticalDiscVolume isoVolume in wiiDisc.Volumes)
                            {
                                volumeList.Add((IVolume)isoVolume);
                            }

                            break;
                        }
                        else // Decrypted WII ISO
                        {
                            NintendoGameCubeVolume isoVolume;
                            isoVolume = new NintendoGameCubeVolume();
                            isoVolume.Initialize(fs, currentOffset, isRawFormat);
                            volumeList.Add((IVolume)isoVolume);
                        }
                        // should be the last volume
                        break;
                    }

                    //------------------------
                    // MS STFS Package (XBLA)
                    //------------------------
                    //
                    // @TODO: Currently Broken
                    //
                    //else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)MicrosoftSTFS.IDENTIFIER_OFFSET, MicrosoftSTFS.STANDARD_IDENTIFIER.Length, MicrosoftSTFS.STANDARD_IDENTIFIER))
                    //{
                    //    MicrosoftSTFSVolume isoVolume;
                    //    isoVolume = new MicrosoftSTFSVolume();
                    //    isoVolume.Initialize(fs, currentOffset, isRawFormat);
                    //    volumeList.Add((IVolume)isoVolume);

                    //    // should be the last volume
                    //    break;
                    //}

                    //------------------------
                    // NINTENDO U8 ARCHIVE
                    //------------------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)NintendoU8Archive.IDENTIFIER_OFFSET, NintendoU8Archive.STANDARD_IDENTIFIER.Length, NintendoU8Archive.STANDARD_IDENTIFIER))
                    {
                        NintendoU8Archive isoVolume;
                        isoVolume = new NintendoU8Archive(fs.Name);
                        isoVolume.Initialize(fs, currentOffset, isRawFormat);
                        volumeList.Add((IVolume)isoVolume);

                        // should be the last volume
                        break;
                    }

                    //-----------------
                    // NINTENDO WIIU
                    //-----------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)NintendoWiiUOpticalDisc.IDENTIFIER_OFFSET, NintendoWiiUOpticalDisc.STANDARD_IDENTIFIER.Length, NintendoWiiUOpticalDisc.STANDARD_IDENTIFIER))
                    {
                        NintendoWiiUOpticalDisc wiiUDisc = new NintendoWiiUOpticalDisc();
                        wiiUDisc.Initialize(fs, currentOffset, isRawFormat);

                        foreach (NintendoWiiUOpticalDiscVolume isoVolume in wiiUDisc.Volumes)
                        {
                            volumeList.Add((IVolume)isoVolume);
                        }

                        break;
                    }


                    //-----------------
                    // NINTENDO 3DS
                    //-----------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)Nintendo3dsCtr.IDENTIFIER_OFFSET, Nintendo3dsCtr.STANDARD_IDENTIFIER.Length, Nintendo3dsCtr.STANDARD_IDENTIFIER))
                    {
                        Nintendo3dsCtr ctr = new Nintendo3dsCtr(fs.Name);

                        foreach (Nintendo3dsNcchContainer isoVolume in ctr.Volumes)
                        {
                            volumeList.Add((IVolume)isoVolume);
                        }

                        break;
                    }

                    //------------------------
                    // CRI CPK ARCHIVE
                    //------------------------
                    else if (ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)CriCpkArchive.IDENTIFIER_OFFSET, CriCpkArchive.STANDARD_IDENTIFIER.Length, CriCpkArchive.STANDARD_IDENTIFIER))
                    {
                        CriCpkArchive isoVolume;
                        isoVolume = new CriCpkArchive();
                        isoVolume.Initialize(fs, currentOffset, isRawFormat);
                        volumeList.Add((IVolume)isoVolume);

                        // should be the last volume
                        break;
                    }

                    //-----------------------------
                    // PS VITA (MICROSOFT EXFAT FILE SYSTEM)
                    //-----------------------------
                    else if ((ParseFile.CompareSegmentUsingSourceOffset(volumeIdBytes, (int)SonyPsVitaCartridge.IDENTIFIER_OFFSET, SonyPsVitaCartridge.STANDARD_IDENTIFIER.Length, SonyPsVitaCartridge.STANDARD_IDENTIFIER)))
                    {
                        secondaryHeaderBytes = ParseFile.ParseSimpleOffset(fs, currentOffset + SonyPsVitaCartridge.EXFAT_HEADER_OFFSET, (int)(MicrosoftExFatFileSystem.STANDARD_IDENTIFIER.Length + MicrosoftExFatFileSystem.IDENTIFIER_OFFSET));

                        if (ParseFile.CompareSegmentUsingSourceOffset(secondaryHeaderBytes,
                                                                      (int)MicrosoftExFatFileSystem.IDENTIFIER_OFFSET,
                                                                      MicrosoftExFatFileSystem.STANDARD_IDENTIFIER.Length,
                                                                      MicrosoftExFatFileSystem.STANDARD_IDENTIFIER))
                        {
                            MicrosoftExFatVolume isoVolume;
                            isoVolume = new MicrosoftExFatVolume();
                            isoVolume.Initialize(fs, currentOffset + SonyPsVitaCartridge.EXFAT_HEADER_OFFSET, isRawFormat);
                            volumeList.Add((IVolume)isoVolume);

                            break;
                        }
                    }

                    else
                    {
                        currentOffset += sectorSize;
                    }
                }
            }

            return((IVolume[])volumeList.ToArray(typeof(IVolume)));
        }