[Reports/] Untabify

This commit is contained in:
Matt Nadareski
2019-02-08 20:53:13 -08:00
parent b09198708e
commit e5e6317f2a
4 changed files with 380 additions and 380 deletions

View File

@@ -14,90 +14,90 @@ using StreamWriter = System.IO.StreamWriter;
namespace SabreTools.Library.Reports namespace SabreTools.Library.Reports
{ {
/// <summary> /// <summary>
/// Base class for a report output format /// Base class for a report output format
/// </summary> /// </summary>
public abstract class BaseReport public abstract class BaseReport
{ {
protected DatFile _datFile; protected DatFile _datFile;
protected StreamWriter _writer; protected StreamWriter _writer;
protected bool _baddumpCol; protected bool _baddumpCol;
protected bool _nodumpCol; protected bool _nodumpCol;
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the filename /// Create a new report from the input DatFile and the filename
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="filename">Name of the file to write out to</param> /// <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="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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public BaseReport(DatFile datfile, string filename, bool baddumpCol = false, bool nodumpCol = false) public BaseReport(DatFile datfile, string filename, bool baddumpCol = false, bool nodumpCol = false)
{ {
_datFile = datfile; _datFile = datfile;
_writer = new StreamWriter(Utilities.TryCreate(filename)); _writer = new StreamWriter(Utilities.TryCreate(filename));
_baddumpCol = baddumpCol; _baddumpCol = baddumpCol;
_nodumpCol = nodumpCol; _nodumpCol = nodumpCol;
} }
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the stream /// Create a new report from the input DatFile and the stream
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="stream">Output stream to write to</param> /// <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="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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public BaseReport(DatFile datfile, Stream stream, bool baddumpCol = false, bool nodumpCol = false) public BaseReport(DatFile datfile, Stream stream, bool baddumpCol = false, bool nodumpCol = false)
{ {
_datFile = datfile; _datFile = datfile;
if (!stream.CanWrite) if (!stream.CanWrite)
{ {
throw new ArgumentException(nameof(stream)); throw new ArgumentException(nameof(stream));
} }
_writer = new StreamWriter(stream); _writer = new StreamWriter(stream);
_baddumpCol = baddumpCol; _baddumpCol = baddumpCol;
_nodumpCol = nodumpCol; _nodumpCol = nodumpCol;
} }
/// <summary> /// <summary>
/// Replace the DatFile that is being output /// Replace the DatFile that is being output
/// </summary> /// </summary>
/// <param name="datfile"></param> /// <param name="datfile"></param>
public void ReplaceDatFile(DatFile datfile) public void ReplaceDatFile(DatFile datfile)
{ {
_datFile = datfile; _datFile = datfile;
} }
/// <summary> /// <summary>
/// Write the report to the output stream /// Write the report to the output stream
/// </summary> /// </summary>
/// <param name="game">Number of games to use, -1 means use the number of keys</param> /// <param name="game">Number of games to use, -1 means use the number of keys</param>
public abstract void Write(long game = -1); public abstract void Write(long game = -1);
/// <summary> /// <summary>
/// Write out the header to the stream, if any exists /// Write out the header to the stream, if any exists
/// </summary> /// </summary>
public abstract void WriteHeader(); public abstract void WriteHeader();
/// <summary> /// <summary>
/// Write out the mid-header to the stream, if any exists /// Write out the mid-header to the stream, if any exists
/// </summary> /// </summary>
public abstract void WriteMidHeader(); public abstract void WriteMidHeader();
/// <summary> /// <summary>
/// Write out the separator to the stream, if any exists /// Write out the separator to the stream, if any exists
/// </summary> /// </summary>
public abstract void WriteMidSeparator(); public abstract void WriteMidSeparator();
/// <summary> /// <summary>
/// Write out the footer-separator to the stream, if any exists /// Write out the footer-separator to the stream, if any exists
/// </summary> /// </summary>
public abstract void WriteFooterSeparator(); public abstract void WriteFooterSeparator();
/// <summary> /// <summary>
/// Write out the footer to the stream, if any exists /// Write out the footer to the stream, if any exists
/// </summary> /// </summary>
public abstract void WriteFooter(); public abstract void WriteFooter();
} }
} }

View File

@@ -15,144 +15,144 @@ using Stream = System.IO.Stream;
namespace SabreTools.Library.Reports namespace SabreTools.Library.Reports
{ {
/// <summary> /// <summary>
/// HTML report format /// HTML report format
/// </summary> /// </summary>
/// TODO: Make output standard width, without making the entire thing a table /// TODO: Make output standard width, without making the entire thing a table
internal class Html : BaseReport internal class Html : BaseReport
{ {
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the filename /// Create a new report from the input DatFile and the filename
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="filename">Name of the file to write out to</param> /// <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="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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public Html(DatFile datfile, string filename, bool baddumpCol = false, bool nodumpCol = false) public Html(DatFile datfile, string filename, bool baddumpCol = false, bool nodumpCol = false)
: base(datfile, filename, baddumpCol, nodumpCol) : base(datfile, filename, baddumpCol, nodumpCol)
{ {
} }
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the stream /// Create a new report from the input DatFile and the stream
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="stream">Output stream to write to</param> /// <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="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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public Html(DatFile datfile, Stream stream, bool baddumpCol = false, bool nodumpCol = false) public Html(DatFile datfile, Stream stream, bool baddumpCol = false, bool nodumpCol = false)
: base(datfile, stream, baddumpCol, nodumpCol) : base(datfile, stream, baddumpCol, nodumpCol)
{ {
} }
/// <summary> /// <summary>
/// Write the report to file /// Write the report to file
/// </summary> /// </summary>
/// <param name="game">Number of games to use, -1 means use the number of keys</param> /// <param name="game">Number of games to use, -1 means use the number of keys</param>
public override void Write(long game = -1) public override void Write(long game = -1)
{ {
string line = "\t\t\t<tr" + (_datFile.FileName.StartsWith("DIR: ") string line = "\t\t\t<tr" + (_datFile.FileName.StartsWith("DIR: ")
? " class=\"dir\"><td>" + HttpUtility.HtmlEncode(_datFile.FileName.Remove(0, 5)) ? " class=\"dir\"><td>" + HttpUtility.HtmlEncode(_datFile.FileName.Remove(0, 5))
: "><td>" + HttpUtility.HtmlEncode(_datFile.FileName)) + "</td>" : "><td>" + HttpUtility.HtmlEncode(_datFile.FileName)) + "</td>"
+ "<td align=\"right\">" + Utilities.GetBytesReadable(_datFile.TotalSize) + "</td>" + "<td align=\"right\">" + Utilities.GetBytesReadable(_datFile.TotalSize) + "</td>"
+ "<td align=\"right\">" + (game == -1 ? _datFile.Keys.Count() : game) + "</td>" + "<td align=\"right\">" + (game == -1 ? _datFile.Keys.Count() : game) + "</td>"
+ "<td align=\"right\">" + _datFile.RomCount + "</td>" + "<td align=\"right\">" + _datFile.RomCount + "</td>"
+ "<td align=\"right\">" + _datFile.DiskCount + "</td>" + "<td align=\"right\">" + _datFile.DiskCount + "</td>"
+ "<td align=\"right\">" + _datFile.CRCCount + "</td>" + "<td align=\"right\">" + _datFile.CRCCount + "</td>"
+ "<td align=\"right\">" + _datFile.MD5Count + "</td>" + "<td align=\"right\">" + _datFile.MD5Count + "</td>"
+ "<td align=\"right\">" + _datFile.SHA1Count + "</td>" + "<td align=\"right\">" + _datFile.SHA1Count + "</td>"
+ "<td align=\"right\">" + _datFile.SHA256Count + "</td>" + "<td align=\"right\">" + _datFile.SHA256Count + "</td>"
+ (_baddumpCol ? "<td align=\"right\">" + _datFile.BaddumpCount + "</td>" : "") + (_baddumpCol ? "<td align=\"right\">" + _datFile.BaddumpCount + "</td>" : "")
+ (_nodumpCol ? "<td align=\"right\">" + _datFile.NodumpCount + "</td>" : "") + (_nodumpCol ? "<td align=\"right\">" + _datFile.NodumpCount + "</td>" : "")
+ "</tr>\n"; + "</tr>\n";
_writer.Write(line); _writer.Write(line);
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the header to the stream, if any exists /// Write out the header to the stream, if any exists
/// </summary> /// </summary>
public override void WriteHeader() public override void WriteHeader()
{ {
_writer.Write(@"<!DOCTYPE html> _writer.Write(@"<!DOCTYPE html>
<html> <html>
<header> <header>
<title>DAT Statistics Report</title> <title>DAT Statistics Report</title>
<style> <style>
body { body {
background-color: lightgray; background-color: lightgray;
} }
.dir { .dir {
color: #0088FF; color: #0088FF;
} }
.right { .right {
align: right; align: right;
} }
</style> </style>
</header> </header>
<body> <body>
<h2>DAT Statistics Report (" + DateTime.Now.ToShortDateString() + @")</h2> <h2>DAT Statistics Report (" + DateTime.Now.ToShortDateString() + @")</h2>
<table border=""1"" cellpadding=""5"" cellspacing=""0""> <table border=""1"" cellpadding=""5"" cellspacing=""0"">
"); ");
_writer.Flush(); _writer.Flush();
// Now write the mid header for those who need it // Now write the mid header for those who need it
WriteMidHeader(); WriteMidHeader();
} }
/// <summary> /// <summary>
/// Write out the mid-header to the stream, if any exists /// Write out the mid-header to the stream, if any exists
/// </summary> /// </summary>
public override void WriteMidHeader() public override void WriteMidHeader()
{ {
_writer.Write(@" <tr bgcolor=""gray""><th>File Name</th><th align=""right"">Total Size</th><th align=""right"">Games</th><th align=""right"">Roms</th>" _writer.Write(@" <tr bgcolor=""gray""><th>File Name</th><th align=""right"">Total Size</th><th align=""right"">Games</th><th align=""right"">Roms</th>"
+ @"<th align=""right"">Disks</th><th align=""right"">&#35; with CRC</th><th align=""right"">&#35; with MD5</th><th align=""right"">&#35; with SHA-1</th><th align=""right"">&#35; with SHA-256</th>" + @"<th align=""right"">Disks</th><th align=""right"">&#35; with CRC</th><th align=""right"">&#35; with MD5</th><th align=""right"">&#35; with SHA-1</th><th align=""right"">&#35; with SHA-256</th>"
+ (_baddumpCol ? "<th class=\".right\">Baddumps</th>" : "") + (_nodumpCol ? "<th class=\".right\">Nodumps</th>" : "") + "</tr>\n"); + (_baddumpCol ? "<th class=\".right\">Baddumps</th>" : "") + (_nodumpCol ? "<th class=\".right\">Nodumps</th>" : "") + "</tr>\n");
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the separator to the stream, if any exists /// Write out the separator to the stream, if any exists
/// </summary> /// </summary>
public override void WriteMidSeparator() public override void WriteMidSeparator()
{ {
_writer.Write("<tr><td colspan=\"" _writer.Write("<tr><td colspan=\""
+ (_baddumpCol && _nodumpCol + (_baddumpCol && _nodumpCol
? "12" ? "12"
: (_baddumpCol ^ _nodumpCol : (_baddumpCol ^ _nodumpCol
? "11" ? "11"
: "10") : "10")
) )
+ "\"></td></tr>\n"); + "\"></td></tr>\n");
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the footer-separator to the stream, if any exists /// Write out the footer-separator to the stream, if any exists
/// </summary> /// </summary>
public override void WriteFooterSeparator() public override void WriteFooterSeparator()
{ {
_writer.Write("<tr border=\"0\"><td colspan=\"" _writer.Write("<tr border=\"0\"><td colspan=\""
+ (_baddumpCol && _nodumpCol + (_baddumpCol && _nodumpCol
? "12" ? "12"
: (_baddumpCol ^ _nodumpCol : (_baddumpCol ^ _nodumpCol
? "11" ? "11"
: "10") : "10")
) )
+ "\"></td></tr>\n"); + "\"></td></tr>\n");
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the footer to the stream, if any exists /// Write out the footer to the stream, if any exists
/// </summary> /// </summary>
public override void WriteFooter() public override void WriteFooter()
{ {
_writer.Write(@" </table> _writer.Write(@" </table>
</body> </body>
</html> </html>
"); ");
_writer.Flush(); _writer.Flush();
} }
} }
} }

View File

@@ -12,107 +12,107 @@ using Stream = System.IO.Stream;
namespace SabreTools.Library.Reports namespace SabreTools.Library.Reports
{ {
/// <summary> /// <summary>
/// Separated-Value report format /// Separated-Value report format
/// </summary> /// </summary>
internal class SeparatedValue : BaseReport internal class SeparatedValue : BaseReport
{ {
private char _separator; private char _separator;
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the filename /// Create a new report from the input DatFile and the filename
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="filename">Name of the file to write out to</param> /// <param name="filename">Name of the file to write out to</param>
/// <param name="separator">Separator character to use in output</param> /// <param name="separator">Separator character to use in output</param>
/// <param name="baddumpCol">True if baddumps should be included in output, false otherwise</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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public SeparatedValue(DatFile datfile, string filename, char separator, bool baddumpCol = false, bool nodumpCol = false) public SeparatedValue(DatFile datfile, string filename, char separator, bool baddumpCol = false, bool nodumpCol = false)
: base(datfile, filename, baddumpCol, nodumpCol) : base(datfile, filename, baddumpCol, nodumpCol)
{ {
_separator = separator; _separator = separator;
} }
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the stream /// Create a new report from the input DatFile and the stream
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="stream">Output stream to write to</param> /// <param name="stream">Output stream to write to</param>
/// <param name="separator">Separator character to use in output</param> /// <param name="separator">Separator character to use in output</param>
/// <param name="baddumpCol">True if baddumps should be included in output, false otherwise</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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public SeparatedValue(DatFile datfile, Stream stream, char separator, bool baddumpCol = false, bool nodumpCol = false) public SeparatedValue(DatFile datfile, Stream stream, char separator, bool baddumpCol = false, bool nodumpCol = false)
: base(datfile, stream, baddumpCol, nodumpCol) : base(datfile, stream, baddumpCol, nodumpCol)
{ {
_separator = separator; _separator = separator;
} }
/// <summary> /// <summary>
/// Write the report to file /// Write the report to file
/// </summary> /// </summary>
/// <param name="game">Number of games to use, -1 means use the number of keys</param> /// <param name="game">Number of games to use, -1 means use the number of keys</param>
public override void Write(long game = -1) public override void Write(long game = -1)
{ {
string line = string.Format("\"" + _datFile.FileName + "\"{0}" string line = string.Format("\"" + _datFile.FileName + "\"{0}"
+ "\"" + _datFile.TotalSize + "\"{0}" + "\"" + _datFile.TotalSize + "\"{0}"
+ "\"" + (game == -1 ? _datFile.Keys.Count() : game) + "\"{0}" + "\"" + (game == -1 ? _datFile.Keys.Count() : game) + "\"{0}"
+ "\"" + _datFile.RomCount + "\"{0}" + "\"" + _datFile.RomCount + "\"{0}"
+ "\"" + _datFile.DiskCount + "\"{0}" + "\"" + _datFile.DiskCount + "\"{0}"
+ "\"" + _datFile.CRCCount + "\"{0}" + "\"" + _datFile.CRCCount + "\"{0}"
+ "\"" + _datFile.MD5Count + "\"{0}" + "\"" + _datFile.MD5Count + "\"{0}"
+ "\"" + _datFile.SHA1Count + "\"{0}" + "\"" + _datFile.SHA1Count + "\"{0}"
+ "\"" + _datFile.SHA256Count + "\"{0}" + "\"" + _datFile.SHA256Count + "\"{0}"
+ "\"" + _datFile.SHA384Count + "\"{0}" + "\"" + _datFile.SHA384Count + "\"{0}"
+ "\"" + _datFile.SHA512Count + "\"" + "\"" + _datFile.SHA512Count + "\""
+ (_baddumpCol ? "{0}\"" + _datFile.BaddumpCount + "\"" : "") + (_baddumpCol ? "{0}\"" + _datFile.BaddumpCount + "\"" : "")
+ (_nodumpCol ? "{0}\"" + _datFile.BaddumpCount + "\"" : "") + (_nodumpCol ? "{0}\"" + _datFile.BaddumpCount + "\"" : "")
+ "\n", _separator); + "\n", _separator);
_writer.Write(line); _writer.Write(line);
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the header to the stream, if any exists /// Write out the header to the stream, if any exists
/// </summary> /// </summary>
public override void WriteHeader() public override void WriteHeader()
{ {
_writer.Write(string.Format("\"File Name\"{0}\"Total Size\"{0}\"Games\"{0}\"Roms\"{0}\"Disks\"{0}\"# with CRC\"{0}\"# with MD5\"{0}\"# with SHA-1\"{0}\"# with SHA-256\"" _writer.Write(string.Format("\"File Name\"{0}\"Total Size\"{0}\"Games\"{0}\"Roms\"{0}\"Disks\"{0}\"# with CRC\"{0}\"# with MD5\"{0}\"# with SHA-1\"{0}\"# with SHA-256\""
+ (_baddumpCol ? "{0}\"BadDumps\"" : "") + (_nodumpCol ? "{0}\"Nodumps\"" : "") + "\n", _separator)); + (_baddumpCol ? "{0}\"BadDumps\"" : "") + (_nodumpCol ? "{0}\"Nodumps\"" : "") + "\n", _separator));
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the mid-header to the stream, if any exists /// Write out the mid-header to the stream, if any exists
/// </summary> /// </summary>
public override void WriteMidHeader() public override void WriteMidHeader()
{ {
// This call is a no-op for separated value formats // This call is a no-op for separated value formats
} }
/// <summary> /// <summary>
/// Write out the separator to the stream, if any exists /// Write out the separator to the stream, if any exists
/// </summary> /// </summary>
public override void WriteMidSeparator() public override void WriteMidSeparator()
{ {
// This call is a no-op for separated value formats // This call is a no-op for separated value formats
} }
/// <summary> /// <summary>
/// Write out the footer-separator to the stream, if any exists /// Write out the footer-separator to the stream, if any exists
/// </summary> /// </summary>
public override void WriteFooterSeparator() public override void WriteFooterSeparator()
{ {
_writer.Write("\n"); _writer.Write("\n");
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the footer to the stream, if any exists /// Write out the footer to the stream, if any exists
/// </summary> /// </summary>
public override void WriteFooter() public override void WriteFooter()
{ {
// This call is a no-op for separated value formats // This call is a no-op for separated value formats
} }
} }
} }

View File

@@ -13,42 +13,42 @@ using Stream = System.IO.Stream;
namespace SabreTools.Library.Reports namespace SabreTools.Library.Reports
{ {
/// <summary> /// <summary>
/// Textfile report format /// Textfile report format
/// </summary> /// </summary>
internal class Textfile : BaseReport internal class Textfile : BaseReport
{ {
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the filename /// Create a new report from the input DatFile and the filename
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="filename">Name of the file to write out to</param> /// <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="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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public Textfile(DatFile datfile, string filename, bool baddumpCol = false, bool nodumpCol = false) public Textfile(DatFile datfile, string filename, bool baddumpCol = false, bool nodumpCol = false)
: base(datfile, filename, baddumpCol, nodumpCol) : base(datfile, filename, baddumpCol, nodumpCol)
{ {
} }
/// <summary> /// <summary>
/// Create a new report from the input DatFile and the stream /// Create a new report from the input DatFile and the stream
/// </summary> /// </summary>
/// <param name="datfile">DatFile to write out statistics for</param> /// <param name="datfile">DatFile to write out statistics for</param>
/// <param name="stream">Output stream to write to</param> /// <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="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> /// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
public Textfile(DatFile datfile, Stream stream, bool baddumpCol = false, bool nodumpCol = false) public Textfile(DatFile datfile, Stream stream, bool baddumpCol = false, bool nodumpCol = false)
: base(datfile, stream, baddumpCol, nodumpCol) : base(datfile, stream, baddumpCol, nodumpCol)
{ {
} }
/// <summary> /// <summary>
/// Write the report to file /// Write the report to file
/// </summary> /// </summary>
/// <param name="game">Number of games to use, -1 means use the number of keys</param> /// <param name="game">Number of games to use, -1 means use the number of keys</param>
public override void Write(long game = -1) public override void Write(long game = -1)
{ {
string line = @"'" + _datFile.FileName + @"': string line = @"'" + _datFile.FileName + @"':
-------------------------------------------------- --------------------------------------------------
Uncompressed size: " + Utilities.GetBytesReadable(_datFile.TotalSize) + @" Uncompressed size: " + Utilities.GetBytesReadable(_datFile.TotalSize) + @"
Games found: " + (game == -1 ? _datFile.Keys.Count() : game) + @" Games found: " + (game == -1 ? _datFile.Keys.Count() : game) + @"
@@ -61,61 +61,61 @@ namespace SabreTools.Library.Reports
Roms with SHA-384: " + _datFile.SHA384Count + @" Roms with SHA-384: " + _datFile.SHA384Count + @"
Roms with SHA-512: " + _datFile.SHA512Count + "\n"; Roms with SHA-512: " + _datFile.SHA512Count + "\n";
if (_baddumpCol) if (_baddumpCol)
{ {
line += " Roms with BadDump status: " + _datFile.BaddumpCount + "\n"; line += " Roms with BadDump status: " + _datFile.BaddumpCount + "\n";
} }
if (_nodumpCol) if (_nodumpCol)
{ {
line += " Roms with Nodump status: " + _datFile.NodumpCount + "\n"; line += " Roms with Nodump status: " + _datFile.NodumpCount + "\n";
} }
// For spacing between DATs // For spacing between DATs
line += "\n\n"; line += "\n\n";
_writer.Write(line); _writer.Write(line);
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the header to the stream, if any exists /// Write out the header to the stream, if any exists
/// </summary> /// </summary>
public override void WriteHeader() public override void WriteHeader()
{ {
// This call is a no-op for textfile output // This call is a no-op for textfile output
} }
/// <summary> /// <summary>
/// Write out the mid-header to the stream, if any exists /// Write out the mid-header to the stream, if any exists
/// </summary> /// </summary>
public override void WriteMidHeader() public override void WriteMidHeader()
{ {
// This call is a no-op for textfile output // This call is a no-op for textfile output
} }
/// <summary> /// <summary>
/// Write out the separator to the stream, if any exists /// Write out the separator to the stream, if any exists
/// </summary> /// </summary>
public override void WriteMidSeparator() public override void WriteMidSeparator()
{ {
// This call is a no-op for textfile output // This call is a no-op for textfile output
} }
/// <summary> /// <summary>
/// Write out the footer-separator to the stream, if any exists /// Write out the footer-separator to the stream, if any exists
/// </summary> /// </summary>
public override void WriteFooterSeparator() public override void WriteFooterSeparator()
{ {
_writer.Write("\n"); _writer.Write("\n");
_writer.Flush(); _writer.Flush();
} }
/// <summary> /// <summary>
/// Write out the footer to the stream, if any exists /// Write out the footer to the stream, if any exists
/// </summary> /// </summary>
public override void WriteFooter() public override void WriteFooter()
{ {
// This call is a no-op for textfile output // This call is a no-op for textfile output
} }
} }
} }