/// <inheritdoc/> public override List <BaseFile> GetChildren() { List <BaseFile> found = new List <BaseFile>(); string gamename = Path.GetFileNameWithoutExtension(this.Filename); try { SevenZ zf = new SevenZ(); ZipReturn zr = zf.ZipFileOpen(this.Filename, -1, true); if (zr != ZipReturn.ZipGood) { throw new Exception(ZipUtils.ZipErrorMessageText(zr)); } for (int i = 0; i < zf.LocalFilesCount(); i++) { // If the entry is a directory (or looks like a directory), we don't want to open it if (zf.IsDirectory(i) || zf.Filename(i).EndsWith(Path.DirectorySeparatorChar.ToString()) || zf.Filename(i).EndsWith(Path.AltDirectorySeparatorChar.ToString()) || zf.Filename(i).EndsWith(Path.PathSeparator.ToString())) { continue; } // Open the read stream zr = zf.ZipFileOpenReadStream(i, out Stream readStream, out ulong streamsize); // If we get a read error, log it and continue if (zr != ZipReturn.ZipGood) { logger.Warning($"An error occurred while reading archive {this.Filename}: Zip Error - {zr}"); zr = zf.ZipFileCloseReadStream(); continue; } // Create a blank item for the entry BaseFile zipEntryRom = new BaseFile(); // Perform a quickscan, if flagged to if (this.AvailableHashes == Hash.CRC) { zipEntryRom.Size = (long)zf.UncompressedSize(i); zipEntryRom.CRC = zf.CRC32(i); } // Otherwise, use the stream directly else { zipEntryRom = GetInfo(readStream, size: (long)zf.UncompressedSize(i), hashes: this.AvailableHashes, keepReadOpen: true); } // Fill in comon details and add to the list zipEntryRom.Filename = zf.Filename(i); zipEntryRom.Parent = gamename; found.Add(zipEntryRom); } // Dispose of the archive zr = zf.ZipFileCloseReadStream(); zf.ZipFileClose(); } catch (Exception ex) { logger.Error(ex); return(null); } return(found); }