mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools, DatFile, README.1ST] Remove temp directory from sort and verify
This commit is contained in:
@@ -3876,7 +3876,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of input files/folders to check</param>
|
/// <param name="inputs">List of input files/folders to check</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
||||||
@@ -3885,7 +3884,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
||||||
public bool RebuildDepot(List<string> inputs, string outDir, string tempDir, bool date, bool delete,
|
public bool RebuildDepot(List<string> inputs, string outDir, bool date, bool delete,
|
||||||
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, string headerToCheckAgainst)
|
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, string headerToCheckAgainst)
|
||||||
{
|
{
|
||||||
#region Perform setup
|
#region Perform setup
|
||||||
@@ -3904,22 +3903,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
outDir = Path.GetFullPath(outDir);
|
outDir = Path.GetFullPath(outDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the temp directory
|
|
||||||
if (String.IsNullOrEmpty(tempDir))
|
|
||||||
{
|
|
||||||
tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then create or clean the temp directory
|
|
||||||
if (!Directory.Exists(tempDir))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(tempDir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileTools.CleanDirectory(tempDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now we want to get forcepack flag if it's not overridden
|
// Now we want to get forcepack flag if it's not overridden
|
||||||
if (outputFormat == OutputFormat.Folder && ForcePacking != ForcePacking.None)
|
if (outputFormat == OutputFormat.Folder && ForcePacking != ForcePacking.None)
|
||||||
{
|
{
|
||||||
@@ -4040,7 +4023,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, we rebuild that file to all locations that we need to
|
// Otherwise, we rebuild that file to all locations that we need to
|
||||||
RebuildIndividualFile(fileinfo, foundpath, outDir, tempDir, date, inverse, outputFormat, romba,
|
RebuildIndividualFile(fileinfo, foundpath, outDir, date, inverse, outputFormat, romba,
|
||||||
updateDat, false /* isZip */, headerToCheckAgainst);
|
updateDat, false /* isZip */, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4066,7 +4049,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of input files/folders to check</param>
|
/// <param name="inputs">List of input files/folders to check</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
@@ -4078,7 +4060,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
||||||
public bool RebuildGeneric(List<string> inputs, string outDir, string tempDir, bool quickScan, bool date,
|
public bool RebuildGeneric(List<string> inputs, string outDir, bool quickScan, bool date,
|
||||||
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
||||||
string headerToCheckAgainst, bool ignorechd)
|
string headerToCheckAgainst, bool ignorechd)
|
||||||
{
|
{
|
||||||
@@ -4098,22 +4080,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
outDir = Path.GetFullPath(outDir);
|
outDir = Path.GetFullPath(outDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the temp directory
|
|
||||||
if (String.IsNullOrEmpty(tempDir))
|
|
||||||
{
|
|
||||||
tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then create or clean the temp directory
|
|
||||||
if (!Directory.Exists(tempDir))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(tempDir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileTools.CleanDirectory(tempDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now we want to get forcepack flag if it's not overridden
|
// Now we want to get forcepack flag if it's not overridden
|
||||||
if (outputFormat == OutputFormat.Folder && ForcePacking != ForcePacking.None)
|
if (outputFormat == OutputFormat.Folder && ForcePacking != ForcePacking.None)
|
||||||
{
|
{
|
||||||
@@ -4175,7 +4141,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (File.Exists(input))
|
if (File.Exists(input))
|
||||||
{
|
{
|
||||||
Globals.Logger.User("Checking file: {0}", input);
|
Globals.Logger.User("Checking file: {0}", input);
|
||||||
RebuildGenericHelper(input, outDir, tempDir, quickScan, date, delete, inverse,
|
RebuildGenericHelper(input, outDir, quickScan, date, delete, inverse,
|
||||||
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, ignorechd);
|
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, ignorechd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4186,7 +4152,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
Globals.Logger.User("Checking file: {0}", file);
|
Globals.Logger.User("Checking file: {0}", file);
|
||||||
RebuildGenericHelper(file, outDir, tempDir, quickScan, date, delete, inverse,
|
RebuildGenericHelper(file, outDir, quickScan, date, delete, inverse,
|
||||||
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, ignorechd);
|
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, ignorechd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4214,7 +4180,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="file">Name of the file to process</param>
|
/// <param name="file">Name of the file to process</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
@@ -4225,7 +4190,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private void RebuildGenericHelper(string file, string outDir, string tempDir, bool quickScan, bool date,
|
private void RebuildGenericHelper(string file, string outDir, bool quickScan, bool date,
|
||||||
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
||||||
string headerToCheckAgainst, bool ignorechd)
|
string headerToCheckAgainst, bool ignorechd)
|
||||||
{
|
{
|
||||||
@@ -4235,9 +4200,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the temporary directory
|
|
||||||
string tempSubDir = Path.GetFullPath(Path.Combine(tempDir, Path.GetRandomFileName())) + Path.DirectorySeparatorChar;
|
|
||||||
|
|
||||||
// Set the deletion variables
|
// Set the deletion variables
|
||||||
bool usedExternally = false;
|
bool usedExternally = false;
|
||||||
bool usedInternally = false;
|
bool usedInternally = false;
|
||||||
@@ -4251,7 +4213,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes),
|
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes),
|
||||||
header: headerToCheckAgainst, ignorechd: ignorechd);
|
header: headerToCheckAgainst, ignorechd: ignorechd);
|
||||||
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, tempSubDir, date, inverse, outputFormat,
|
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, date, inverse, outputFormat,
|
||||||
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4282,7 +4244,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), ignorechd: ignorechd);
|
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), ignorechd: ignorechd);
|
||||||
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, tempSubDir, date, inverse, outputFormat,
|
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, date, inverse, outputFormat,
|
||||||
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
// Otherwise, loop through the entries and try to match
|
// Otherwise, loop through the entries and try to match
|
||||||
@@ -4290,7 +4252,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
foreach (Rom entry in entries)
|
foreach (Rom entry in entries)
|
||||||
{
|
{
|
||||||
usedInternally &= RebuildIndividualFile(entry, file, outDir, tempSubDir, date, inverse, outputFormat,
|
usedInternally &= RebuildIndividualFile(entry, file, outDir, date, inverse, outputFormat,
|
||||||
romba, updateDat, !isTorrentGzip /* isZip */, headerToCheckAgainst);
|
romba, updateDat, !isTorrentGzip /* isZip */, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4301,9 +4263,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
FileTools.TryDeleteFile(file);
|
FileTools.TryDeleteFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now delete the temp directory
|
|
||||||
FileTools.TryDeleteDirectory(tempSubDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -4312,7 +4271,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="datItem">Information for the current file to rebuild from</param>
|
/// <param name="datItem">Information for the current file to rebuild from</param>
|
||||||
/// <param name="file">Name of the file to process</param>
|
/// <param name="file">Name of the file to process</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
||||||
/// <param name="outputFormat">Output format that files should be written to</param>
|
/// <param name="outputFormat">Output format that files should be written to</param>
|
||||||
@@ -4321,7 +4279,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="isZip">True if the input file is an archive, false if the file is TGZ, null otherwise</param>
|
/// <param name="isZip">True if the input file is an archive, false if the file is TGZ, null otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <returns>True if the file was able to be rebuilt, false otherwise</returns>
|
/// <returns>True if the file was able to be rebuilt, false otherwise</returns>
|
||||||
private bool RebuildIndividualFile(DatItem datItem, string file, string outDir, string tempDir, bool date,
|
private bool RebuildIndividualFile(DatItem datItem, string file, string outDir, bool date,
|
||||||
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, bool? isZip, string headerToCheckAgainst)
|
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, bool? isZip, string headerToCheckAgainst)
|
||||||
{
|
{
|
||||||
// Set the output value
|
// Set the output value
|
||||||
@@ -4696,12 +4654,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
fileStream?.Dispose();
|
fileStream?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// And now clear the temp folder to get rid of any transient files if we unzipped
|
|
||||||
if (isZip == true)
|
|
||||||
{
|
|
||||||
FileTools.TryDeleteDirectory(tempDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rebuilt;
|
return rebuilt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4709,29 +4661,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// Process the DAT and verify from the depots
|
/// Process the DAT and verify from the depots
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of input directories to compare against</param>
|
/// <param name="inputs">List of input directories to compare against</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
|
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <returns>True if verification was a success, false otherwise</returns>
|
/// <returns>True if verification was a success, false otherwise</returns>
|
||||||
public bool VerifyDepot(List<string> inputs, string tempDir, string headerToCheckAgainst)
|
public bool VerifyDepot(List<string> inputs, string headerToCheckAgainst)
|
||||||
{
|
{
|
||||||
// Check the temp directory
|
|
||||||
if (String.IsNullOrEmpty(tempDir))
|
|
||||||
{
|
|
||||||
tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then create or clean the temp directory
|
|
||||||
if (!Directory.Exists(tempDir))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(tempDir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileTools.CleanDirectory(tempDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
InternalStopwatch watch = new InternalStopwatch("Verifying all from supplied depots");
|
InternalStopwatch watch = new InternalStopwatch("Verifying all from supplied depots");
|
||||||
@@ -4817,30 +4750,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// Process the DAT and verify the output directory
|
/// Process the DAT and verify the output directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of input directories to compare against</param>
|
/// <param name="inputs">List of input directories to compare against</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
|
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
/// <returns>True if verification was a success, false otherwise</returns>
|
/// <returns>True if verification was a success, false otherwise</returns>
|
||||||
public bool VerifyGeneric(List<string> inputs, string tempDir, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool ignorechd)
|
public bool VerifyGeneric(List<string> inputs, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool ignorechd)
|
||||||
{
|
{
|
||||||
// Check the temp directory exists
|
|
||||||
if (String.IsNullOrEmpty(tempDir))
|
|
||||||
{
|
|
||||||
tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then create or clean the temp directory
|
|
||||||
if (!Directory.Exists(tempDir))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(tempDir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileTools.CleanDirectory(tempDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder
|
// TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -4850,7 +4766,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
PopulateFromDir(input, (quickScan ? Hash.SecureHashes : Hash.DeepHashes) /* omitFromScan */, true /* bare */, false /* archivesAsFiles */,
|
PopulateFromDir(input, (quickScan ? Hash.SecureHashes : Hash.DeepHashes) /* omitFromScan */, true /* bare */, false /* archivesAsFiles */,
|
||||||
true /* enableGzip */, SkipFileType.None, false /* addBlanks */, false /* addDate */, tempDir /* tempDir */, false /* copyFiles */,
|
true /* enableGzip */, SkipFileType.None, false /* addBlanks */, false /* addDate */, "" /* tempDir */, false /* copyFiles */,
|
||||||
headerToCheckAgainst, ignorechd);
|
headerToCheckAgainst, ignorechd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -482,11 +482,6 @@ Options:
|
|||||||
This sets an output folder to be used when the files are created. If
|
This sets an output folder to be used when the files are created. If
|
||||||
a path is not defined, the application directory is used instead.
|
a path is not defined, the application directory is used instead.
|
||||||
|
|
||||||
-t=, --temp= Set the name of the temporary directory
|
|
||||||
Optionally, a temp folder can be supplied in the case the default
|
|
||||||
temp directory (inside the running folder) is not preferred. This is
|
|
||||||
used for any operations that require an archive to be extracted.
|
|
||||||
|
|
||||||
-d, --delete Delete fully rebuilt input files
|
-d, --delete Delete fully rebuilt input files
|
||||||
Optionally, the input files, once processed and fully matched, can
|
Optionally, the input files, once processed and fully matched, can
|
||||||
be deleted. This can be useful when the original file structure is
|
be deleted. This can be useful when the original file structure is
|
||||||
@@ -647,11 +642,6 @@ Options:
|
|||||||
This sets an output folder to be used when the files are created. If
|
This sets an output folder to be used when the files are created. If
|
||||||
a path is not defined, the application directory is used instead.
|
a path is not defined, the application directory is used instead.
|
||||||
|
|
||||||
-t=, --temp= Set the name of the temporary directory
|
|
||||||
Optionally, a temp folder can be supplied in the case the default
|
|
||||||
temp directory (inside the running folder) is not preferred. This is
|
|
||||||
used for any operations that require an archive to be extracted.
|
|
||||||
|
|
||||||
-d, --delete Delete fully rebuilt input files
|
-d, --delete Delete fully rebuilt input files
|
||||||
Optionally, the input files, once processed and fully matched, can
|
Optionally, the input files, once processed and fully matched, can
|
||||||
be deleted. This can be useful when the original file structure is
|
be deleted. This can be useful when the original file structure is
|
||||||
@@ -1295,11 +1285,6 @@ Options:
|
|||||||
The user-supplied DAT used to check which files need to be verified.
|
The user-supplied DAT used to check which files need to be verified.
|
||||||
Multiple occurrences of this flag are allowed.
|
Multiple occurrences of this flag are allowed.
|
||||||
|
|
||||||
-t=, --temp= Set the name of the temporary directory
|
|
||||||
Optionally, a temp folder can be supplied in the case the default
|
|
||||||
temp directory (inside the running folder) is not preferred. This is
|
|
||||||
used for any operations that require an archive to be extracted.
|
|
||||||
|
|
||||||
-ho, --hash-only Check files by hash only
|
-ho, --hash-only Check files by hash only
|
||||||
This sets a mode where files are not checked based on name but
|
This sets a mode where files are not checked based on name but
|
||||||
rather hash alone. This allows verification of (possibly)
|
rather hash alone. This allows verification of (possibly)
|
||||||
@@ -1355,11 +1340,6 @@ Options:
|
|||||||
The user-supplied DAT used to check which files need to be verified.
|
The user-supplied DAT used to check which files need to be verified.
|
||||||
Multiple occurrences of this flag are allowed.
|
Multiple occurrences of this flag are allowed.
|
||||||
|
|
||||||
-t=, --temp= Set the name of the temporary directory
|
|
||||||
Optionally, a temp folder can be supplied in the case the default
|
|
||||||
temp directory (inside the running folder) is not preferred. This is
|
|
||||||
used for any operations that require an archive to be extracted.
|
|
||||||
|
|
||||||
-h=, --header= Remove headers from hash calculations
|
-h=, --header= Remove headers from hash calculations
|
||||||
If this is set, then all files that have copier headers that are
|
If this is set, then all files that have copier headers that are
|
||||||
detected will have them removed from the hash calculation. This will
|
detected will have them removed from the hash calculation. This will
|
||||||
|
|||||||
@@ -409,11 +409,6 @@ namespace SabreTools
|
|||||||
"Output directory",
|
"Output directory",
|
||||||
FeatureType.String,
|
FeatureType.String,
|
||||||
null));
|
null));
|
||||||
sort.AddFeature("temp", new Feature(
|
|
||||||
new List<string>() { "-temp", "--temp" },
|
|
||||||
"Set the temporary directory to use",
|
|
||||||
FeatureType.String,
|
|
||||||
null));
|
|
||||||
sort.AddFeature("delete", new Feature(
|
sort.AddFeature("delete", new Feature(
|
||||||
new List<string>() { "-del", "--delete" },
|
new List<string>() { "-del", "--delete" },
|
||||||
"Delete fully rebuilt input files",
|
"Delete fully rebuilt input files",
|
||||||
@@ -560,11 +555,6 @@ namespace SabreTools
|
|||||||
"Output directory",
|
"Output directory",
|
||||||
FeatureType.String,
|
FeatureType.String,
|
||||||
null));
|
null));
|
||||||
sortDepot.AddFeature("temp", new Feature(
|
|
||||||
new List<string>() { "-temp", "--temp" },
|
|
||||||
"Set the temporary directory to use",
|
|
||||||
FeatureType.String,
|
|
||||||
null));
|
|
||||||
sortDepot.AddFeature("delete", new Feature(
|
sortDepot.AddFeature("delete", new Feature(
|
||||||
new List<string>() { "-del", "--delete" },
|
new List<string>() { "-del", "--delete" },
|
||||||
"Delete fully rebuilt input files",
|
"Delete fully rebuilt input files",
|
||||||
|
|||||||
@@ -320,7 +320,6 @@ namespace SabreTools
|
|||||||
/// <param name="datfiles">Names of the DATs to compare against</param>
|
/// <param name="datfiles">Names of the DATs to compare against</param>
|
||||||
/// <param name="inputs">List of input files/folders to check</param>
|
/// <param name="inputs">List of input files/folders to check</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
@@ -335,7 +334,7 @@ namespace SabreTools
|
|||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan, bool date, bool delete,
|
private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, bool quickScan, bool date, bool delete,
|
||||||
bool inverse, OutputFormat outputFormat, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst,
|
bool inverse, OutputFormat outputFormat, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst,
|
||||||
SplitType splitType, bool ignorechd)
|
SplitType splitType, bool ignorechd)
|
||||||
{
|
{
|
||||||
@@ -356,7 +355,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
datdata.RebuildGeneric(inputs, outDir, tempDir, quickScan, date, delete, inverse, outputFormat, romba, asl,
|
datdata.RebuildGeneric(inputs, outDir, quickScan, date, delete, inverse, outputFormat, romba, asl,
|
||||||
updateDat, headerToCheckAgainst, ignorechd);
|
updateDat, headerToCheckAgainst, ignorechd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +365,6 @@ namespace SabreTools
|
|||||||
/// <param name="datfiles">Names of the DATs to compare against</param>
|
/// <param name="datfiles">Names of the DATs to compare against</param>
|
||||||
/// <param name="inputs">List of input files/folders to check</param>
|
/// <param name="inputs">List of input files/folders to check</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
||||||
@@ -375,7 +373,7 @@ namespace SabreTools
|
|||||||
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
||||||
private static void InitSortDepot(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool date, bool delete,
|
private static void InitSortDepot(List<string> datfiles, List<string> inputs, string outDir, bool date, bool delete,
|
||||||
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, string headerToCheckAgainst, SplitType splitType)
|
bool inverse, OutputFormat outputFormat, bool romba, bool updateDat, string headerToCheckAgainst, SplitType splitType)
|
||||||
{
|
{
|
||||||
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
||||||
@@ -392,7 +390,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
datdata.RebuildDepot(inputs, outDir, tempDir, date, delete, inverse, outputFormat, romba,
|
datdata.RebuildDepot(inputs, outDir, date, delete, inverse, outputFormat, romba,
|
||||||
updateDat, headerToCheckAgainst);
|
updateDat, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,14 +741,13 @@ namespace SabreTools
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="datfiles">Names of the DATs to compare against</param>
|
/// <param name="datfiles">Names of the DATs to compare against</param>
|
||||||
/// <param name="inputs">Input directories to compare against</param>
|
/// <param name="inputs">Input directories to compare against</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
|
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private static void InitVerify(List<string> datfiles, List<string> inputs, string tempDir,
|
private static void InitVerify(List<string> datfiles, List<string> inputs, bool hashOnly, bool quickScan,
|
||||||
bool hashOnly, bool quickScan, string headerToCheckAgainst, SplitType splitType, bool ignorechd)
|
string headerToCheckAgainst, SplitType splitType, bool ignorechd)
|
||||||
{
|
{
|
||||||
// Get the archive scanning level
|
// Get the archive scanning level
|
||||||
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(1, 1, 1, 1);
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(1, 1, 1, 1);
|
||||||
@@ -769,7 +766,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
datdata.VerifyGeneric(inputs, tempDir, hashOnly, quickScan, headerToCheckAgainst, ignorechd);
|
datdata.VerifyGeneric(inputs, hashOnly, quickScan, headerToCheckAgainst, ignorechd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -777,11 +774,9 @@ namespace SabreTools
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="datfiles">Names of the DATs to compare against</param>
|
/// <param name="datfiles">Names of the DATs to compare against</param>
|
||||||
/// <param name="inputs">Input directories to compare against</param>
|
/// <param name="inputs">Input directories to compare against</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
||||||
private static void InitVerifyDepot(List<string> datfiles, List<string> inputs, string tempDir,
|
private static void InitVerifyDepot(List<string> datfiles, List<string> inputs, string headerToCheckAgainst, SplitType splitType)
|
||||||
string headerToCheckAgainst, SplitType splitType)
|
|
||||||
{
|
{
|
||||||
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
InternalStopwatch watch = new InternalStopwatch("Populating internal DAT");
|
||||||
|
|
||||||
@@ -797,7 +792,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
datdata.VerifyDepot(inputs, tempDir, headerToCheckAgainst);
|
datdata.VerifyDepot(inputs, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1278,14 +1278,14 @@ namespace SabreTools
|
|||||||
// If we're using the sorter
|
// If we're using the sorter
|
||||||
else if (sort)
|
else if (sort)
|
||||||
{
|
{
|
||||||
InitSort(datfiles, inputs, outDir, tempDir, quickScan, addFileDates, delete, inverse,
|
InitSort(datfiles, inputs, outDir, quickScan, addFileDates, delete, inverse,
|
||||||
outputFormat, romba, sevenzip, gz, rar, zip, updateDat, header, splitType, ignorechd);
|
outputFormat, romba, sevenzip, gz, rar, zip, updateDat, header, splitType, ignorechd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're using the sorter from depot
|
// If we're using the sorter from depot
|
||||||
else if (sortDepot)
|
else if (sortDepot)
|
||||||
{
|
{
|
||||||
InitSortDepot(datfiles, inputs, outDir, tempDir, addFileDates, delete, inverse,
|
InitSortDepot(datfiles, inputs, outDir, addFileDates, delete, inverse,
|
||||||
outputFormat, romba, updateDat, header, splitType);
|
outputFormat, romba, updateDat, header, splitType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1331,13 +1331,13 @@ namespace SabreTools
|
|||||||
// If we're using the verifier
|
// If we're using the verifier
|
||||||
else if (verify)
|
else if (verify)
|
||||||
{
|
{
|
||||||
InitVerify(datfiles, inputs, tempDir, hashOnly, quickScan, header, splitType, ignorechd);
|
InitVerify(datfiles, inputs, hashOnly, quickScan, header, splitType, ignorechd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're using the depot verifier
|
// If we're using the depot verifier
|
||||||
else if (verifyDepot)
|
else if (verifyDepot)
|
||||||
{
|
{
|
||||||
InitVerifyDepot(datfiles, inputs, tempDir, header, splitType);
|
InitVerifyDepot(datfiles, inputs, header, splitType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If nothing is set, show the help
|
// If nothing is set, show the help
|
||||||
|
|||||||
Reference in New Issue
Block a user