Get error count from recent redumper log (#462)

* Get error count from recent redumper log

* Revert "Get error count from recent redumper log"

This reverts commit 50f5f71686.

* Fix to keep existing code format
This commit is contained in:
fuzzball
2023-03-08 00:21:33 +09:00
committed by GitHub
parent 8f57d78200
commit 8c7b66a2f5

View File

@@ -189,7 +189,7 @@ namespace MPF.Modules.Redumper
break;
}
return (true, new List<string>());
}
@@ -920,8 +920,11 @@ namespace MPF.Modules.Redumper
{
try
{
const string startMarker = "CD-ROM [";
const string redumpMarker = "REDUMP.ORG errors";
// Fast forward to the errors lines
while (!sr.EndOfStream && !sr.ReadLine().Trim().StartsWith("data errors"));
while (!sr.EndOfStream && !sr.ReadLine().Trim().StartsWith(startMarker));
if (sr.EndOfStream)
return 0;
@@ -929,13 +932,13 @@ namespace MPF.Modules.Redumper
long errorCount = 0;
while (!sr.EndOfStream)
{
// Skip forward to the "redump" line
// Skip forward to the redump error line
string line;
while (!(line = sr.ReadLine().Trim()).StartsWith("redump"));
while (!(line = sr.ReadLine().Trim()).StartsWith(redumpMarker));
// redump: <error count>
// Get the number from the error line
string[] parts = line.Split(' ');
if (long.TryParse(parts[1], out long redump))
if (long.TryParse(parts.Last(), out long redump))
errorCount += redump;
else
return -1;
@@ -943,7 +946,7 @@ namespace MPF.Modules.Redumper
if (!sr.EndOfStream)
sr.ReadLine(); // Empty line
if (!sr.EndOfStream && !sr.ReadLine().Trim().StartsWith("data errors"))
if (!sr.EndOfStream && !sr.ReadLine().Trim().StartsWith(startMarker))
break;
}