mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SimpleSort] Add a new tool: SimpleSort
SimpleSort is essentially a quick rebuild solution for a fixdat or an input DAT. It can read all 4 major types of archive and always builds to zip
This commit is contained in:
@@ -225,6 +225,27 @@ Options:
|
||||
-e Detect and remove mode
|
||||
-r Restore header to file based on SHA-1");
|
||||
break;
|
||||
case "SimpleSort":
|
||||
Console.WriteLine(@"SimpleSort - Basic rebuild using a DAT
|
||||
-----------------------------------------
|
||||
Usage: SimpleSort [options] [filename|dirname] ...
|
||||
|
||||
Options:
|
||||
-?, -h, --help Show this help
|
||||
-dat= Input DAT to rebuild against (REQUIRED)
|
||||
-out= Output directory
|
||||
-t=, --temp= Set the temporary directory to use
|
||||
-7z={0} Set scanning level for 7z archives
|
||||
-gz={2} Set scanning level for GZip archives
|
||||
-rar={2} Set scanning level for RAR archives
|
||||
-zip={0} Set scanning level for ZIP archives
|
||||
|
||||
SimpleSort scanning levels:
|
||||
0 Hash archive and contents
|
||||
1 Only hash contents
|
||||
2 Only hash archive
|
||||
");
|
||||
break;
|
||||
default:
|
||||
Console.Write("This is the default help output");
|
||||
break;
|
||||
|
||||
@@ -107,4 +107,14 @@ namespace SabreTools.Helper
|
||||
MissFile,
|
||||
SabreDat,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the level to scan archives at
|
||||
/// </summary>
|
||||
public enum ArchiveScanLevel
|
||||
{
|
||||
Both = 0,
|
||||
Internal,
|
||||
External,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1484,14 +1484,8 @@ namespace SabreTools.Helper
|
||||
{
|
||||
RomData lastrom = outroms[i];
|
||||
|
||||
// If last is a nodump, skip it
|
||||
if (lastrom.Nodump)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the duplicate status
|
||||
dupefound = RomDuplicate(rom, lastrom);
|
||||
dupefound = IsDuplicate(rom, lastrom);
|
||||
|
||||
// If it's a duplicate, skip adding it to the output but add any missing information
|
||||
if (dupefound)
|
||||
@@ -1579,7 +1573,7 @@ namespace SabreTools.Helper
|
||||
/// <param name="lastrom">Rom to use as a base</param>
|
||||
/// <param name="datdata">DAT to match against</param>
|
||||
/// <returns>List of matched RomData objects</returns>
|
||||
public static List<RomData> ListDuplicates(RomData lastrom, DatData datdata)
|
||||
public static List<RomData> GetDuplicates(RomData lastrom, DatData datdata)
|
||||
{
|
||||
List<RomData> output = new List<RomData>();
|
||||
|
||||
@@ -1594,7 +1588,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
foreach (RomData rom in roms)
|
||||
{
|
||||
if (RomDuplicate(rom, lastrom))
|
||||
if (IsDuplicate(rom, lastrom))
|
||||
{
|
||||
output.Add(rom);
|
||||
}
|
||||
@@ -1610,10 +1604,16 @@ namespace SabreTools.Helper
|
||||
/// <param name="rom">Rom to check for duplicate status</param>
|
||||
/// <param name="lastrom">Rom to use as a baseline</param>
|
||||
/// <returns>True if the roms are duplicates, false otherwise</returns>
|
||||
public static bool RomDuplicate(RomData rom, RomData lastrom)
|
||||
public static bool IsDuplicate(RomData rom, RomData lastrom)
|
||||
{
|
||||
bool dupefound = false;
|
||||
|
||||
// If either is a nodump, it's never a match
|
||||
if (rom.Nodump || lastrom.Nodump)
|
||||
{
|
||||
return dupefound;
|
||||
}
|
||||
|
||||
if (rom.Type == "rom" && lastrom.Type == "rom")
|
||||
{
|
||||
dupefound = ((rom.Size == lastrom.Size) &&
|
||||
|
||||
Reference in New Issue
Block a user