Fix ParentablePath issues; fix parse logging

This commit is contained in:
Matt Nadareski
2020-09-21 13:04:11 -07:00
parent 07066c2299
commit a04a3485ef
20 changed files with 517 additions and 388 deletions

View File

@@ -54,33 +54,46 @@ namespace SabreTools.Library.DatFiles
while (!cmpr.EndOfStream)
{
cmpr.ReadNextLine();
// Ignore everything not top-level
if (cmpr.RowType != CmpRowType.TopLevel)
continue;
// Switch on the top-level name
switch (cmpr.TopLevel.ToLowerInvariant())
try
{
// Header values
case "clrmamepro":
case "romvault":
ReadHeader(cmpr, keep);
break;
cmpr.ReadNextLine();
// Sets
case "set": // Used by the most ancient DATs
case "game": // Used by most CMP DATs
case "machine": // Possibly used by MAME CMP DATs
ReadSet(cmpr, false, filename, indexId);
break;
case "resource": // Used by some other DATs to denote a BIOS set
ReadSet(cmpr, true, filename, indexId);
break;
// Ignore everything not top-level
if (cmpr.RowType != CmpRowType.TopLevel)
continue;
default:
break;
// Switch on the top-level name
switch (cmpr.TopLevel.ToLowerInvariant())
{
// Header values
case "clrmamepro":
case "romvault":
ReadHeader(cmpr, keep);
break;
// Sets
case "set": // Used by the most ancient DATs
case "game": // Used by most CMP DATs
case "machine": // Possibly used by MAME CMP DATs
ReadSet(cmpr, false, filename, indexId);
break;
case "resource": // Used by some other DATs to denote a BIOS set
ReadSet(cmpr, true, filename, indexId);
break;
default:
break;
}
}
catch (Exception ex)
{
string message = $"'{filename}' - There was an error parsing line {cmpr.LineNumber} '{cmpr.CurrentLine}'";
Globals.Logger.Error(ex, message);
if (throwOnError)
{
cmpr.Dispose();
throw new Exception(message, ex);
}
}
}