Include all DIC write offsets (fixes #750)

This commit is contained in:
Matt Nadareski
2024-10-08 15:47:24 -04:00
parent 8a7761753b
commit ed4bd24fcb
2 changed files with 28 additions and 6 deletions

View File

@@ -1887,15 +1887,36 @@ namespace MPF.Processors
try
{
// Fast forward to the offsets
// Get a list for all found offsets
var offsets = new List<string>();
// Loop over all possible offsets
using var sr = File.OpenText(disc);
while (sr.ReadLine()?.Trim()?.StartsWith("========== Offset") == false) ;
sr.ReadLine(); // Combined Offset
sr.ReadLine(); // Drive Offset
sr.ReadLine(); // Separator line
while (!sr.EndOfStream)
{
// Fast forward to the offsets
while (sr.ReadLine()?.Trim()?.StartsWith("========== Offset") == false) ;
if (sr.EndOfStream)
break;
sr.ReadLine(); // Combined Offset
sr.ReadLine(); // Drive Offset
sr.ReadLine(); // Separator line
// Now that we're at the offsets, attempt to get the sample offset
string offset = sr.ReadLine()?.Split(' ')?.LastOrDefault() ?? string.Empty;
offsets.Add(offset);
}
// Deduplicate the offsets
offsets = offsets
.Where(string.IsNullOrEmpty)
.Distinct()
.ToList();
// Now that we're at the offsets, attempt to get the sample offset
return sr.ReadLine()?.Split(' ')?.LastOrDefault();
return string.Join(", ", [.. offsets]);
}
catch
{