mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add output dir to Verify
This commit is contained in:
@@ -21,7 +21,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class DatFile
|
public abstract class DatFile
|
||||||
{
|
{
|
||||||
#region Publically available fields
|
#region Fields
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Header values
|
/// Header values
|
||||||
@@ -48,7 +48,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (datFile != null)
|
if (datFile != null)
|
||||||
{
|
{
|
||||||
Header = datFile.Header;
|
Header = datFile.Header;
|
||||||
this.Items = datFile.Items;
|
Items = datFile.Items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2556,8 +2556,9 @@ 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="outDir">Optional param for output directory</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)
|
public bool VerifyDepot(List<string> inputs, string outDir)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -2629,7 +2630,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Header.Name = $"fixDAT_{Header.Name}";
|
Header.Name = $"fixDAT_{Header.Name}";
|
||||||
Header.Description = $"fixDAT_{Header.Description}";
|
Header.Description = $"fixDAT_{Header.Description}";
|
||||||
Items.ClearMarked();
|
Items.ClearMarked();
|
||||||
Write();
|
Write(outDir, stats: true);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -2638,13 +2639,14 @@ 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="outDir">Optional param for output directory</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="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
/// <param name="filter">Filter object to be passed to the DatItem level</param>
|
/// <param name="filter">Filter object to be passed to the DatItem level</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, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool chdsAsFiles, Filter filter)
|
public bool VerifyGeneric(List<string> inputs, string outDir, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool chdsAsFiles, Filter filter)
|
||||||
{
|
{
|
||||||
// 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;
|
||||||
@@ -2703,7 +2705,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// Now output the fixdat to the main folder
|
// Now output the fixdat to the main folder
|
||||||
Items.ClearMarked();
|
Items.ClearMarked();
|
||||||
success &= matched.Write(stats: true);
|
success &= matched.Write(outDir, stats: true);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -3119,13 +3121,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create and open an output file for writing direct from a dictionary
|
/// Create and open an output file for writing direct from a dictionary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="outDir">Set the output directory (default current directory)</param>
|
/// <param name="outDir">Set the output directory (current directory on null)</param>
|
||||||
/// <param name="norename">True if games should only be compared on game and file name (default), false if system and source are counted</param>
|
/// <param name="norename">True if games should only be compared on game and file name (default), false if system and source are counted</param>
|
||||||
/// <param name="stats">True if DAT statistics should be output on write, false otherwise (default)</param>
|
/// <param name="stats">True if DAT statistics should be output on write, false otherwise (default)</param>
|
||||||
/// <param name="ignoreblanks">True if blank roms should be skipped on output, false otherwise (default)</param>
|
/// <param name="ignoreblanks">True if blank roms should be skipped on output, false otherwise (default)</param>
|
||||||
/// <param name="overwrite">True if files should be overwritten (default), false if they should be renamed instead</param>
|
/// <param name="overwrite">True if files should be overwritten (default), false if they should be renamed instead</param>
|
||||||
/// <returns>True if the DAT was written correctly, false otherwise</returns>
|
/// <returns>True if the DAT was written correctly, false otherwise</returns>
|
||||||
public bool Write(string outDir = null, bool norename = true, bool stats = false, bool ignoreblanks = false, bool overwrite = true)
|
public bool Write(string outDir, bool norename = true, bool stats = false, bool ignoreblanks = false, bool overwrite = true)
|
||||||
{
|
{
|
||||||
// If there's nothing there, abort
|
// If there's nothing there, abort
|
||||||
if (Items.TotalCount == 0)
|
if (Items.TotalCount == 0)
|
||||||
|
|||||||
@@ -1505,6 +1505,10 @@ Options:
|
|||||||
Optionally, a temp folder can be supplied in the case the default
|
Optionally, a temp folder can be supplied in the case the default
|
||||||
temp directory is not preferred.
|
temp directory is not preferred.
|
||||||
|
|
||||||
|
-out=, --output-dir= Output directory
|
||||||
|
This sets an output folder to be used when the files are created. If
|
||||||
|
a path is not defined, the runtime directory is used instead.
|
||||||
|
|
||||||
-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 rather
|
This sets a mode where files are not checked based on name but rather
|
||||||
hash alone. This allows verification of (possibly) incorrectly named
|
hash alone. This allows verification of (possibly) incorrectly named
|
||||||
|
|||||||
@@ -3521,6 +3521,7 @@ The stats that are outputted are as follows:
|
|||||||
AddFeature(DatListInput);
|
AddFeature(DatListInput);
|
||||||
AddFeature(DepotFlag);
|
AddFeature(DepotFlag);
|
||||||
AddFeature(TempStringInput);
|
AddFeature(TempStringInput);
|
||||||
|
AddFeature(OutputDirStringInput);
|
||||||
AddFeature(HashOnlyFlag);
|
AddFeature(HashOnlyFlag);
|
||||||
AddFeature(QuickFlag);
|
AddFeature(QuickFlag);
|
||||||
AddFeature(HeaderStringInput);
|
AddFeature(HeaderStringInput);
|
||||||
@@ -3577,6 +3578,7 @@ The stats that are outputted are as follows:
|
|||||||
var datfilePaths = DirectoryExtensions.GetFilesOnly(datfiles);
|
var datfilePaths = DirectoryExtensions.GetFilesOnly(datfiles);
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
|
string outDir = GetString(features, OutputDirStringValue);
|
||||||
bool chdsAsFiles = GetBoolean(features, ChdsAsFilesValue);
|
bool chdsAsFiles = GetBoolean(features, ChdsAsFilesValue);
|
||||||
bool depot = GetBoolean(features, DepotValue);
|
bool depot = GetBoolean(features, DepotValue);
|
||||||
bool hashOnly = GetBoolean(features, HashOnlyValue);
|
bool hashOnly = GetBoolean(features, HashOnlyValue);
|
||||||
@@ -3595,9 +3597,9 @@ The stats that are outputted are as follows:
|
|||||||
|
|
||||||
// If we have the depot flag, respect it
|
// If we have the depot flag, respect it
|
||||||
if (depot)
|
if (depot)
|
||||||
datdata.VerifyDepot(Inputs);
|
datdata.VerifyDepot(Inputs, outDir);
|
||||||
else
|
else
|
||||||
datdata.VerifyGeneric(Inputs, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles, filter);
|
datdata.VerifyGeneric(Inputs, outDir, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Otherwise, process all DATs into the same output
|
// Otherwise, process all DATs into the same output
|
||||||
@@ -3617,9 +3619,9 @@ The stats that are outputted are as follows:
|
|||||||
|
|
||||||
// If we have the depot flag, respect it
|
// If we have the depot flag, respect it
|
||||||
if (depot)
|
if (depot)
|
||||||
datdata.VerifyDepot(Inputs);
|
datdata.VerifyDepot(Inputs, outDir);
|
||||||
else
|
else
|
||||||
datdata.VerifyGeneric(Inputs, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles, filter);
|
datdata.VerifyGeneric(Inputs, outDir, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user