[SabreTools, SimpleSort] Rename standalone app again, add multithreading to ST versions

This commit is contained in:
Matt Nadareski
2016-10-20 18:05:19 -07:00
parent e48e14fa9e
commit 5037c3c31f
6 changed files with 23 additions and 6 deletions

View File

@@ -192,6 +192,7 @@ namespace SabreTools.Helper
helptext.Add(" -rar={2} Set scanning level for RAR archives"); helptext.Add(" -rar={2} Set scanning level for RAR archives");
helptext.Add(" -zip={0} Set scanning level for ZIP archives"); helptext.Add(" -zip={0} Set scanning level for ZIP archives");
helptext.Add(" -ud, --update-dat Output updated DAT"); helptext.Add(" -ud, --update-dat Output updated DAT");
helptext.Add(" -mt={4} Amount of threads to use (-1 unlimted)");
// Stats // Stats
helptext.Add(" -st, --stats Get statistics on all input DATs"); helptext.Add(" -st, --stats Get statistics on all input DATs");
@@ -305,6 +306,7 @@ namespace SabreTools.Helper
helptext.Add(" Supported values are:"); helptext.Add(" Supported values are:");
helptext.Add(" None, Good, BadDump, Nodump, Verified, NotNodump"); helptext.Add(" None, Good, BadDump, Nodump, Verified, NotNodump");
helptext.Add(" -out= Output directory (overridden by --inplace)"); helptext.Add(" -out= Output directory (overridden by --inplace)");
helptext.Add(" -mt={4} Amount of threads to use (-1 unlimted)");
// Verify // Verify
helptext.Add(" -ve, --verify Verify a folder against DATs"); helptext.Add(" -ve, --verify Verify a folder against DATs");
@@ -329,7 +331,7 @@ namespace SabreTools.Helper
helptext.Add("Filter parameters for size can use postfixes for inputs:"); helptext.Add("Filter parameters for size can use postfixes for inputs:");
helptext.Add(" e.g. 8kb => 8000 or 8kib => 8192"); helptext.Add(" e.g. 8kb => 8000 or 8kib => 8192");
break; break;
case "SimpleSortApp": case "SimpleSort":
helptext.Add(Resources.Resources.SimpleSort_Name + " - " + Resources.Resources.SimpleSort_Desc); helptext.Add(Resources.Resources.SimpleSort_Name + " - " + Resources.Resources.SimpleSort_Desc);
helptext.Add(barrier); helptext.Add(barrier);
helptext.Add(Resources.Resources.Usage + ": " + Resources.Resources.SimpleSort_Name + " [options] [filename|dirname] ..."); helptext.Add(Resources.Resources.Usage + ": " + Resources.Resources.SimpleSort_Name + " [options] [filename|dirname] ...");

View File

@@ -458,6 +458,12 @@ Options:
0 Hash both archive and its contents 0 Hash both archive and its contents
1 Only hash contents of the archive 1 Only hash contents of the archive
2 Only hash archive itself (treat like a regular file) 2 Only hash archive itself (treat like a regular file)
-mt={4} Amount of threads to use
Optionally, set the number of threads to use for the multithreaded operations.
The default is 4 threads; -1 means unlimited threads created. If the user specifies
that only 1 thread is to be used, it defaults to the original, serial implementation
of the DFD code.
-ud, --update-dat Output updated DAT (rebuild only) -ud, --update-dat Output updated DAT (rebuild only)
Once the files that were able to rebuilt are taken care of, a DAT of the files Once the files that were able to rebuilt are taken care of, a DAT of the files
@@ -793,6 +799,12 @@ Options:
This sets an output folder to be used when the files are created. If a path This sets an output folder to be used when the files are created. If a path
is not defined, the application directory is used instead. is not defined, the application directory is used instead.
-mt={4} Amount of threads to use
Optionally, set the number of threads to use for the multithreaded operations.
The default is 4 threads; -1 means unlimited threads created. If the user specifies
that only 1 thread is to be used, it defaults to the original, serial implementation
of the DFD code.
-ve, --verify Verify a folder against an input DAT -ve, --verify Verify a folder against an input DAT
When used, this will use an input DAT or set of DATs to blindly check against an input When used, this will use an input DAT or set of DATs to blindly check against an input
folder. The base of the folder is considered the base for the combined DATs and games are folder. The base of the folder is considered the base for the combined DATs and games are

View File

@@ -306,8 +306,10 @@ namespace SabreTools
/// <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="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="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param> /// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan, bool date, private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan, bool date,
bool toFolder, bool delete, bool tgz, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst) bool toFolder, bool delete, bool tgz, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst,
int maxDegreeOfParallelism)
{ {
// Get the archive scanning level // Get the archive scanning level
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip); ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
@@ -323,7 +325,8 @@ namespace SabreTools
} }
_logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); _logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
FileTools.RebuildToOutput(datdata, inputs, outDir, tempDir, quickScan, date, toFolder, delete, tgz, romba, asl, updateDat, headerToCheckAgainst, 4, _logger); FileTools.RebuildToOutput(datdata, inputs, outDir, tempDir, quickScan, date, toFolder, delete, tgz, romba, asl,
updateDat, headerToCheckAgainst, maxDegreeOfParallelism, _logger);
} }
/// <summary> /// <summary>

View File

@@ -981,7 +981,7 @@ namespace SabreTools
else if (sort) else if (sort)
{ {
InitSort(datfiles, inputs, outDir, tempDir, quickScan, addFileDates, toFolder, InitSort(datfiles, inputs, outDir, tempDir, quickScan, addFileDates, toFolder,
delete, tgz, romba, sevenzip, gz, rar, zip, updateDat, header); delete, tgz, romba, sevenzip, gz, rar, zip, updateDat, header, maxParallelism);
} }
// Split a DAT by extension // Split a DAT by extension

View File

@@ -5,7 +5,7 @@ using System.IO;
namespace SabreTools namespace SabreTools
{ {
public class SimpleSortApp public class SimpleSort
{ {
/// <summary> /// <summary>
/// Main entry point for the program /// Main entry point for the program

View File

@@ -67,7 +67,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="SimpleSortApp.cs" /> <Compile Include="SimpleSort.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>