Add RVX compatible inputs

This commit is contained in:
Matt Nadareski
2020-08-18 11:34:43 -07:00
parent 381183c71c
commit 8e687a251d
22 changed files with 233 additions and 102 deletions

View File

@@ -176,9 +176,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override abstract bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false);
public override abstract bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null);
/// <summary>
/// Write an input stream to an archive
@@ -187,9 +187,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override abstract bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false);
public override abstract bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null);
/// <summary>
/// Write a set of input files to an archive (assuming the same output archive name)

View File

@@ -293,10 +293,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public virtual bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public virtual bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
FileStream fs = FileExtensions.TryOpenRead(inputFile);
return Write(fs, outDir, rom, date, romba);
@@ -309,10 +309,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public virtual bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public virtual bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
bool success = false;

View File

@@ -411,10 +411,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(string inputFile, string outDir, Rom rom = null, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom = null, bool date = false, bool? romba = null)
{
// Check that the input file exists
if (!File.Exists(inputFile))
@@ -436,10 +436,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(Stream inputStream, string outDir, Rom rom = null, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom = null, bool date = false, bool? romba = null)
{
bool success = false;
@@ -459,16 +459,23 @@ namespace SabreTools.Library.FileTypes
// Get the output file name
string outfile;
// If we have a romba output, add the romba path
if (romba)
// If we have a Romba output, add the depot path
if (romba == true)
{
outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1)); // TODO: When updating to SHA-256, this needs to update to SHA256
outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1, false)); // TODO: When updating to SHA-256, this needs to update to SHA256
// Check to see if the folder needs to be created
if (!Directory.Exists(Path.GetDirectoryName(outfile)))
Directory.CreateDirectory(Path.GetDirectoryName(outfile));
}
// If we have an RVX output, add the RomRoot path
else if (romba == false)
{
outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1, true)); // TODO: When updating to SHA-256, this needs to update to SHA256
// Check to see if the folder needs to be created
if (!Directory.Exists(Path.GetDirectoryName(outfile)))
{
Directory.CreateDirectory(Path.GetDirectoryName(outfile));
}
}
// Otherwise, we're just rebuilding to the main directory
else

View File

@@ -117,10 +117,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}
@@ -132,10 +132,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}

View File

@@ -117,10 +117,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}
@@ -132,10 +132,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}

View File

@@ -284,9 +284,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
// Get the file stream for the file and write out
return Write(FileExtensions.TryOpenRead(inputFile), outDir, rom, date, romba);
@@ -299,9 +299,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}

View File

@@ -414,9 +414,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
// Get the file stream for the file and write out
return Write(FileExtensions.TryOpenRead(inputFile), outDir, rom, date: date);
@@ -429,9 +429,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
bool success = false;
string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}");

View File

@@ -289,9 +289,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
// Get the file stream for the file and write out
return Write(FileExtensions.TryOpenRead(inputFile), outDir, rom, date: date);
@@ -304,9 +304,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
bool success = false;
string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}");

View File

@@ -312,10 +312,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
// Check that the input file exists
if (!File.Exists(inputFile))
@@ -337,9 +337,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
bool success = false;
@@ -359,10 +359,19 @@ namespace SabreTools.Library.FileTypes
// Get the output file name
string outfile;
// If we have a romba output, add the romba path
if (romba)
// If we have a Romba output, add the depot path
if (romba == true)
{
outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1)); // TODO: When updating to SHA-256, this needs to update to SHA256
outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1, false)); // TODO: When updating to SHA-256, this needs to update to SHA256
// Check to see if the folder needs to be created
if (!Directory.Exists(Path.GetDirectoryName(outfile)))
Directory.CreateDirectory(Path.GetDirectoryName(outfile));
}
// If we have an RVX output, add the RomRoot path
else if (romba == false)
{
outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1, true)); // TODO: When updating to SHA-256, this needs to update to SHA256
// Check to see if the folder needs to be created
if (!Directory.Exists(Path.GetDirectoryName(outfile)))

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using SabreTools.Library.Data;
using SabreTools.Library.DatFiles;
using SabreTools.Library.DatItems;
@@ -117,10 +116,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}
@@ -132,10 +131,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}

View File

@@ -419,9 +419,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
// Get the file stream for the file and write out
return Write(FileExtensions.TryOpenRead(inputFile), outDir, rom, date: date);
@@ -434,9 +434,9 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the archive was written properly, false otherwise</returns>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
bool success = false;
string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}");

View File

@@ -117,10 +117,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(string inputFile, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}
@@ -132,10 +132,10 @@ namespace SabreTools.Library.FileTypes
/// <param name="outDir">Output directory to build to</param>
/// <param name="rom">DatItem representing the new information</param>
/// <param name="date">True if the date from the DAT should be used if available, false otherwise (default)</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="romba">True if files should be output in Romba depot folders, false for RVX RomRoot folders, null otherwise</param>
/// <returns>True if the write was a success, false otherwise</returns>
/// <remarks>This works for now, but it can be sped up by using Ionic.Zip or another zlib wrapper that allows for header values built-in. See edc's code.</remarks>
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool romba = false)
public override bool Write(Stream inputStream, string outDir, Rom rom, bool date = false, bool? romba = null)
{
throw new NotImplementedException();
}