mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SimpleSort] Hook up datfile hanndling
This commit is contained in:
@@ -12,8 +12,9 @@ namespace SabreTools
|
|||||||
#region Init Methods
|
#region Init Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wrap sorting files using an input DAT
|
/// Wrap converting a folder to TGZ, optionally filtering by an input DAT(s)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="datfiles">Names of the DATs to compare against</param>
|
||||||
/// <param name="inputs">List of all inputted files and folders</param>
|
/// <param name="inputs">List of all inputted files and folders</param>
|
||||||
/// <param name="outDir">Output directory (empty for default directory)</param>
|
/// <param name="outDir">Output directory (empty for default directory)</param>
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
||||||
@@ -24,10 +25,17 @@ namespace SabreTools
|
|||||||
/// <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 static bool InitConvertFolderTGZ(List<string> inputs, string outDir, string tempDir, bool delete,
|
public static bool InitConvertFolderTGZ(List<string> datfiles, 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
|
// Add all of the input DATs into one huge internal DAT
|
||||||
|
DatFile datdata = new DatFile();
|
||||||
|
foreach (string datfile in datfiles)
|
||||||
|
{
|
||||||
|
datdata.Parse(datfile, 99, 99, logger, keep: true, softlist: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the archive scanning level
|
||||||
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
||||||
|
|
||||||
// Get all individual files from the inputs
|
// Get all individual files from the inputs
|
||||||
@@ -47,7 +55,8 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(new DatFile(), newinputs, outDir, tempDir, false, false, false, delete, false, romba, asl, false, logger);
|
SimpleSort ss = new SimpleSort(datdata, newinputs, outDir, tempDir, false, false, false,
|
||||||
|
delete, false, romba, asl, false, logger);
|
||||||
return ss.Convert();
|
return ss.Convert();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +307,7 @@ namespace SabreTools
|
|||||||
DatFile datdata = new DatFile();
|
DatFile datdata = new DatFile();
|
||||||
foreach (string datfile in datfiles)
|
foreach (string datfile in datfiles)
|
||||||
{
|
{
|
||||||
datdata.Parse(datfile, 99, 99, logger);
|
datdata.Parse(datfile, 99, 99, logger, keep: true, softlist: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ namespace SabreTools
|
|||||||
// If we are converting the folder to TGZ
|
// If we are converting the folder to TGZ
|
||||||
else if (convert)
|
else if (convert)
|
||||||
{
|
{
|
||||||
InitConvertFolderTGZ(inputs, outDir, tempDir, delete, romba, sevenzip, gz, rar, zip, logger);
|
InitConvertFolderTGZ(datfiles, inputs, outDir, tempDir, delete, romba, sevenzip, gz, rar, zip, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are doing a simple sort
|
// If we are doing a simple sort
|
||||||
@@ -227,6 +227,55 @@ namespace SabreTools
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wrap converting a folder to TGZ, optionally filtering by an input DAT(s)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="datfiles">Names of the DATs to compare against</param>
|
||||||
|
/// <param name="inputs">List of all inputted files and folders</param>
|
||||||
|
/// <param name="outDir">Output directory (empty for default directory)</param>
|
||||||
|
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
||||||
|
/// <param name="delete">True if input files should be deleted, 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="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>
|
||||||
|
public static bool InitConvertFolderTGZ(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool delete,
|
||||||
|
bool romba, int sevenzip, int gz, int rar, int zip, Logger logger)
|
||||||
|
{
|
||||||
|
// Add all of the input DATs into one huge internal DAT
|
||||||
|
DatFile datdata = new DatFile();
|
||||||
|
foreach (string datfile in datfiles)
|
||||||
|
{
|
||||||
|
datdata.Parse(datfile, 99, 99, logger, keep: true, softlist: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the archive scanning level
|
||||||
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
||||||
|
|
||||||
|
// Get all individual files from the inputs
|
||||||
|
List<string> newinputs = new List<string>();
|
||||||
|
foreach (string input in inputs)
|
||||||
|
{
|
||||||
|
if (File.Exists(input))
|
||||||
|
{
|
||||||
|
newinputs.Add(Path.GetFullPath(input));
|
||||||
|
}
|
||||||
|
else if (Directory.Exists(input))
|
||||||
|
{
|
||||||
|
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
newinputs.Add(Path.GetFullPath(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleSort ss = new SimpleSort(datdata, newinputs, outDir, tempDir, false, false, false,
|
||||||
|
delete, false, romba, asl, false, logger);
|
||||||
|
return ss.Convert();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wrap sorting files using an input DAT
|
/// Wrap sorting files using an input DAT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -263,46 +312,5 @@ namespace SabreTools
|
|||||||
delete, torrentX, romba, asl, updateDat, logger);
|
delete, torrentX, romba, asl, updateDat, logger);
|
||||||
ss.StartProcessing();
|
ss.StartProcessing();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Wrap sorting files using an input DAT
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inputs">List of all inputted files and folders</param>
|
|
||||||
/// <param name="outDir">Output directory (empty for default directory)</param>
|
|
||||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
|
||||||
/// <param name="delete">True if input files should be deleted, 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="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>
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
// Get the archive scanning level
|
|
||||||
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
|
||||||
|
|
||||||
// Get all individual files from the inputs
|
|
||||||
List<string> newinputs = new List<string>();
|
|
||||||
foreach (string input in inputs)
|
|
||||||
{
|
|
||||||
if (File.Exists(input))
|
|
||||||
{
|
|
||||||
newinputs.Add(Path.GetFullPath(input));
|
|
||||||
}
|
|
||||||
else if (Directory.Exists(input))
|
|
||||||
{
|
|
||||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
newinputs.Add(Path.GetFullPath(file));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(new DatFile(), newinputs, outDir, tempDir, false, false, false,
|
|
||||||
delete, false, romba, asl, false, logger);
|
|
||||||
return ss.Convert();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user