2020-06-10 22:37:19 -07:00
|
|
|
|
using System.IO;
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.Library.Reports
|
|
|
|
|
|
{
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Textfile report format
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
internal class Textfile : BaseReport
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
/// Create a new report from the filename
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="filename">Name of the file to write out to</param>
|
|
|
|
|
|
/// <param name="baddumpCol">True if baddumps should be included in output, false otherwise</param>
|
|
|
|
|
|
/// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
public Textfile(string filename, bool baddumpCol = false, bool nodumpCol = false)
|
|
|
|
|
|
: base(filename, baddumpCol, nodumpCol)
|
2019-02-08 20:53:13 -08:00
|
|
|
|
{
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
/// Create a new report from the stream
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="stream">Output stream to write to</param>
|
|
|
|
|
|
/// <param name="baddumpCol">True if baddumps should be included in output, false otherwise</param>
|
|
|
|
|
|
/// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
public Textfile(Stream stream, bool baddumpCol = false, bool nodumpCol = false)
|
|
|
|
|
|
: base(stream, baddumpCol, nodumpCol)
|
2019-02-08 20:53:13 -08:00
|
|
|
|
{
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Write the report to file
|
|
|
|
|
|
/// </summary>
|
2020-07-15 09:41:59 -07:00
|
|
|
|
public override void Write()
|
2019-02-08 20:53:13 -08:00
|
|
|
|
{
|
2020-07-15 09:41:59 -07:00
|
|
|
|
string line = @"'" + _name + @"':
|
2017-11-07 13:56:15 -08:00
|
|
|
|
--------------------------------------------------
|
2020-12-08 11:09:05 -08:00
|
|
|
|
Uncompressed size: " + GetBytesReadable(_stats.TotalSize) + @"
|
2020-07-15 09:41:59 -07:00
|
|
|
|
Games found: " + _machineCount + @"
|
|
|
|
|
|
Roms found: " + _stats.RomCount + @"
|
|
|
|
|
|
Disks found: " + _stats.DiskCount + @"
|
|
|
|
|
|
Roms with CRC: " + _stats.CRCCount + @"
|
|
|
|
|
|
Roms with MD5: " + _stats.MD5Count
|
|
|
|
|
|
#if NET_FRAMEWORK
|
|
|
|
|
|
+ @"
|
|
|
|
|
|
Roms with RIPEMD160: " + _stats.RIPEMD160Count
|
|
|
|
|
|
#endif
|
|
|
|
|
|
+ @"
|
|
|
|
|
|
Roms with SHA-1: " + _stats.SHA1Count + @"
|
|
|
|
|
|
Roms with SHA-256: " + _stats.SHA256Count + @"
|
|
|
|
|
|
Roms with SHA-384: " + _stats.SHA384Count + @"
|
|
|
|
|
|
Roms with SHA-512: " + _stats.SHA512Count + "\n";
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
if (_baddumpCol)
|
2020-07-15 09:41:59 -07:00
|
|
|
|
line += " Roms with BadDump status: " + _stats.BaddumpCount + "\n";
|
2020-06-10 22:37:19 -07:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
if (_nodumpCol)
|
2020-07-15 09:41:59 -07:00
|
|
|
|
line += " Roms with Nodump status: " + _stats.NodumpCount + "\n";
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
// For spacing between DATs
|
|
|
|
|
|
line += "\n\n";
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
_writer.Write(line);
|
|
|
|
|
|
_writer.Flush();
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Write out the header to the stream, if any exists
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override void WriteHeader()
|
|
|
|
|
|
{
|
|
|
|
|
|
// This call is a no-op for textfile output
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Write out the mid-header to the stream, if any exists
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override void WriteMidHeader()
|
|
|
|
|
|
{
|
|
|
|
|
|
// This call is a no-op for textfile output
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Write out the separator to the stream, if any exists
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override void WriteMidSeparator()
|
|
|
|
|
|
{
|
|
|
|
|
|
// This call is a no-op for textfile output
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Write out the footer-separator to the stream, if any exists
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override void WriteFooterSeparator()
|
|
|
|
|
|
{
|
|
|
|
|
|
_writer.Write("\n");
|
|
|
|
|
|
_writer.Flush();
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Write out the footer to the stream, if any exists
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override void WriteFooter()
|
|
|
|
|
|
{
|
|
|
|
|
|
// This call is a no-op for textfile output
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
}
|