[Output, Stats] Output DAT statistics on DAT write

This commit is contained in:
Matt Nadareski
2016-06-10 02:00:40 -07:00
parent e9d49e260a
commit ffc78b076a
4 changed files with 38 additions and 21 deletions

View File

@@ -116,7 +116,6 @@
<Compile Include="Partials\DATabase_Menus.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TrimMerge.cs" />
<Compile Include="Stats.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />

View File

@@ -24,6 +24,9 @@ namespace SabreTools.Helper
/// </remarks>
public static bool WriteDatfile(DatData datdata, string outDir, Logger logger, bool norename = true)
{
// Output initial statistics, for kicks
Stats.OutputStats(datdata, logger);
// Bucket roms by game name and optionally dedupe
SortedDictionary<string, List<RomData>> sortable = RomManipulation.BucketByGame(datdata.Roms, datdata.MergeRoms, norename, logger);

View File

@@ -102,6 +102,7 @@
<Compile Include="Remapping.cs" />
<Compile Include="RomManipulation.cs" />
<Compile Include="Data\Structs.cs" />
<Compile Include="Stats.cs" />
<Compile Include="Style.cs" />
<Compile Include="Data\Build.cs" />
</ItemGroup>

View File

@@ -57,16 +57,8 @@ namespace SabreTools
if (_single)
{
_logger.User(@"\nFor file '" + filename + @"':
--------------------------------------------------
Uncompressed size: " + Style.GetBytesReadable(datdata.TotalSize) + @"
Games found: " + newroms.Count + @"
Roms found: " + datdata.RomCount + @"
Disks found: " + datdata.DiskCount + @"
Roms with CRC: " + datdata.CRCCount + @"
Roms with MD5: " + datdata.MD5Count + @"
Roms with SHA-1: " + datdata.SHA1Count + @"
Roms with Nodump status: " + datdata.NodumpCount + @"
");
--------------------------------------------------");
OutputStats(datdata, _logger);
}
else
{
@@ -86,20 +78,42 @@ namespace SabreTools
// Output total DAT stats
if (!_single) { _logger.User(""); }
DatData totaldata = new DatData
{
TotalSize = totalSize,
RomCount = totalRom,
DiskCount = totalDisk,
CRCCount = totalCRC,
MD5Count = totalMD5,
SHA1Count = totalSHA1,
NodumpCount = totalNodump,
};
_logger.User(@"For ALL DATs found
--------------------------------------------------
Uncompressed size: " + Style.GetBytesReadable(totalSize) + @"
Games found: " + totalGame + @"
Roms found: " + totalRom + @"
Disks found: " + totalDisk + @"
Roms with CRC: " + totalCRC + @"
Roms with MD5: " + totalMD5 + @"
Roms with SHA-1: " + totalSHA1 + @"
Roms with Nodump status: " + totalNodump + @"
--------------------------------------------------");
OutputStats(totaldata, _logger);
_logger.User(@"
Please check the log folder if the stats scrolled offscreen");
return true;
}
/// <summary>
/// Output the stats in a human-readable format
/// </summary>
/// <param name="datdata">DatData object to read stats from</param>
/// <param name="logger">Logger object for file and console writing</param>
public static void OutputStats(DatData datdata, Logger logger)
{
SortedDictionary<string, List<RomData>> newroms = RomManipulation.BucketByGame(datdata.Roms, false, true, logger);
logger.User(@" Uncompressed size: " + Style.GetBytesReadable(datdata.TotalSize) + @"
Games found: " + newroms.Count + @"
Roms found: " + datdata.RomCount + @"
Disks found: " + datdata.DiskCount + @"
Roms with CRC: " + datdata.CRCCount + @"
Roms with MD5: " + datdata.MD5Count + @"
Roms with SHA-1: " + datdata.SHA1Count + @"
Roms with Nodump status: " + datdata.NodumpCount + @"
");)
}
}
}