mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fully integrate stats into DATabase
This commit is contained in:
@@ -78,6 +78,8 @@ namespace SabreTools
|
||||
quotes = false,
|
||||
rem = false,
|
||||
romba = false,
|
||||
single = false,
|
||||
stats = false,
|
||||
superdat = false,
|
||||
trim = false,
|
||||
skip = false,
|
||||
@@ -223,6 +225,14 @@ namespace SabreTools
|
||||
case "--superdat":
|
||||
superdat = true;
|
||||
break;
|
||||
case "-si":
|
||||
case "--single":
|
||||
single = true;
|
||||
break;
|
||||
case "-st":
|
||||
case "--stats":
|
||||
stats = true;
|
||||
break;
|
||||
case "--skip":
|
||||
skip = true;
|
||||
break;
|
||||
@@ -331,7 +341,7 @@ namespace SabreTools
|
||||
|
||||
// If more than one switch is enabled or help is set, show the help screen
|
||||
if (help || !(add ^ (convertMiss || romba) ^ convertCMP ^ convertRC ^ convertSD ^ convertXml ^ extsplit ^ generate ^
|
||||
genall ^ hashsplit ^ import ^ listsrc ^ listsys ^ (merge || diff) ^ rem ^ trim))
|
||||
genall ^ hashsplit ^ import ^ listsrc ^ listsys ^ (merge || diff) ^ rem ^ stats ^ trim))
|
||||
{
|
||||
Build.Help();
|
||||
logger.Close();
|
||||
@@ -340,7 +350,7 @@ namespace SabreTools
|
||||
|
||||
// If a switch that requires a filename is set and no file is, show the help screen
|
||||
if (inputs.Count == 0 && ((convertMiss || romba) || convertCMP || convertRC || convertSD
|
||||
|| convertXml || extsplit || hashsplit || import || (merge || diff) || trim))
|
||||
|| convertXml || extsplit || hashsplit || import || (merge || diff) || stats || trim))
|
||||
{
|
||||
Build.Help();
|
||||
logger.Close();
|
||||
@@ -491,6 +501,12 @@ namespace SabreTools
|
||||
InitHashSplit(inputs, outdir);
|
||||
}
|
||||
|
||||
// Get statistics on input files
|
||||
else if (stats)
|
||||
{
|
||||
InitStats(inputs, single);
|
||||
}
|
||||
|
||||
logger.Close();
|
||||
return;
|
||||
}
|
||||
@@ -1729,7 +1745,7 @@ Make a selection:
|
||||
}
|
||||
}
|
||||
|
||||
Stats stats = new Stats(inputs, single, logger);
|
||||
Stats stats = new Stats(newinputs, single, logger);
|
||||
stats.Process();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using SabreTools.Helper;
|
||||
|
||||
@@ -10,7 +9,7 @@ namespace SabreTools
|
||||
/// Get statistics on one or more DAT files
|
||||
/// </summary>
|
||||
/// <remarks>Finish making this a proper object then port to DATabase (-st, --stats)</remarks>
|
||||
public class UncompressedSize
|
||||
public class Stats
|
||||
{
|
||||
// Private instance variables
|
||||
private List<String> _inputs;
|
||||
@@ -23,7 +22,7 @@ namespace SabreTools
|
||||
/// <param name="inputs">List of files and folders to parse</param>
|
||||
/// <param name="single">True if single DAT stats are output, false otherwise</param>
|
||||
/// <param name="logger">Logger object for file and console output</param>
|
||||
public UncompressedSize(List<String> inputs, bool single, Logger logger)
|
||||
public Stats(List<String> inputs, bool single, Logger logger)
|
||||
{
|
||||
_inputs = inputs;
|
||||
_single = single;
|
||||
@@ -115,6 +114,10 @@ namespace SabreTools
|
||||
Roms with Nodump status: " + singleNodump + @"
|
||||
");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.User("Adding stats for file '" + filename + "'");
|
||||
}
|
||||
|
||||
// Add single DAT stats to totals
|
||||
totalSize += singleSize;
|
||||
|
||||
@@ -132,6 +132,8 @@ Options:
|
||||
-rm, --remove Remove a system or source from the database
|
||||
-system= System ID
|
||||
-source= Source ID
|
||||
-st, --stats Get statistics on all input DATs
|
||||
-si, --single Show individual statistics
|
||||
-tm, --trim-merge Consolidate DAT into a single game and trim entries
|
||||
-rd=, --root-dir= Set the root directory for trimming calculation
|
||||
-nr, --no-rename Keep game names instead of using '!'
|
||||
|
||||
Reference in New Issue
Block a user