[DatFile, ArchiveTools] Use stream-based archive methods for rebuild

Because of how this worked out, the Archive-to-Archive methods are no longer needed
This commit is contained in:
Matt Nadareski
2017-03-16 22:17:07 -07:00
parent 57851f4bf5
commit 4817271327
2 changed files with 74 additions and 112 deletions

View File

@@ -44,88 +44,6 @@ namespace SabreTools.Helper.Tools
{
private const int _bufferSize = 4096 * 128;
#region Archive-to-Archive handling
/// <summary>
/// Transfer a single file from one archive to another
/// </summary>
/// <param name="inputArchive">Input archive name</param>
/// <param name="inputType">Input archive type</param>
/// <param name="inputEntry">Input entry name</param>
/// <param name="outputDir">Output directory</param>
/// <param name="outputType">Output archive type</param>
/// <param name="outputEntry">Output Rom information</param>
/// <param name="date">True if dates are preserved, false otherwise (default)</param>
/// <returns>True if the transfer was a success, false otherwise</returns>
public static bool Transfer(string inputArchive, ArchiveType? inputType, string inputEntry, string outputDir,
ArchiveType? outputType, Rom outputEntry, bool date = false)
{
List<string> inputEntries = new List<string>() { inputEntry };
List<Rom> outputEntries = new List<Rom>() { outputEntry };
return Transfer(inputArchive, inputType, inputEntries, outputDir, outputType, outputEntries, date: date);
}
/// <summary>
/// Transfer multiple files from one archive to another
/// </summary>
/// <param name="inputArchive">Input archive name</param>
/// <param name="inputType">Input archive type</param>
/// <param name="inputEntries">Input entry names</param>
/// <param name="outputDir">Output directory</param>
/// <param name="outputType">Output archive type</param>
/// <param name="outputEntries">Output Rom informations</param>
/// <param name="date">True if dates are preserved, false otherwise (default)</param>
/// <returns>True if the transfesr were a success, false otherwise</returns>
public static bool Transfer(string inputArchive, ArchiveType? inputType, List<string> inputEntries, string outputDir,
ArchiveType? outputType, List<Rom> outputEntries, bool date = false)
{
#region Verify inputs
// If the input archive doesn't exist, return false
if (!File.Exists(inputArchive))
{
return false;
}
// If any input entry is blank, return false
foreach (string inputEntry in inputEntries)
{
if (String.IsNullOrEmpty(inputEntry))
{
return false;
}
}
// If any output entry is null or blank, return false
foreach (Rom outputEntry in outputEntries)
{
if (outputEntry == null || outputEntry.Name == null)
{
return false;
}
}
// If the output directory is null, set the default
if (String.IsNullOrEmpty(outputDir))
{
outputDir = "out";
}
// Verify that the output directory exists
if (!Directory.Exists(outputDir))
{
Directory.CreateDirectory(outputDir);
}
#endregion
// If the input archive is
return false;
}
#endregion
#region Extraction
/// <summary>