mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SimpleSort, ALL] Consolodate ArchiveScanLevel to a single flag
This commit is contained in:
@@ -140,16 +140,6 @@
|
|||||||
ERROR,
|
ERROR,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines the level to scan archives at
|
|
||||||
/// </summary>
|
|
||||||
public enum ArchiveScanLevel
|
|
||||||
{
|
|
||||||
Both = 0,
|
|
||||||
Internal,
|
|
||||||
External,
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Archival
|
#region Archival
|
||||||
|
|||||||
@@ -92,6 +92,33 @@ namespace SabreTools.Helper
|
|||||||
Bit2 = 0x0004,
|
Bit2 = 0x0004,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines the level to scan archives at
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum ArchiveScanLevel
|
||||||
|
{
|
||||||
|
// 7zip
|
||||||
|
SevenZipExternal = 0x0001,
|
||||||
|
SevenZipInternal = 0x0002,
|
||||||
|
SevenZipBoth = SevenZipExternal | SevenZipInternal,
|
||||||
|
|
||||||
|
// GZip
|
||||||
|
GZipExternal = 0x0010,
|
||||||
|
GZipInternal = 0x0020,
|
||||||
|
GZipBoth = GZipExternal | GZipInternal,
|
||||||
|
|
||||||
|
// RAR
|
||||||
|
RarExternal = 0x0100,
|
||||||
|
RarInternal = 0x0200,
|
||||||
|
RarBoth = RarExternal | RarInternal,
|
||||||
|
|
||||||
|
// Zip
|
||||||
|
ZipExternal = 0x1000,
|
||||||
|
ZipInternal = 0x2000,
|
||||||
|
ZipBoth = ZipExternal | ZipInternal,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Zipfile special status
|
/// Zipfile special status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4913,13 +4913,12 @@ namespace SabreTools.Helper
|
|||||||
// Otherwise, attempt to extract the files to the temporary directory
|
// Otherwise, attempt to extract the files to the temporary directory
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool encounteredErrors = ArchiveTools.ExtractArchive(newItem,
|
ArchiveScanLevel asl = (archivesAsFiles ? ArchiveScanLevel.SevenZipExternal : ArchiveScanLevel.SevenZipInternal)
|
||||||
tempSubDir,
|
| (!archivesAsFiles && enableGzip ? ArchiveScanLevel.GZipInternal : ArchiveScanLevel.GZipExternal)
|
||||||
(archivesAsFiles ? ArchiveScanLevel.External : ArchiveScanLevel.Internal),
|
| (archivesAsFiles ? ArchiveScanLevel.RarExternal : ArchiveScanLevel.RarInternal)
|
||||||
(!archivesAsFiles && enableGzip ? ArchiveScanLevel.Internal : ArchiveScanLevel.External),
|
| (archivesAsFiles ? ArchiveScanLevel.ZipExternal : ArchiveScanLevel.ZipInternal);
|
||||||
(archivesAsFiles ? ArchiveScanLevel.External : ArchiveScanLevel.Internal),
|
|
||||||
(archivesAsFiles ? ArchiveScanLevel.External : ArchiveScanLevel.Internal),
|
bool encounteredErrors = ArchiveTools.ExtractArchive(newItem, tempSubDir, asl, logger);
|
||||||
logger);
|
|
||||||
|
|
||||||
// If the file was an archive and was extracted successfully, check it
|
// If the file was an archive and was extracted successfully, check it
|
||||||
if (!encounteredErrors)
|
if (!encounteredErrors)
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ namespace SabreTools.Helper
|
|||||||
private bool? _torrentX; // True is for TorrentZip, False is for TorrentGZ, Null is for standard zip
|
private bool? _torrentX; // True is for TorrentZip, False is for TorrentGZ, Null is for standard zip
|
||||||
private bool _romba;
|
private bool _romba;
|
||||||
private bool _updateDat;
|
private bool _updateDat;
|
||||||
private ArchiveScanLevel _7z;
|
private ArchiveScanLevel _archiveScanLevel;
|
||||||
private ArchiveScanLevel _gz;
|
|
||||||
private ArchiveScanLevel _rar;
|
|
||||||
private ArchiveScanLevel _zip;
|
|
||||||
private Logger _logger;
|
private Logger _logger;
|
||||||
private int _maxDegreeOfParallelism = 4; // Hardcoded for now, should be an input later
|
private int _maxDegreeOfParallelism = 4; // Hardcoded for now, should be an input later
|
||||||
|
|
||||||
@@ -45,15 +42,12 @@ namespace SabreTools.Helper
|
|||||||
/// <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="torrentX">True is for TorrentZip, False is for TorrentGZ, Null is for standard zip</param>
|
/// <param name="torrentX">True is for TorrentZip, False is for TorrentGZ, Null is for standard zip</param>
|
||||||
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
|
||||||
/// <param name="sevenzip">Integer representing the archive handling level for 7z</param>
|
/// <param name="archiveScanLevel">ArchiveScanLevel representing the archive handling levels</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="zip">Integer representing the archive handling level for Zip</param>
|
|
||||||
/// <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="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
public SimpleSort(DatFile datdata, List<string> inputs, string outDir, string tempDir,
|
public SimpleSort(DatFile datdata, List<string> inputs, string outDir, string tempDir,
|
||||||
bool quickScan, bool toFolder, bool verify, bool delete, bool? torrentX, bool romba, int sevenzip,
|
bool quickScan, bool toFolder, bool verify, bool delete, bool? torrentX, bool romba,
|
||||||
int gz, int rar, int zip, bool updateDat, Logger logger)
|
ArchiveScanLevel archiveScanLevel, bool updateDat, Logger logger)
|
||||||
{
|
{
|
||||||
_datdata = datdata;
|
_datdata = datdata;
|
||||||
_inputs = inputs;
|
_inputs = inputs;
|
||||||
@@ -65,10 +59,7 @@ namespace SabreTools.Helper
|
|||||||
_delete = delete;
|
_delete = delete;
|
||||||
_torrentX = torrentX;
|
_torrentX = torrentX;
|
||||||
_romba = romba;
|
_romba = romba;
|
||||||
_7z = (ArchiveScanLevel)(sevenzip < 0 || sevenzip > 2 ? 0 : sevenzip);
|
_archiveScanLevel = archiveScanLevel;
|
||||||
_gz = (ArchiveScanLevel)(gz < 0 || gz > 2 ? 0 : gz);
|
|
||||||
_rar = (ArchiveScanLevel)(rar < 0 || rar > 2 ? 0 : rar);
|
|
||||||
_zip = (ArchiveScanLevel)(zip < 0 || zip > 2 ? 0 : zip);
|
|
||||||
_updateDat = updateDat;
|
_updateDat = updateDat;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
@@ -300,7 +291,7 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
// Get if the file should be scanned internally and externally
|
// Get if the file should be scanned internally and externally
|
||||||
bool shouldExternalScan, shouldInternalScan;
|
bool shouldExternalScan, shouldInternalScan;
|
||||||
ArchiveTools.GetInternalExternalProcess(input, _7z, _gz, _rar, _zip, _logger, out shouldExternalScan, out shouldInternalScan);
|
ArchiveTools.GetInternalExternalProcess(input, _archiveScanLevel, _logger, out shouldExternalScan, out shouldInternalScan);
|
||||||
|
|
||||||
// Hash and match the external files
|
// Hash and match the external files
|
||||||
if (shouldExternalScan)
|
if (shouldExternalScan)
|
||||||
@@ -598,7 +589,7 @@ namespace SabreTools.Helper
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Now, if the file is a supported archive type, also run on all files within
|
// Now, if the file is a supported archive type, also run on all files within
|
||||||
bool encounteredErrors = ArchiveTools.ExtractArchive(input, _tempDir, _7z, _gz, _rar, _zip, _logger);
|
bool encounteredErrors = ArchiveTools.ExtractArchive(input, _tempDir, _archiveScanLevel, _logger);
|
||||||
|
|
||||||
// Remove the current file if we are in recursion so it's not picked up in the next step
|
// Remove the current file if we are in recursion so it's not picked up in the next step
|
||||||
if (recurse)
|
if (recurse)
|
||||||
@@ -698,7 +689,7 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
// Get if the file should be scanned internally and externally
|
// Get if the file should be scanned internally and externally
|
||||||
bool shouldExternalScan, shouldInternalScan;
|
bool shouldExternalScan, shouldInternalScan;
|
||||||
ArchiveTools.GetInternalExternalProcess(file, _7z, _gz, _rar, _zip, _logger, out shouldExternalScan, out shouldInternalScan);
|
ArchiveTools.GetInternalExternalProcess(file, _archiveScanLevel, _logger, out shouldExternalScan, out shouldInternalScan);
|
||||||
|
|
||||||
// Hash and match the external files
|
// Hash and match the external files
|
||||||
if (shouldExternalScan)
|
if (shouldExternalScan)
|
||||||
@@ -726,7 +717,7 @@ namespace SabreTools.Helper
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Now, if the file is a supported archive type, also run on all files within
|
// Now, if the file is a supported archive type, also run on all files within
|
||||||
bool encounteredErrors = ArchiveTools.ExtractArchive(file, _tempDir, _7z, _gz, _rar, _zip, _logger);
|
bool encounteredErrors = ArchiveTools.ExtractArchive(file, _tempDir, _archiveScanLevel, _logger);
|
||||||
|
|
||||||
// If we succeeded in extracting, loop through the files
|
// If we succeeded in extracting, loop through the files
|
||||||
if (!encounteredErrors)
|
if (!encounteredErrors)
|
||||||
@@ -1035,7 +1026,7 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
// Get if the file should be scanned internally and externally
|
// Get if the file should be scanned internally and externally
|
||||||
bool shouldExternalProcess, shouldInternalProcess;
|
bool shouldExternalProcess, shouldInternalProcess;
|
||||||
ArchiveTools.GetInternalExternalProcess(input, _7z, _gz, _rar, _zip, _logger, out shouldExternalProcess, out shouldInternalProcess);
|
ArchiveTools.GetInternalExternalProcess(input, _archiveScanLevel, _logger, out shouldExternalProcess, out shouldInternalProcess);
|
||||||
|
|
||||||
// Do an external scan of the file, if necessary
|
// Do an external scan of the file, if necessary
|
||||||
if (shouldExternalProcess)
|
if (shouldExternalProcess)
|
||||||
@@ -1059,7 +1050,7 @@ namespace SabreTools.Helper
|
|||||||
if (shouldInternalProcess)
|
if (shouldInternalProcess)
|
||||||
{
|
{
|
||||||
// Now, if the file is a supported archive type, also run on all files within
|
// Now, if the file is a supported archive type, also run on all files within
|
||||||
bool encounteredErrors = ArchiveTools.ExtractArchive(input, _tempDir, _7z, _gz, _rar, _zip, _logger);
|
bool encounteredErrors = ArchiveTools.ExtractArchive(input, _tempDir, _archiveScanLevel, _logger);
|
||||||
|
|
||||||
// If no errors were encountered, we loop through the temp directory
|
// If no errors were encountered, we loop through the temp directory
|
||||||
if (!encounteredErrors)
|
if (!encounteredErrors)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace SabreTools.Helper
|
|||||||
/// <returns>True if the extraction was a success, false otherwise</returns>
|
/// <returns>True if the extraction was a success, false otherwise</returns>
|
||||||
public static bool ExtractArchive(string input, string tempDir, Logger logger)
|
public static bool ExtractArchive(string input, string tempDir, Logger logger)
|
||||||
{
|
{
|
||||||
return ExtractArchive(input, tempDir, ArchiveScanLevel.Both, ArchiveScanLevel.External, ArchiveScanLevel.External, ArchiveScanLevel.Both, logger);
|
return ExtractArchive(input, tempDir, GetArchiveScanLevelFromNumbers(0, 2, 2, 0), logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -77,30 +77,10 @@ namespace SabreTools.Helper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input">Name of the file to be extracted</param>
|
/// <param name="input">Name of the file to be extracted</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
||||||
/// <param name="sevenzip">Integer representing the archive handling level for 7z</param>
|
/// <param name="archiveScanLevel">ArchiveScanLevel representing the archive handling levels</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="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>
|
||||||
/// <returns>True if the extraction was a success, false otherwise</returns>
|
/// <returns>True if the extraction was a success, false otherwise</returns>
|
||||||
public static bool ExtractArchive(string input, string tempDir, int sevenzip, int gz, int rar, int zip, Logger logger)
|
public static bool ExtractArchive(string input, string tempDir, ArchiveScanLevel archiveScanLevel, Logger logger)
|
||||||
{
|
|
||||||
return ExtractArchive(input, tempDir, (ArchiveScanLevel)sevenzip, (ArchiveScanLevel)gz, (ArchiveScanLevel)rar, (ArchiveScanLevel)zip, logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempt to extract a file as an archive
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">Name of the file to be extracted</param>
|
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="sevenzip">Archive handling level for 7z</param>
|
|
||||||
/// <param name="gz">Archive handling level for GZip</param>
|
|
||||||
/// <param name="rar">Archive handling level for RAR</param>
|
|
||||||
/// <param name="zip">Archive handling level for Zip</param>
|
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
|
||||||
/// <returns>True if the extraction was a success, false otherwise</returns>
|
|
||||||
public static bool ExtractArchive(string input, string tempDir, ArchiveScanLevel sevenzip,
|
|
||||||
ArchiveScanLevel gz, ArchiveScanLevel rar, ArchiveScanLevel zip, Logger logger)
|
|
||||||
{
|
{
|
||||||
bool encounteredErrors = true;
|
bool encounteredErrors = true;
|
||||||
|
|
||||||
@@ -115,7 +95,7 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (at == ArchiveType.SevenZip && sevenzip != ArchiveScanLevel.External)
|
if (at == ArchiveType.SevenZip && (archiveScanLevel & ArchiveScanLevel.SevenZipInternal) != 0)
|
||||||
{
|
{
|
||||||
logger.Verbose("Found archive of type: " + at);
|
logger.Verbose("Found archive of type: " + at);
|
||||||
|
|
||||||
@@ -132,7 +112,7 @@ namespace SabreTools.Helper
|
|||||||
sza.Dispose();
|
sza.Dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (at == ArchiveType.GZip && gz != ArchiveScanLevel.External)
|
else if (at == ArchiveType.GZip && (archiveScanLevel & ArchiveScanLevel.GZipInternal) != 0)
|
||||||
{
|
{
|
||||||
logger.Verbose("Found archive of type: " + at);
|
logger.Verbose("Found archive of type: " + at);
|
||||||
|
|
||||||
@@ -150,8 +130,8 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
encounteredErrors = false;
|
encounteredErrors = false;
|
||||||
}
|
}
|
||||||
else if ((at == ArchiveType.Zip && zip != ArchiveScanLevel.External)
|
else if ((at == ArchiveType.Zip && (archiveScanLevel & ArchiveScanLevel.ZipInternal) != 0)
|
||||||
|| (at == ArchiveType.Rar && rar != ArchiveScanLevel.External))
|
|| (at == ArchiveType.Rar && (archiveScanLevel & ArchiveScanLevel.RarInternal) != 0))
|
||||||
{
|
{
|
||||||
logger.Verbose("Found archive of type: " + at);
|
logger.Verbose("Found archive of type: " + at);
|
||||||
|
|
||||||
@@ -522,15 +502,12 @@ namespace SabreTools.Helper
|
|||||||
/// Get if the current file should be scanned internally and externally
|
/// Get if the current file should be scanned internally and externally
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input">Name of the input file to check</param>
|
/// <param name="input">Name of the input file to check</param>
|
||||||
/// <param name="sevenzip">User-defined scan level for 7z archives</param>
|
/// <param name="archiveScanLevel">ArchiveScanLevel representing the archive handling levels</param>
|
||||||
/// <param name="gzip">User-defined scan level for GZ archives</param>
|
|
||||||
/// <param name="rar">User-defined scan level for RAR archives</param>
|
|
||||||
/// <param name="zip">User-defined scan level for Zip archives</param>
|
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
/// <param name="shouldExternalProcess">Output parameter determining if file should be processed externally</param>
|
/// <param name="shouldExternalProcess">Output parameter determining if file should be processed externally</param>
|
||||||
/// <param name="shouldInternalProcess">Output parameter determining if file should be processed internally</param>
|
/// <param name="shouldInternalProcess">Output parameter determining if file should be processed internally</param>
|
||||||
public static void GetInternalExternalProcess(string input, ArchiveScanLevel sevenzip, ArchiveScanLevel gzip,
|
public static void GetInternalExternalProcess(string input, ArchiveScanLevel archiveScanLevel,
|
||||||
ArchiveScanLevel rar, ArchiveScanLevel zip, Logger logger, out bool shouldExternalProcess, out bool shouldInternalProcess)
|
Logger logger, out bool shouldExternalProcess, out bool shouldInternalProcess)
|
||||||
{
|
{
|
||||||
shouldExternalProcess = true;
|
shouldExternalProcess = true;
|
||||||
shouldInternalProcess = true;
|
shouldInternalProcess = true;
|
||||||
@@ -543,24 +520,99 @@ namespace SabreTools.Helper
|
|||||||
shouldInternalProcess = false;
|
shouldInternalProcess = false;
|
||||||
break;
|
break;
|
||||||
case ArchiveType.GZip:
|
case ArchiveType.GZip:
|
||||||
shouldExternalProcess = (gzip != ArchiveScanLevel.Internal);
|
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.GZipExternal) != 0);
|
||||||
shouldInternalProcess = (gzip != ArchiveScanLevel.External);
|
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.GZipInternal) != 0);
|
||||||
break;
|
break;
|
||||||
case ArchiveType.Rar:
|
case ArchiveType.Rar:
|
||||||
shouldExternalProcess = (rar != ArchiveScanLevel.Internal);
|
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.RarExternal) != 0);
|
||||||
shouldInternalProcess = (rar != ArchiveScanLevel.External);
|
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.RarInternal) != 0);
|
||||||
break;
|
break;
|
||||||
case ArchiveType.SevenZip:
|
case ArchiveType.SevenZip:
|
||||||
shouldExternalProcess = (sevenzip != ArchiveScanLevel.Internal);
|
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.SevenZipExternal) != 0);
|
||||||
shouldInternalProcess = (sevenzip != ArchiveScanLevel.External);
|
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.SevenZipInternal) != 0);
|
||||||
break;
|
break;
|
||||||
case ArchiveType.Zip:
|
case ArchiveType.Zip:
|
||||||
shouldExternalProcess = (zip != ArchiveScanLevel.Internal);
|
shouldExternalProcess = ((archiveScanLevel & ArchiveScanLevel.ZipExternal) != 0);
|
||||||
shouldInternalProcess = (zip != ArchiveScanLevel.External);
|
shouldInternalProcess = ((archiveScanLevel & ArchiveScanLevel.ZipInternal) != 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the archive scan level based on the inputs
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sevenzip">User-defined scan level for 7z archives</param>
|
||||||
|
/// <param name="gzip">User-defined scan level for GZ archives</param>
|
||||||
|
/// <param name="rar">User-defined scan level for RAR archives</param>
|
||||||
|
/// <param name="zip">User-defined scan level for Zip archives</param>
|
||||||
|
/// <returns>ArchiveScanLevel representing the levels</returns>
|
||||||
|
public static ArchiveScanLevel GetArchiveScanLevelFromNumbers(int sevenzip, int gzip, int rar, int zip)
|
||||||
|
{
|
||||||
|
ArchiveScanLevel archiveScanLevel = 0x0000;
|
||||||
|
|
||||||
|
// 7z
|
||||||
|
sevenzip = (sevenzip < 0 || sevenzip > 2 ? 0 : sevenzip);
|
||||||
|
switch (sevenzip)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.SevenZipBoth;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.SevenZipInternal;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.SevenZipExternal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GZip
|
||||||
|
gzip = (gzip < 0 || gzip > 2 ? 0 : gzip);
|
||||||
|
switch (gzip)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.GZipBoth;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.GZipInternal;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.GZipExternal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// RAR
|
||||||
|
rar = (rar < 0 || rar > 2 ? 0 : rar);
|
||||||
|
switch (rar)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.RarBoth;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.RarInternal;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.RarExternal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zip
|
||||||
|
zip = (zip < 0 || zip > 2 ? 0 : zip);
|
||||||
|
switch (zip)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.ZipBoth;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.ZipInternal;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
archiveScanLevel |= ArchiveScanLevel.ZipExternal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return archiveScanLevel;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read the information from an input 7z file
|
/// Read the information from an input 7z file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ namespace SabreTools
|
|||||||
public static bool InitConvertFolderTGZ(List<string> inputs, string outDir, string tempDir, bool delete,
|
public static bool InitConvertFolderTGZ(List<string> inputs, string outDir, string tempDir, bool delete,
|
||||||
bool romba, int sevenzip, int gz, int rar, int zip, Logger logger)
|
bool romba, int sevenzip, int gz, int rar, int zip, Logger logger)
|
||||||
{
|
{
|
||||||
|
// Get the archive scanning levels
|
||||||
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
||||||
|
|
||||||
// Get all individual files from the inputs
|
// Get all individual files from the inputs
|
||||||
List<string> newinputs = new List<string>();
|
List<string> newinputs = new List<string>();
|
||||||
foreach (string input in inputs)
|
foreach (string input in inputs)
|
||||||
@@ -44,7 +47,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(new DatFile(), newinputs, outDir, tempDir, false, false, false, delete, false, romba, sevenzip, gz, rar, zip, false, logger);
|
SimpleSort ss = new SimpleSort(new DatFile(), newinputs, outDir, tempDir, false, false, false, delete, false, romba, asl, false, logger);
|
||||||
return ss.Convert();
|
return ss.Convert();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,6 +291,9 @@ namespace SabreTools
|
|||||||
private static void InitSortVerify(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan,
|
private static void InitSortVerify(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan,
|
||||||
bool toFolder, bool verify, bool delete, bool? torrentX, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, Logger logger)
|
bool toFolder, bool verify, bool delete, bool? torrentX, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, Logger logger)
|
||||||
{
|
{
|
||||||
|
// Get the archive scanning level
|
||||||
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
||||||
|
|
||||||
// Add all of the input DATs into one huge internal DAT
|
// Add all of the input DATs into one huge internal DAT
|
||||||
DatFile datdata = new DatFile();
|
DatFile datdata = new DatFile();
|
||||||
foreach (string datfile in datfiles)
|
foreach (string datfile in datfiles)
|
||||||
@@ -296,7 +302,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
||||||
delete, torrentX, romba, sevenzip, gz, rar, zip, updateDat, logger);
|
delete, torrentX, romba, asl, updateDat, logger);
|
||||||
ss.StartProcessing();
|
ss.StartProcessing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -249,6 +249,9 @@ namespace SabreTools
|
|||||||
private static void InitSortVerify(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan,
|
private static void InitSortVerify(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan,
|
||||||
bool toFolder, bool verify, bool delete, bool? torrentX, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, Logger logger)
|
bool toFolder, bool verify, bool delete, bool? torrentX, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, Logger logger)
|
||||||
{
|
{
|
||||||
|
// Get the archive scanning level
|
||||||
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
||||||
|
|
||||||
// Add all of the input DATs into one huge internal DAT
|
// Add all of the input DATs into one huge internal DAT
|
||||||
DatFile datdata = new DatFile();
|
DatFile datdata = new DatFile();
|
||||||
foreach (string datfile in datfiles)
|
foreach (string datfile in datfiles)
|
||||||
@@ -257,7 +260,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
||||||
delete, torrentX, romba, sevenzip, gz, rar, zip, updateDat, logger);
|
delete, torrentX, romba, asl, updateDat, logger);
|
||||||
ss.StartProcessing();
|
ss.StartProcessing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,6 +280,9 @@ namespace SabreTools
|
|||||||
public static bool InitConvertFolderTGZ(List<string> inputs, string outDir, string tempDir, bool delete,
|
public static bool InitConvertFolderTGZ(List<string> inputs, string outDir, string tempDir, bool delete,
|
||||||
bool romba, int sevenzip, int gz, int rar, int zip, Logger logger)
|
bool romba, int sevenzip, int gz, int rar, int zip, Logger logger)
|
||||||
{
|
{
|
||||||
|
// Get the archive scanning level
|
||||||
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
||||||
|
|
||||||
// Get all individual files from the inputs
|
// Get all individual files from the inputs
|
||||||
List<string> newinputs = new List<string>();
|
List<string> newinputs = new List<string>();
|
||||||
foreach (string input in inputs)
|
foreach (string input in inputs)
|
||||||
@@ -295,7 +301,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(new DatFile(), newinputs, outDir, tempDir, false, false, false,
|
SimpleSort ss = new SimpleSort(new DatFile(), newinputs, outDir, tempDir, false, false, false,
|
||||||
delete, false, romba, sevenzip, gz, rar, zip, false, logger);
|
delete, false, romba, asl, false, logger);
|
||||||
return ss.Convert();
|
return ss.Convert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user