mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Rewrite some archive handling
Remove managed writing, simplify archive to archive handling, add ability to set modification date on files if in source rom.
This commit is contained in:
@@ -47,10 +47,11 @@ namespace SabreTools
|
||||
/// <param name="bare">True if the date should be omitted from the DAT, false otherwise</param>
|
||||
/// <param name="archivesAsFiles">True if archives should be treated as files, false otherwise</param>
|
||||
/// <param name="enableGzip">True if GZIP archives should be treated as files, false otherwise</param>
|
||||
/// <param name="addblanks">True if blank items should be created for empty folders, false otherwise</param>
|
||||
/// <param name="tempDir">Name of the directory to create a temp folder in (blank is current directory)</param>
|
||||
/// <param name="nowrite">True if the file should not be written out, false otherwise (default)</param>
|
||||
/// <param name="logger">Logger object for console and file output</param>
|
||||
public DATFromDir(List<String> inputs, Dat datdata, bool noMD5, bool noSHA1, bool bare, bool archivesAsFiles, bool enableGzip, string tempDir, Logger logger, bool nowrite = false)
|
||||
public DATFromDir(List<String> inputs, Dat datdata, bool noMD5, bool noSHA1, bool bare, bool archivesAsFiles, bool enableGzip, bool addblanks, string tempDir, Logger logger, bool nowrite = false)
|
||||
{
|
||||
_inputs = inputs;
|
||||
_datdata = datdata;
|
||||
@@ -61,7 +62,7 @@ namespace SabreTools
|
||||
_enableGzip = enableGzip;
|
||||
_tempDir = tempDir;
|
||||
_logger = logger;
|
||||
_addblanks = false; // This needs a proper flag later
|
||||
_addblanks = addblanks;
|
||||
_nowrite = nowrite;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,11 +46,12 @@ namespace SabreTools
|
||||
/// <param name="bare">True if the date should be omitted from the DAT, false otherwise</param>
|
||||
/// <param name="archivesAsFiles">True if archives should be treated as files, false otherwise</param>
|
||||
/// <param name="enableGzip">True if GZIP archives should be treated as files, false otherwise</param>
|
||||
/// <param name="addblanks">True if blank items should be created for empty folders, false otherwise</param>
|
||||
/// <param name="tempDir">Name of the directory to create a temp folder in (blank is current directory)</param>
|
||||
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
|
||||
/// <param name="logger">Logger object for console and file output</param>
|
||||
public DATFromDirParallel(string basePath, Dat datdata, bool noMD5, bool noSHA1, bool bare,
|
||||
bool archivesAsFiles, bool enableGzip, string tempDir, int maxDegreeOfParallelism, Logger logger)
|
||||
bool archivesAsFiles, bool enableGzip, bool addblanks, string tempDir, int maxDegreeOfParallelism, Logger logger)
|
||||
{
|
||||
_basePath = Path.GetFullPath(basePath);
|
||||
_datdata = datdata;
|
||||
@@ -61,7 +62,7 @@ namespace SabreTools
|
||||
_bare = bare;
|
||||
_archivesAsFiles = archivesAsFiles;
|
||||
_enableGzip = enableGzip;
|
||||
_addblanks = false; // This needs a proper flag later
|
||||
_addblanks = addblanks;
|
||||
_tempDir = tempDir;
|
||||
_maxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||
_logger = logger;
|
||||
|
||||
@@ -132,7 +132,8 @@ namespace SabreTools.Helper
|
||||
|
||||
// Then, loop through and check each of the inputs
|
||||
_logger.User("Processing files:\n");
|
||||
DATFromDir dfd = new DATFromDir(files, _datdata, false, false, false, false, true, "", _logger, true);
|
||||
DATFromDir dfd = new DATFromDir(files, _datdata, false /* noMD5 */, false /* noSHA1 */, false /* bare */,
|
||||
false /* archivesAsFiles */, true /* enableGzip */, false /* addblanks */, "" /* tempdir */, _logger, true /* nowrite */);
|
||||
dfd.Start();
|
||||
|
||||
// Setup the fixdat
|
||||
@@ -331,7 +332,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
else
|
||||
{
|
||||
FileTools.WriteToManagedArchive(input, _outdir, found);
|
||||
FileTools.WriteToArchive(input, _outdir, found);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -398,7 +399,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
else
|
||||
{
|
||||
FileTools.WriteToManagedArchive(newinput, _outdir, found);
|
||||
FileTools.WriteToArchive(newinput, _outdir, found);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +445,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
else
|
||||
{
|
||||
FileTools.WriteToManagedArchive(input, _outdir, newfound);
|
||||
FileTools.WriteToArchive(input, _outdir, newfound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -530,7 +531,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
else
|
||||
{
|
||||
FileTools.WriteToManagedArchive(outfile, _outdir, found);
|
||||
FileTools.WriteToArchive(outfile, _outdir, found);
|
||||
}
|
||||
|
||||
try
|
||||
@@ -542,8 +543,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
else
|
||||
{
|
||||
string archiveFileName = Path.Combine(_outdir, found.Machine.Name + ".zip");
|
||||
FileTools.CopyFileBetweenArchives(input, archiveFileName, rom.Name, found.Name, _logger);
|
||||
FileTools.CopyFileBetweenArchives(input, _outdir, rom.Name, found, _logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user