Wire through include debug flag

This commit is contained in:
Matt Nadareski
2025-07-31 09:11:43 -04:00
parent e36822a19c
commit 38b6427e4e
16 changed files with 118 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using SabreTools.IO.Compression.Deflate;
using SabreTools.Models.BFPK;
@@ -90,8 +91,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the BFPK to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no files
if (Files == null || Files.Length == 0)
@@ -101,7 +103,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < Files.Length; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -112,8 +114,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If we have no files
if (Files == null || Files.Length == 0)
@@ -181,8 +184,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Flush();
}
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.Models.BSP;
@@ -89,8 +90,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all lumps from the BSP to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all lumps extracted, false otherwise</returns>
public bool ExtractAllLumps(string outputDirectory)
public bool ExtractAllLumps(string outputDirectory, bool includeDebug)
{
// If we have no lumps
if (Lumps == null || Lumps.Length == 0)
@@ -100,7 +102,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < Lumps.Length; i++)
{
allExtracted &= ExtractLump(i, outputDirectory);
allExtracted &= ExtractLump(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -111,8 +113,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">Lump index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the lump extracted, false otherwise</returns>
public bool ExtractLump(int index, string outputDirectory)
public bool ExtractLump(int index, string outputDirectory, bool includeDebug)
{
// If we have no lumps
if (Lumps == null || Lumps.Length == 0)
@@ -164,8 +167,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -137,8 +137,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the CFB to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no files
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
@@ -148,7 +149,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < DirectoryEntries.Length; i++)
{
allExtracted &= ExtractEntry(i, outputDirectory);
allExtracted &= ExtractEntry(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -159,8 +160,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">Entry index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractEntry(int index, string outputDirectory)
public bool ExtractEntry(int index, string outputDirectory, bool includeDebug)
{
// If we have no entries
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
@@ -219,8 +221,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -232,8 +232,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the GCF to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no files
if (Files == null || Files.Length == 0)
@@ -243,7 +244,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < Files.Length; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -254,8 +255,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If we have no files
if (Files == null || Files.Length == 0 || DataBlockOffsets == null)
@@ -326,8 +328,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Flush();
}
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using SabreTools.IO.Compression.Blast;
@@ -176,8 +177,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the ISAv3 to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// Get the file count
int fileCount = Files.Length;
@@ -188,7 +190,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < fileCount; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -199,8 +201,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If the files index is invalid
if (index < 0 || index >= FileCount)
@@ -279,8 +282,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.IO.Compression.SZDD;
using SabreTools.Models.LZ;
@@ -99,8 +100,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract the contents to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the contents extracted, false otherwise</returns>
public bool Extract(string outputDirectory)
public bool Extract(string outputDirectory, bool includeDebug)
{
// Get the length of the compressed data
long compressedSize = Length - DataOffset;
@@ -146,8 +148,9 @@ namespace SabreTools.Serialization.Wrappers
decompressor.CopyTo(fs);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.IO.Compression.SZDD;
using SabreTools.Models.LZ;
@@ -82,10 +83,10 @@ namespace SabreTools.Serialization.Wrappers
/// <summary>
/// Extract the contents to an output directory
/// </summary>
/// <param name="filename">Original filename to use as a base</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the contents extracted, false otherwise</returns>
public bool Extract(string outputDirectory)
public bool Extract(string outputDirectory, bool includeDebug)
{
// Get the length of the compressed data
long compressedSize = Length - 12;
@@ -127,8 +128,9 @@ namespace SabreTools.Serialization.Wrappers
decompressor.CopyTo(fs);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.IO.Compression.SZDD;
using SabreTools.Models.LZ;
@@ -91,8 +92,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="filename">Original filename to use as a base</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the contents extracted, false otherwise</returns>
public bool Extract(string filename, string outputDirectory)
public bool Extract(string filename, string outputDirectory, bool includeDebug)
{
// Get the length of the compressed data
long compressedSize = Length - 14;
@@ -136,8 +138,9 @@ namespace SabreTools.Serialization.Wrappers
decompressor.CopyTo(fs);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.Models.PAK;
@@ -89,8 +90,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the PAK to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no directory items
if (DirectoryItems == null || DirectoryItems.Length == 0)
@@ -100,7 +102,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < DirectoryItems.Length; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -111,8 +113,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If we have no directory items
if (DirectoryItems == null || DirectoryItems.Length == 0)
@@ -153,8 +156,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.Models.PFF;
@@ -94,8 +95,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all segments from the PFF to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all segments extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no segments
if (Segments == null || Segments.Length == 0)
@@ -105,7 +107,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < Segments.Length; i++)
{
allExtracted &= ExtractSegment(i, outputDirectory);
allExtracted &= ExtractSegment(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -116,8 +118,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">Segment index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the segment extracted, false otherwise</returns>
public bool ExtractSegment(int index, string outputDirectory)
public bool ExtractSegment(int index, string outputDirectory, bool includeDebug)
{
// If we have no files
if (FileCount == 0)
@@ -165,8 +168,9 @@ namespace SabreTools.Serialization.Wrappers
return true;
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.Models.Quantum;
@@ -98,8 +99,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the Quantum archive to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no files
if (FileList == null || FileList.Length == 0)
@@ -109,7 +111,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < FileList.Length; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -120,8 +122,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If we have no files
if (Header == null || FileCount == 0 || FileList == null || FileList.Length == 0)
@@ -139,6 +142,9 @@ namespace SabreTools.Serialization.Wrappers
int compressedDataLength = GetEndOfFile() - compressedDataOffset;
var compressedData = ReadFromDataSource(compressedDataOffset, compressedDataLength);
// Print a debug reminder
if (includeDebug) Console.WriteLine("Quantum archive extraction is unsupported");
// TODO: Figure out decompression
// - Single-file archives seem to work
// - Single-file archives with files that span a window boundary seem to work

View File

@@ -128,8 +128,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the SGA to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// Get the file count
int fileCount = FileCount;
@@ -140,7 +141,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < fileCount; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -151,8 +152,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// Get the file count
int fileCount = FileCount;
@@ -259,8 +261,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
using SabreTools.Models.BSP;
@@ -89,8 +90,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all lumps from the VBSP to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all lumps extracted, false otherwise</returns>
public bool ExtractAllLumps(string outputDirectory)
public bool ExtractAllLumps(string outputDirectory, bool includeDebug)
{
// If we have no lumps
if (Lumps == null || Lumps.Length == 0)
@@ -100,7 +102,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < Lumps.Length; i++)
{
allExtracted &= ExtractLump(i, outputDirectory);
allExtracted &= ExtractLump(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -111,8 +113,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">Lump index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the lump extracted, false otherwise</returns>
public bool ExtractLump(int index, string outputDirectory)
public bool ExtractLump(int index, string outputDirectory, bool includeDebug)
{
// If we have no lumps
if (Lumps == null || Lumps.Length == 0)
@@ -164,8 +167,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -155,8 +155,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the VPK to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no directory items
if (DirectoryItems == null || DirectoryItems.Length == 0)
@@ -166,7 +167,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < DirectoryItems.Length; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -177,8 +178,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If we have no directory items
if (DirectoryItems == null || DirectoryItems.Length == 0)
@@ -234,8 +236,9 @@ namespace SabreTools.Serialization.Wrappers
// Read the directory item bytes
data = archiveStream.ReadBytes((int)directoryItem.DirectoryEntry.EntryLength);
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}
finally
@@ -279,8 +282,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -1,3 +1,4 @@
using System;
using System.IO;
namespace SabreTools.Serialization.Wrappers
@@ -88,8 +89,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all lumps from the WAD3 to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all lumps extracted, false otherwise</returns>
public bool ExtractAllLumps(string outputDirectory)
public bool ExtractAllLumps(string outputDirectory, bool includeDebug)
{
// If we have no lumps
if (DirEntries == null || DirEntries.Length == 0)
@@ -99,7 +101,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < DirEntries.Length; i++)
{
allExtracted &= ExtractLump(i, outputDirectory);
allExtracted &= ExtractLump(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -110,8 +112,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">Lump index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the lump extracted, false otherwise</returns>
public bool ExtractLump(int index, string outputDirectory)
public bool ExtractLump(int index, string outputDirectory, bool includeDebug)
{
// If we have no lumps
if (DirEntries == null || DirEntries.Length == 0)
@@ -152,8 +155,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}

View File

@@ -92,8 +92,9 @@ namespace SabreTools.Serialization.Wrappers
/// Extract all files from the XZP to an output directory
/// </summary>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if all files extracted, false otherwise</returns>
public bool ExtractAll(string outputDirectory)
public bool ExtractAll(string outputDirectory, bool includeDebug)
{
// If we have no directory entries
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
@@ -103,7 +104,7 @@ namespace SabreTools.Serialization.Wrappers
bool allExtracted = true;
for (int i = 0; i < DirectoryEntries.Length; i++)
{
allExtracted &= ExtractFile(i, outputDirectory);
allExtracted &= ExtractFile(i, outputDirectory, includeDebug);
}
return allExtracted;
@@ -114,8 +115,9 @@ namespace SabreTools.Serialization.Wrappers
/// </summary>
/// <param name="index">File index to extract</param>
/// <param name="outputDirectory">Output directory to write to</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>True if the file extracted, false otherwise</returns>
public bool ExtractFile(int index, string outputDirectory)
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If we have no directory entries
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
@@ -165,8 +167,9 @@ namespace SabreTools.Serialization.Wrappers
fs.Write(data, 0, data.Length);
fs.Flush();
}
catch
catch (Exception ex)
{
if (includeDebug) Console.WriteLine(ex);
return false;
}