public void Extract(ref Dictionary <string, FileStream> streamCache, string destinationFolder, bool extractAsRaw) { string destinationFile = Path.Combine(Path.Combine(destinationFolder, this.ParentDirectoryName), this.FileName); if (!streamCache.ContainsKey(this.SourceFilePath)) { streamCache[this.SourceFilePath] = File.OpenRead(this.SourceFilePath); } //----------------------------------------------------------- // ExeFS //----------------------------------------------------------- if (this.FileSystem == Nintendo3dsCtr.FileSystemType.ExeFS) { // write file while calculating hash HashAlgorithm cryptoHash = SHA256.Create(); byte[] outputHash = ParseFile.ExtractChunkToFile64ReturningHash(streamCache[this.SourceFilePath], (ulong)this.Offset, (ulong)this.Size, destinationFile, cryptoHash, false, false); if (!ParseFile.CompareSegment(outputHash, 0, this.Sha256Hash)) { // @TODO: only show error once per file //if (!sha1ErrorDisplayed) { MessageBox.Show(String.Format("Warning: '{0},' failed SHA256 verification in ExeFS at offset 0x{1} during extraction.{2}", Path.GetFileName(destinationFile), this.Offset, Environment.NewLine), "Warning - SHA256 Failure"); } } } //--------------- // RomFS //--------------- else { // @TODO: Modify to verify on extraction ParseFile.ExtractChunkToFile64(streamCache[this.SourceFilePath], (ulong)this.Offset, (ulong)this.Size, destinationFile, false, false); } }