mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SimpleSort] Add quick scanning as a flag
This commit is contained in:
@@ -235,6 +235,7 @@ Options:
|
|||||||
-dat= Input DAT to rebuild against (REQUIRED)
|
-dat= Input DAT to rebuild against (REQUIRED)
|
||||||
-out= Output directory
|
-out= Output directory
|
||||||
-t=, --temp= Set the temporary directory to use
|
-t=, --temp= Set the temporary directory to use
|
||||||
|
-qs, --quick Enable quick scanning of archives
|
||||||
-7z={0} Set scanning level for 7z archives
|
-7z={0} Set scanning level for 7z archives
|
||||||
-gz={2} Set scanning level for GZip archives
|
-gz={2} Set scanning level for GZip archives
|
||||||
-rar={2} Set scanning level for RAR archives
|
-rar={2} Set scanning level for RAR archives
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace SabreTools
|
|||||||
private List<string> _inputs;
|
private List<string> _inputs;
|
||||||
private string _outdir;
|
private string _outdir;
|
||||||
private string _tempdir;
|
private string _tempdir;
|
||||||
|
private bool _externalScan;
|
||||||
private ArchiveScanLevel _7z;
|
private ArchiveScanLevel _7z;
|
||||||
private ArchiveScanLevel _gz;
|
private ArchiveScanLevel _gz;
|
||||||
private ArchiveScanLevel _rar;
|
private ArchiveScanLevel _rar;
|
||||||
@@ -27,18 +28,20 @@ namespace SabreTools
|
|||||||
/// <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="tempdir">Temporary directory for archive extraction</param>
|
||||||
|
/// <param name="externalScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="sevenzip">Integer representing the archive handling level for 7z</param>
|
/// <param name="sevenzip">Integer representing the archive handling level for 7z</param>
|
||||||
/// <param name="gz">Integer representing the archive handling level for GZip</param>
|
/// <param name="gz">Integer representing the archive handling level for GZip</param>
|
||||||
/// <param name="rar">Integer representing the archive handling level for RAR</param>
|
/// <param name="rar">Integer representing the archive handling level for RAR</param>
|
||||||
/// <param name="zip">Integer representing the archive handling level for Zip</param>
|
/// <param name="zip">Integer representing the archive handling level for Zip</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
public SimpleSort(DatData datdata, List<string> inputs, string outdir, string tempdir,
|
public SimpleSort(DatData datdata, List<string> inputs, string outdir, string tempdir,
|
||||||
int sevenzip, int gz, int rar, int zip, Logger logger)
|
bool externalScan, int sevenzip, int gz, int rar, int zip, Logger logger)
|
||||||
{
|
{
|
||||||
_datdata = datdata;
|
_datdata = datdata;
|
||||||
_inputs = inputs;
|
_inputs = inputs;
|
||||||
_outdir = (outdir == "" ? "Rebuild" : outdir);
|
_outdir = (outdir == "" ? "Rebuild" : outdir);
|
||||||
_tempdir = (tempdir == "" ? "__TEMP__" : tempdir);
|
_tempdir = (tempdir == "" ? "__TEMP__" : tempdir);
|
||||||
|
_externalScan = externalScan;
|
||||||
_7z = (ArchiveScanLevel)(sevenzip < 0 || sevenzip > 2 ? 0 : sevenzip);
|
_7z = (ArchiveScanLevel)(sevenzip < 0 || sevenzip > 2 ? 0 : sevenzip);
|
||||||
_gz = (ArchiveScanLevel)(gz < 0 || gz > 2 ? 0 : gz);
|
_gz = (ArchiveScanLevel)(gz < 0 || gz > 2 ? 0 : gz);
|
||||||
_rar = (ArchiveScanLevel)(rar < 0 || rar > 2 ? 0 : rar);
|
_rar = (ArchiveScanLevel)(rar < 0 || rar > 2 ? 0 : rar);
|
||||||
@@ -83,6 +86,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
// Set all default values
|
// Set all default values
|
||||||
bool help = false,
|
bool help = false,
|
||||||
|
externalScan = false,
|
||||||
simpleSort = true;
|
simpleSort = true;
|
||||||
int sevenzip = 0,
|
int sevenzip = 0,
|
||||||
gz = 2,
|
gz = 2,
|
||||||
@@ -103,6 +107,10 @@ namespace SabreTools
|
|||||||
case "--help":
|
case "--help":
|
||||||
help = true;
|
help = true;
|
||||||
break;
|
break;
|
||||||
|
case "-qs":
|
||||||
|
case "--quick":
|
||||||
|
externalScan = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
string temparg = arg.Replace("\"", "").Replace("file://", "");
|
string temparg = arg.Replace("\"", "").Replace("file://", "");
|
||||||
|
|
||||||
@@ -192,7 +200,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
if (datfile != "")
|
if (datfile != "")
|
||||||
{
|
{
|
||||||
InitSimpleSort(datfile, inputs, outdir, tempdir, sevenzip, gz, rar, zip, logger);
|
InitSimpleSort(datfile, inputs, outdir, tempdir, externalScan, sevenzip, gz, rar, zip, logger);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -220,18 +228,19 @@ namespace SabreTools
|
|||||||
/// <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="tempdir">Temporary directory for archive extraction</param>
|
||||||
|
/// <param name="externalScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="sevenzip">Integer representing the archive handling level for 7z</param>
|
/// <param name="sevenzip">Integer representing the archive handling level for 7z</param>
|
||||||
/// <param name="gz">Integer representing the archive handling level for GZip</param>
|
/// <param name="gz">Integer representing the archive handling level for GZip</param>
|
||||||
/// <param name="rar">Integer representing the archive handling level for RAR</param>
|
/// <param name="rar">Integer representing the archive handling level for RAR</param>
|
||||||
/// <param name="zip">Integer representing the archive handling level for Zip</param>
|
/// <param name="zip">Integer representing the archive handling level for Zip</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
private static void InitSimpleSort(string datfile, List<string> inputs, string outdir, string tempdir,
|
private static void InitSimpleSort(string datfile, List<string> inputs, string outdir, string tempdir,
|
||||||
int sevenzip, int gz, int rar, int zip, Logger logger)
|
bool externalScan, int sevenzip, int gz, int rar, int zip, Logger logger)
|
||||||
{
|
{
|
||||||
DatData datdata = new DatData();
|
DatData datdata = new DatData();
|
||||||
datdata = DatTools.Parse(datfile, 0, 0, datdata, logger);
|
datdata = DatTools.Parse(datfile, 0, 0, datdata, logger);
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(datdata, inputs, outdir, tempdir, sevenzip, gz, rar, zip, logger);
|
SimpleSort ss = new SimpleSort(datdata, inputs, outdir, tempdir, externalScan, sevenzip, gz, rar, zip, logger);
|
||||||
ss.Process();
|
ss.Process();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,9 +409,8 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TODO: Implement flag for external scanning only
|
// If external scanning is enabled, use that method instead
|
||||||
bool externalScan = true;
|
if (_externalScan)
|
||||||
if (externalScan)
|
|
||||||
{
|
{
|
||||||
_logger.Log("Beginning quick scan of contents from '" + input + "'");
|
_logger.Log("Beginning quick scan of contents from '" + input + "'");
|
||||||
List<RomData> internalRomData = ArchiveTools.GetArchiveFileInfo(input, _logger);
|
List<RomData> internalRomData = ArchiveTools.GetArchiveFileInfo(input, _logger);
|
||||||
|
|||||||
Reference in New Issue
Block a user