diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs index a37955b6..be7318f9 100644 --- a/SabreTools/Partials/SabreTools_Inits.cs +++ b/SabreTools/Partials/SabreTools_Inits.cs @@ -12,8 +12,9 @@ namespace SabreTools #region Init Methods /// - /// Wrap sorting files using an input DAT + /// Wrap converting a folder to TGZ, optionally filtering by an input DAT(s) /// + /// Names of the DATs to compare against /// List of all inputted files and folders /// Output directory (empty for default directory) /// Temporary directory for archive extraction @@ -24,10 +25,17 @@ namespace SabreTools /// Integer representing the archive handling level for RAR /// Integer representing the archive handling level for Zip /// Logger object for file and console output - public static bool InitConvertFolderTGZ(List inputs, string outDir, string tempDir, bool delete, + public static bool InitConvertFolderTGZ(List datfiles, List inputs, string outDir, string tempDir, bool delete, 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); // 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(); } @@ -298,7 +307,7 @@ namespace SabreTools DatFile datdata = new DatFile(); 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, diff --git a/SimpleSort/SimpleSortApp.cs b/SimpleSort/SimpleSortApp.cs index e3e0c18c..3e35ca6f 100644 --- a/SimpleSort/SimpleSortApp.cs +++ b/SimpleSort/SimpleSortApp.cs @@ -197,7 +197,7 @@ namespace SabreTools // If we are converting the folder to TGZ 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 @@ -227,6 +227,55 @@ namespace SabreTools return; } + /// + /// Wrap converting a folder to TGZ, optionally filtering by an input DAT(s) + /// + /// Names of the DATs to compare against + /// List of all inputted files and folders + /// Output directory (empty for default directory) + /// Temporary directory for archive extraction + /// True if input files should be deleted, false otherwise + /// True if files should be output in Romba depot folders, false otherwise + /// Integer representing the archive handling level for 7z + /// Integer representing the archive handling level for GZip + /// Integer representing the archive handling level for RAR + /// Integer representing the archive handling level for Zip + /// Logger object for file and console output + public static bool InitConvertFolderTGZ(List datfiles, List 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 newinputs = new List(); + 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(); + } + /// /// Wrap sorting files using an input DAT /// @@ -263,46 +312,5 @@ namespace SabreTools delete, torrentX, romba, asl, updateDat, logger); ss.StartProcessing(); } - - /// - /// Wrap sorting files using an input DAT - /// - /// List of all inputted files and folders - /// Output directory (empty for default directory) - /// Temporary directory for archive extraction - /// True if input files should be deleted, false otherwise - /// True if files should be output in Romba depot folders, false otherwise - /// Integer representing the archive handling level for 7z - /// Integer representing the archive handling level for GZip - /// Integer representing the archive handling level for RAR - /// Integer representing the archive handling level for Zip - /// Logger object for file and console output - public static bool InitConvertFolderTGZ(List 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 newinputs = new List(); - 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(); - } } } \ No newline at end of file