mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Cleanup and overhaul (#21)
* Syntax cleanup * More minor cleanup, use Linq * Fix broken features by using correct values * Feature flags the same * Features are modular * No AlphaFS, more .NET versions * Fix appveyor * Put back identifiers, for some reason * String interpolation, modernization * Better use of GetField * XmlTextWriter to remove possible issues * Fix header for OpenMSX
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
using SabreTools.Library.DatFiles;
|
||||
using SabreTools.Library.Tools;
|
||||
|
||||
#if MONO
|
||||
using System.IO;
|
||||
#else
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
|
||||
using Stream = System.IO.Stream;
|
||||
#endif
|
||||
|
||||
namespace SabreTools.Library.Reports
|
||||
{
|
||||
/// <summary>
|
||||
@@ -52,19 +45,19 @@ namespace SabreTools.Library.Reports
|
||||
public override void Write(long game = -1)
|
||||
{
|
||||
string line = "\t\t\t<tr" + (_datFile.FileName.StartsWith("DIR: ")
|
||||
? " class=\"dir\"><td>" + WebUtility.HtmlEncode(_datFile.FileName.Remove(0, 5))
|
||||
: "><td>" + WebUtility.HtmlEncode(_datFile.FileName)) + "</td>"
|
||||
+ "<td align=\"right\">" + Utilities.GetBytesReadable(_datFile.TotalSize) + "</td>"
|
||||
+ "<td align=\"right\">" + (game == -1 ? _datFile.Keys.Count() : game) + "</td>"
|
||||
+ "<td align=\"right\">" + _datFile.RomCount + "</td>"
|
||||
+ "<td align=\"right\">" + _datFile.DiskCount + "</td>"
|
||||
+ "<td align=\"right\">" + _datFile.CRCCount + "</td>"
|
||||
+ "<td align=\"right\">" + _datFile.MD5Count + "</td>"
|
||||
+ "<td align=\"right\">" + _datFile.RIPEMD160Count + "</td>"
|
||||
+ "<td align=\"right\">" + _datFile.SHA1Count + "</td>"
|
||||
+ "<td align=\"right\">" + _datFile.SHA256Count + "</td>"
|
||||
+ (_baddumpCol ? "<td align=\"right\">" + _datFile.BaddumpCount + "</td>" : "")
|
||||
+ (_nodumpCol ? "<td align=\"right\">" + _datFile.NodumpCount + "</td>" : "")
|
||||
? $" class=\"dir\"><td>{WebUtility.HtmlEncode(_datFile.FileName.Remove(0, 5))}"
|
||||
: $"><td>{WebUtility.HtmlEncode(_datFile.FileName)}") + "</td>"
|
||||
+ $"<td align=\"right\">{Utilities.GetBytesReadable(_datFile.TotalSize)}</td>"
|
||||
+ $"<td align=\"right\">{(game == -1 ? _datFile.Keys.Count() : game)}</td>"
|
||||
+ $"<td align=\"right\">{_datFile.RomCount}</td>"
|
||||
+ $"<td align=\"right\">{_datFile.DiskCount}</td>"
|
||||
+ $"<td align=\"right\">{_datFile.CRCCount}</td>"
|
||||
+ $"<td align=\"right\">{_datFile.MD5Count}</td>"
|
||||
+ $"<td align=\"right\">{_datFile.RIPEMD160Count}</td>"
|
||||
+ $"<td align=\"right\">{_datFile.SHA1Count}</td>"
|
||||
+ $"<td align=\"right\">{_datFile.SHA256Count}</td>"
|
||||
+ (_baddumpCol ? $"<td align=\"right\">{_datFile.BaddumpCount}</td>" : string.Empty)
|
||||
+ (_nodumpCol ? $"<td align=\"right\">{_datFile.NodumpCount}</td>" : string.Empty)
|
||||
+ "</tr>\n";
|
||||
_writer.Write(line);
|
||||
_writer.Flush();
|
||||
@@ -93,7 +86,7 @@ namespace SabreTools.Library.Reports
|
||||
</header>
|
||||
<body>
|
||||
<h2>DAT Statistics Report (" + DateTime.Now.ToShortDateString() + @")</h2>
|
||||
<table border=""1"" cellpadding=""5"" cellspacing=""0"">
|
||||
<table border=string.Empty1string.Empty cellpadding=string.Empty5string.Empty cellspacing=string.Empty0string.Empty>
|
||||
");
|
||||
_writer.Flush();
|
||||
|
||||
@@ -106,9 +99,9 @@ namespace SabreTools.Library.Reports
|
||||
/// </summary>
|
||||
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>"
|
||||
+ @"<th align=""right"">Disks</th><th align=""right""># with CRC</th><th align=""right""># with MD5</th><th align=""right""># with SHA-1</th><th align=""right""># with SHA-256</th>"
|
||||
+ (_baddumpCol ? "<th class=\".right\">Baddumps</th>" : "") + (_nodumpCol ? "<th class=\".right\">Nodumps</th>" : "") + "</tr>\n");
|
||||
_writer.Write(@" <tr bgcolor=string.Emptygraystring.Empty><th>File Name</th><th align=string.Emptyrightstring.Empty>Total Size</th><th align=string.Emptyrightstring.Empty>Games</th><th align=string.Emptyrightstring.Empty>Roms</th>"
|
||||
+ @"<th align=string.Emptyrightstring.Empty>Disks</th><th align=string.Emptyrightstring.Empty># with CRC</th><th align=string.Emptyrightstring.Empty># with MD5</th><th align=string.Emptyrightstring.Empty># with SHA-1</th><th align=string.Emptyrightstring.Empty># with SHA-256</th>"
|
||||
+ (_baddumpCol ? "<th class=\".right\">Baddumps</th>" : string.Empty) + (_nodumpCol ? "<th class=\".right\">Nodumps</th>" : string.Empty) + "</tr>\n");
|
||||
_writer.Flush();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user