mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix rebuild, extract depth to proper places
This commit is contained in:
@@ -16,6 +16,15 @@ namespace SabreTools.Library.FileTypes
|
||||
/// </summary>
|
||||
public class XZArchive : BaseArchive
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Positive value for depth of the output depot, defaults to 4
|
||||
/// </summary>
|
||||
public int Depth { get; set; } = 4;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
@@ -309,11 +318,9 @@ namespace SabreTools.Library.FileTypes
|
||||
/// <param name="inputFile">Input filename to be moved</param>
|
||||
/// <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="depth">Positive value for depth of the output depot, defaults to 4</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, int depth = 4)
|
||||
public override bool Write(string inputFile, string outDir, Rom rom)
|
||||
{
|
||||
// Check that the input file exists
|
||||
if (!File.Exists(inputFile))
|
||||
@@ -325,7 +332,7 @@ namespace SabreTools.Library.FileTypes
|
||||
inputFile = Path.GetFullPath(inputFile);
|
||||
|
||||
// Get the file stream for the file and write out
|
||||
return Write(FileExtensions.TryOpenRead(inputFile), outDir, rom, date, depth);
|
||||
return Write(FileExtensions.TryOpenRead(inputFile), outDir, rom);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -334,10 +341,8 @@ namespace SabreTools.Library.FileTypes
|
||||
/// <param name="inputStream">Input stream to be moved</param>
|
||||
/// <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="depth">Positive value for depth of the output depot, defaults to 4</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, int depth = 4)
|
||||
public override bool Write(Stream inputStream, string outDir, Rom rom)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
@@ -355,7 +360,7 @@ namespace SabreTools.Library.FileTypes
|
||||
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
||||
|
||||
// Get the output file name
|
||||
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth));
|
||||
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, Depth));
|
||||
outfile = outfile.Replace(".gz", ".xz");
|
||||
|
||||
// Check to see if the folder needs to be created
|
||||
@@ -382,10 +387,8 @@ namespace SabreTools.Library.FileTypes
|
||||
/// <param name="inputFiles">Input files to be moved</param>
|
||||
/// <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>
|
||||
/// <returns>True if the archive was written properly, false otherwise</returns>
|
||||
public override bool Write(List<string> inputFiles, string outDir, List<Rom> roms, bool date = false, bool romba = false)
|
||||
public override bool Write(List<string> inputFiles, string outDir, List<Rom> roms)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user