Convert DAT type to a key

This commit is contained in:
Matt Nadareski
2024-03-10 21:54:07 -04:00
parent 8ef1ba6293
commit 1d1cbc3357
9 changed files with 93 additions and 101 deletions

View File

@@ -2198,11 +2198,11 @@ Some special strings that can be used:
}
else if (dftemp == DatFormat.Logiqx && deprecated)
{
datHeader.DatFormat |= DatFormat.LogiqxDeprecated;
datHeader.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, datHeader.GetFieldValue<DatFormat>(DatHeader.DatFormatKey) | DatFormat.LogiqxDeprecated);
}
else
{
datHeader.DatFormat |= dftemp;
datHeader.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, datHeader.GetFieldValue<DatFormat>(DatHeader.DatFormatKey) | dftemp);
}
}

View File

@@ -480,10 +480,10 @@ Reset the internal state: reset();";
public override void Process(BatchState batchState)
{
// Assume there could be multiple
batchState.DatFile.Header.DatFormat = 0x00;
batchState.DatFile.Header.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, 0x00);
foreach (string format in Arguments)
{
batchState.DatFile.Header.DatFormat |= GetDatFormat(format);
batchState.DatFile.Header.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, batchState.DatFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey) | GetDatFormat(format));
}
}
}
@@ -804,7 +804,7 @@ Reset the internal state: reset();";
// Read in the individual arguments
(string? type, string? key) = FilterParser.ParseFilterId(Arguments[0]);
// If we had an invalid input, log and continue
if ((type == null || !string.Equals(type, Models.Metadata.MetadataFile.HeaderKey, StringComparison.OrdinalIgnoreCase)) && key == null)
{

View File

@@ -167,9 +167,9 @@ namespace SabreTools.Features
DatFile datFile = DatFile.Create(Header);
logger.User($"Processing '{Path.GetFileName(inputPath.CurrentPath)}'");
Parser.ParseInto(datFile, inputPath, keep: true,
keepext: datFile.Header.DatFormat.HasFlag(DatFormat.TSV)
|| datFile.Header.DatFormat.HasFlag(DatFormat.CSV)
|| datFile.Header.DatFormat.HasFlag(DatFormat.SSV));
keepext: datFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey).HasFlag(DatFormat.TSV)
|| datFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey).HasFlag(DatFormat.CSV)
|| datFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey).HasFlag(DatFormat.SSV));
// Perform additional processing steps
Extras!.ApplyExtras(datFile);