mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove unnecessary complexity
This commit is contained in:
@@ -709,7 +709,7 @@ namespace SabreTools.Library.DatFiles
|
||||
cmpw.WriteAttributeString("name", biosSet.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!string.IsNullOrWhiteSpace(biosSet.GetField(Field.BiosDescription, Header.ExcludeFields)))
|
||||
cmpw.WriteAttributeString("description", biosSet.Description);
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && biosSet.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && biosSet.Default != null)
|
||||
cmpw.WriteAttributeString("default", biosSet.Default.ToString().ToLowerInvariant());
|
||||
cmpw.WriteEndElement();
|
||||
break;
|
||||
@@ -732,7 +732,7 @@ namespace SabreTools.Library.DatFiles
|
||||
cmpw.WriteAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.SHA512, Header.ExcludeFields)))
|
||||
cmpw.WriteAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus != ItemStatus.None)
|
||||
cmpw.WriteAttributeString("flags", disk.ItemStatus.ToString().ToLowerInvariant());
|
||||
cmpw.WriteEndElement();
|
||||
break;
|
||||
@@ -747,7 +747,7 @@ namespace SabreTools.Library.DatFiles
|
||||
cmpw.WriteAttributeString("language", release.Language);
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Date, Header.ExcludeFields)))
|
||||
cmpw.WriteAttributeString("date", release.Date);
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && release.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && release.Default != null)
|
||||
cmpw.WriteAttributeString("default", release.Default.ToString().ToLowerInvariant());
|
||||
cmpw.WriteEndElement();
|
||||
break;
|
||||
@@ -756,7 +756,7 @@ namespace SabreTools.Library.DatFiles
|
||||
var rom = datItem as Rom;
|
||||
cmpw.WriteStartElement("rom");
|
||||
cmpw.WriteAttributeString("name", rom.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.Size] && rom.Size != -1)
|
||||
if (!Header.ExcludeFields.Contains(Field.Size) && rom.Size != -1)
|
||||
cmpw.WriteAttributeString("size", rom.Size.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.CRC, Header.ExcludeFields)))
|
||||
cmpw.WriteAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
@@ -776,7 +776,7 @@ namespace SabreTools.Library.DatFiles
|
||||
cmpw.WriteAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Date, Header.ExcludeFields)))
|
||||
cmpw.WriteAttributeString("date", rom.Date);
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus != ItemStatus.None)
|
||||
cmpw.WriteAttributeString("flags", rom.ItemStatus.ToString().ToLowerInvariant());
|
||||
cmpw.WriteEndElement();
|
||||
break;
|
||||
|
||||
@@ -450,7 +450,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="filter">Filter object to be passed to the DatItem level</param>
|
||||
/// <param name="updateFields">List of Fields representing what should be updated [only for base replacement]</param>
|
||||
/// <param name="onlySame">True if descriptions should only be replaced if the game name is the same, false otherwise</param>
|
||||
private void BaseReplace(
|
||||
internal void BaseReplace(
|
||||
List<ParentablePath> inputs,
|
||||
string outDir,
|
||||
bool inplace,
|
||||
@@ -937,7 +937,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="inputs">Names of the input files</param>
|
||||
/// <param name="outDir">Optional param for output directory</param>
|
||||
/// <param name="inplace">True if the output files should overwrite their inputs, false otherwise</param>
|
||||
private void DiffAgainst(List<ParentablePath> inputs, string outDir, bool inplace)
|
||||
internal void DiffAgainst(List<ParentablePath> inputs, string outDir, bool inplace)
|
||||
{
|
||||
// For comparison's sake, we want to use CRC as the base ordering
|
||||
Items.BucketBy(BucketedBy.CRC, DedupeType.Full);
|
||||
@@ -989,7 +989,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="outDir">Output directory to write the DATs to</param>
|
||||
/// <param name="inplace">True if cascaded diffs are outputted in-place, false otherwise</param>
|
||||
/// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param>
|
||||
private void DiffCascade(
|
||||
internal void DiffCascade(
|
||||
List<ParentablePath> inputs,
|
||||
List<DatHeader> datHeaders,
|
||||
string outDir,
|
||||
@@ -1077,7 +1077,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="inputs">List of inputs to write out from</param>
|
||||
/// <param name="outDir">Output directory to write the DATs to</param>
|
||||
/// <param name="diff">Non-zero flag for diffing mode, zero otherwise</param>
|
||||
private void DiffNoCascade(List<ParentablePath> inputs, string outDir, UpdateMode diff)
|
||||
internal void DiffNoCascade(List<ParentablePath> inputs, string outDir, UpdateMode diff)
|
||||
{
|
||||
InternalStopwatch watch = new InternalStopwatch("Initializing all output DATs");
|
||||
|
||||
@@ -1223,7 +1223,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
/// <param name="inputs">List of inputs to write out from</param>
|
||||
/// <param name="outDir">Output directory to write the DATs to</param>
|
||||
private void MergeNoDiff(List<ParentablePath> inputs, string outDir)
|
||||
internal void MergeNoDiff(List<ParentablePath> inputs, string outDir)
|
||||
{
|
||||
// If we're in SuperDAT mode, prefix all games with their respective DATs
|
||||
if (Header.Type == "SuperDAT")
|
||||
@@ -1262,7 +1262,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="inputs">Paths to DATs to parse</param>
|
||||
/// <param name="filter">Filter object to be passed to the DatItem level</param>
|
||||
/// <returns>List of DatData objects representing headers</returns>
|
||||
private List<DatHeader> PopulateUserData(List<ParentablePath> inputs, Filter filter)
|
||||
internal List<DatHeader> PopulateUserData(List<ParentablePath> inputs, Filter filter)
|
||||
{
|
||||
DatFile[] datFiles = new DatFile[inputs.Count];
|
||||
InternalStopwatch watch = new InternalStopwatch("Processing individual DATs");
|
||||
@@ -1299,7 +1299,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="outDir">Optional param for output directory</param>
|
||||
/// <param name="inplace">True if the output files should overwrite their inputs, false otherwise</param>
|
||||
/// <param name="filter">Filter object to be passed to the DatItem level</param>
|
||||
private void Update(List<ParentablePath> inputs, string outDir, bool inplace, Filter filter)
|
||||
internal void Update(List<ParentablePath> inputs, string outDir, bool inplace, Filter filter)
|
||||
{
|
||||
// Iterate over the files
|
||||
foreach (ParentablePath file in inputs)
|
||||
@@ -1335,6 +1335,19 @@ namespace SabreTools.Library.DatFiles
|
||||
return datFile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a DAT and return all found games and roms within
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to be parsed</param>
|
||||
/// <param name="indexId">Index ID for the DAT</param>
|
||||
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
|
||||
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
|
||||
public void Parse(string filename, int indexId = 0, bool keep = false, bool keepext = false)
|
||||
{
|
||||
ParentablePath path = new ParentablePath(filename);
|
||||
Parse(path, indexId, keep, keepext);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a DAT and return all found games and roms within
|
||||
/// </summary>
|
||||
|
||||
@@ -126,10 +126,10 @@ namespace SabreTools.Library.DatFiles
|
||||
public DatFormat DatFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of fields in machine and items to exclude from writing
|
||||
/// Dictionary of fields in machine and items to exclude from writing
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool[] ExcludeFields { get; set; } = new bool[Enum.GetNames(typeof(Field)).Length];
|
||||
public List<Field> ExcludeFields { get; set; } = new List<Field>();
|
||||
|
||||
/// <summary>
|
||||
/// Enable "One Rom, One Region (1G1R)" mode
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace SabreTools.Library.DatFiles
|
||||
var rom = datItem as Rom;
|
||||
cmpw.WriteStartElement("file");
|
||||
cmpw.WriteAttributeString("name", datItem.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.Size] && rom.Size != -1)
|
||||
if (!Header.ExcludeFields.Contains(Field.Size) && rom.Size != -1)
|
||||
cmpw.WriteAttributeString("size", rom.Size.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Date, Header.ExcludeFields)))
|
||||
cmpw.WriteAttributeString("date", rom.Date);
|
||||
|
||||
@@ -287,6 +287,12 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
public bool RemoveUnicode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields based on Header values
|
||||
/// </summary>
|
||||
/// TODO: Remove in lieu of relying on Header value
|
||||
public bool RemoveFields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Include root directory when determing trim sizes
|
||||
/// </summary>
|
||||
@@ -877,6 +883,10 @@ namespace SabreTools.Library.DatFiles
|
||||
// Run the one rom per game logic, if required
|
||||
if (datFile.Header.OneRom)
|
||||
OneRomPerGame(datFile);
|
||||
|
||||
// If we are removing fields, do that now
|
||||
if (RemoveFields)
|
||||
RemoveFieldsFromItems(datFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -987,6 +997,10 @@ namespace SabreTools.Library.DatFiles
|
||||
// Run the one rom per game logic, if required
|
||||
if (outDat.Header.OneRom)
|
||||
OneRomPerGame(outDat);
|
||||
|
||||
// If we are removing fields, do that now
|
||||
if (RemoveFields)
|
||||
RemoveFieldsFromItems(outDat);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -2061,6 +2075,220 @@ namespace SabreTools.Library.DatFiles
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields as per the header
|
||||
/// </summary>
|
||||
/// <param name="datFile">DatFile to filter</param>
|
||||
private void RemoveFieldsFromItems(DatFile datFile)
|
||||
{
|
||||
// Output the logging statement
|
||||
Globals.Logger.User("Removing filtered fields");
|
||||
|
||||
// Get the array of fields from the header
|
||||
List<Field> fields = datFile.Header.ExcludeFields;
|
||||
|
||||
// Now process all of the roms
|
||||
Parallel.ForEach(datFile.Items.Keys, Globals.ParallelOptions, key =>
|
||||
{
|
||||
List<DatItem> items = datFile.Items[key];
|
||||
for (int j = 0; j < items.Count; j++)
|
||||
{
|
||||
DatItem item = items[j];
|
||||
|
||||
// TODO: Switch statement
|
||||
foreach (Field field in fields)
|
||||
{
|
||||
// Machine Fields
|
||||
if (field == Field.MachineName)
|
||||
item.MachineName = null;
|
||||
if (field == Field.Comment)
|
||||
item.Comment = null;
|
||||
if (field == Field.Description)
|
||||
item.MachineDescription = null;
|
||||
if (field == Field.Year)
|
||||
item.Year = null;
|
||||
if (field == Field.Manufacturer)
|
||||
item.Manufacturer = null;
|
||||
if (field == Field.Publisher)
|
||||
item.Publisher = null;
|
||||
if (field == Field.Category)
|
||||
item.Category = null;
|
||||
if (field == Field.RomOf)
|
||||
item.RomOf = null;
|
||||
if (field == Field.CloneOf)
|
||||
item.CloneOf = null;
|
||||
if (field == Field.SampleOf)
|
||||
item.SampleOf = null;
|
||||
if (field == Field.Supported)
|
||||
item.Supported = null;
|
||||
if (field == Field.SourceFile)
|
||||
item.SourceFile = null;
|
||||
if (field == Field.Runnable)
|
||||
item.Runnable = null;
|
||||
if (field == Field.Board)
|
||||
item.Board = null;
|
||||
if (field == Field.RebuildTo)
|
||||
item.RebuildTo = null;
|
||||
if (field == Field.Devices)
|
||||
item.Devices = null;
|
||||
if (field == Field.SlotOptions)
|
||||
item.SlotOptions = null;
|
||||
if (field == Field.Infos)
|
||||
item.Infos = null;
|
||||
if (field == Field.MachineType)
|
||||
item.MachineType = MachineType.NULL;
|
||||
|
||||
// Item Fields
|
||||
if (field == Field.Name)
|
||||
item.Name = null;
|
||||
if (field == Field.PartName)
|
||||
item.PartName = null;
|
||||
if (field == Field.PartInterface)
|
||||
item.PartInterface = null;
|
||||
if (field == Field.Features)
|
||||
item.Features = null;
|
||||
if (field == Field.AreaName)
|
||||
item.AreaName = null;
|
||||
if (field == Field.AreaSize)
|
||||
item.AreaSize = null;
|
||||
if (field == Field.Default)
|
||||
{
|
||||
if (item.ItemType == ItemType.BiosSet)
|
||||
(item as BiosSet).Default = null;
|
||||
else if (item.ItemType == ItemType.Release)
|
||||
(item as Release).Default = null;
|
||||
}
|
||||
if (field == Field.BiosDescription)
|
||||
{
|
||||
if (item.ItemType == ItemType.BiosSet)
|
||||
(item as BiosSet).Description = null;
|
||||
}
|
||||
if (field == Field.Size)
|
||||
{
|
||||
if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).Size = 0;
|
||||
}
|
||||
if (field == Field.CRC)
|
||||
{
|
||||
if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).CRC = null;
|
||||
}
|
||||
if (field == Field.MD5)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).MD5 = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).MD5 = null;
|
||||
}
|
||||
#if NET_FRAMEWORK
|
||||
if (field == Field.RIPEMD160)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).RIPEMD160 = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).RIPEMD160 = null;
|
||||
}
|
||||
#endif
|
||||
if (field == Field.SHA1)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).SHA1 = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).SHA1 = null;
|
||||
}
|
||||
if (field == Field.SHA256)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).SHA256 = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).SHA256 = null;
|
||||
}
|
||||
if (field == Field.SHA384)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).SHA384 = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).SHA384 = null;
|
||||
}
|
||||
if (field == Field.SHA512)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).SHA512 = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).SHA512 = null;
|
||||
}
|
||||
if (field == Field.Merge)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).MergeTag = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).MergeTag = null;
|
||||
}
|
||||
if (field == Field.Region)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).Region = null;
|
||||
else if (item.ItemType == ItemType.Release)
|
||||
(item as Release).Region = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).Region = null;
|
||||
}
|
||||
if (field == Field.Index)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).Index = null;
|
||||
}
|
||||
if (field == Field.Writable)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).Writable = null;
|
||||
}
|
||||
if (field == Field.Optional)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).Optional = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).Optional = null;
|
||||
}
|
||||
if (field == Field.Status)
|
||||
{
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).ItemStatus = ItemStatus.NULL;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).ItemStatus = ItemStatus.NULL;
|
||||
}
|
||||
if (field == Field.Language)
|
||||
{
|
||||
if (item.ItemType == ItemType.Release)
|
||||
(item as Release).Language = null;
|
||||
}
|
||||
if (field == Field.Date)
|
||||
{
|
||||
if (item.ItemType == ItemType.Release)
|
||||
(item as Release).Date = null;
|
||||
else if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).Date = null;
|
||||
}
|
||||
if (field == Field.Bios)
|
||||
{
|
||||
if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).Bios = null;
|
||||
}
|
||||
if (field == Field.Offset)
|
||||
{
|
||||
if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).Offset = null;
|
||||
}
|
||||
}
|
||||
|
||||
items[j] = item;
|
||||
}
|
||||
|
||||
datFile.Items.Remove(key);
|
||||
datFile.Items.AddRange(key, items);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strip the dates from the beginning of scene-style set names
|
||||
/// </summary>
|
||||
|
||||
@@ -1043,7 +1043,7 @@ namespace SabreTools.Library.DatFiles
|
||||
jtw.WritePropertyName("sampleof");
|
||||
jtw.WriteValue(datItem.SampleOf);
|
||||
}
|
||||
if (!Header.ExcludeFields[(int)Field.Supported] && datItem.Supported != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Supported) && datItem.Supported != null)
|
||||
{
|
||||
if (datItem.Supported == true)
|
||||
{
|
||||
@@ -1061,7 +1061,7 @@ namespace SabreTools.Library.DatFiles
|
||||
jtw.WritePropertyName("sourcefile");
|
||||
jtw.WriteValue(datItem.SourceFile);
|
||||
}
|
||||
if (!Header.ExcludeFields[(int)Field.Runnable] && datItem.Runnable != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Runnable) && datItem.Runnable != null)
|
||||
{
|
||||
if (datItem.Runnable == true)
|
||||
{
|
||||
@@ -1120,7 +1120,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
jtw.WriteEndArray();
|
||||
}
|
||||
if (!Header.ExcludeFields[(int)Field.MachineType])
|
||||
if (!Header.ExcludeFields.Contains(Field.MachineType))
|
||||
{
|
||||
if (datItem.MachineType.HasFlag(MachineType.Bios))
|
||||
{
|
||||
@@ -1223,7 +1223,7 @@ namespace SabreTools.Library.DatFiles
|
||||
jtw.WritePropertyName("description");
|
||||
jtw.WriteValue(biosSet.Description);
|
||||
}
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && biosSet.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && biosSet.Default != null)
|
||||
{
|
||||
jtw.WritePropertyName("default");
|
||||
jtw.WriteValue(biosSet.Default);
|
||||
@@ -1287,7 +1287,7 @@ namespace SabreTools.Library.DatFiles
|
||||
jtw.WritePropertyName("writable");
|
||||
jtw.WriteValue(disk.Writable);
|
||||
}
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus != ItemStatus.None)
|
||||
{
|
||||
jtw.WritePropertyName("status");
|
||||
jtw.WriteValue(disk.ItemStatus.ToString().ToLowerInvariant());
|
||||
@@ -1319,7 +1319,7 @@ namespace SabreTools.Library.DatFiles
|
||||
jtw.WritePropertyName("date");
|
||||
jtw.WriteValue(release.Date);
|
||||
}
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && release.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && release.Default != null)
|
||||
{
|
||||
jtw.WritePropertyName("default");
|
||||
jtw.WriteValue(release.Default);
|
||||
@@ -1331,7 +1331,7 @@ namespace SabreTools.Library.DatFiles
|
||||
jtw.WriteValue("rom");
|
||||
jtw.WritePropertyName("name");
|
||||
jtw.WriteValue(rom.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.Size] && rom.Size != -1)
|
||||
if (!Header.ExcludeFields.Contains(Field.Size) && rom.Size != -1)
|
||||
{
|
||||
jtw.WritePropertyName("size");
|
||||
jtw.WriteValue(rom.Size);
|
||||
@@ -1398,7 +1398,7 @@ namespace SabreTools.Library.DatFiles
|
||||
jtw.WritePropertyName("date");
|
||||
jtw.WriteValue(rom.Date);
|
||||
}
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus != ItemStatus.None)
|
||||
{
|
||||
jtw.WritePropertyName("status");
|
||||
jtw.WriteValue(rom.ItemStatus.ToString().ToLowerInvariant());
|
||||
|
||||
@@ -399,11 +399,11 @@ namespace SabreTools.Library.DatFiles
|
||||
sw.Write($"{disk.Name} ");
|
||||
|
||||
// If we have a baddump, put the first indicator
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus == ItemStatus.BadDump)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus == ItemStatus.BadDump)
|
||||
sw.Write(" BAD");
|
||||
|
||||
// If we have a nodump, write out the indicator
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus == ItemStatus.Nodump)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus == ItemStatus.Nodump)
|
||||
sw.Write(" NO GOOD DUMP KNOWN");
|
||||
|
||||
// Otherwise, write out the SHA-1 hash
|
||||
@@ -411,7 +411,7 @@ namespace SabreTools.Library.DatFiles
|
||||
sw.Write($" SHA1({disk.SHA1})");
|
||||
|
||||
// If we have a baddump, put the second indicator
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus == ItemStatus.BadDump)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus == ItemStatus.BadDump)
|
||||
sw.Write(" BAD_DUMP");
|
||||
|
||||
sw.Write("\n");
|
||||
@@ -431,11 +431,11 @@ namespace SabreTools.Library.DatFiles
|
||||
sw.Write(rom.Size);
|
||||
|
||||
// If we have a baddump, put the first indicator
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus == ItemStatus.BadDump)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus == ItemStatus.BadDump)
|
||||
sw.Write(" BAD");
|
||||
|
||||
// If we have a nodump, write out the indicator
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus == ItemStatus.Nodump)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus == ItemStatus.Nodump)
|
||||
{
|
||||
sw.Write(" NO GOOD DUMP KNOWN");
|
||||
}
|
||||
@@ -449,7 +449,7 @@ namespace SabreTools.Library.DatFiles
|
||||
}
|
||||
|
||||
// If we have a baddump, put the second indicator
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus == ItemStatus.BadDump)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus == ItemStatus.BadDump)
|
||||
sw.Write(" BAD_DUMP");
|
||||
|
||||
sw.Write("\n");
|
||||
|
||||
@@ -681,7 +681,7 @@ namespace SabreTools.Library.DatFiles
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.SourceFile, Header.ExcludeFields)))
|
||||
xtw.WriteElementString("sourcefile", datItem.SourceFile);
|
||||
|
||||
if (!Header.ExcludeFields[(int)Field.MachineType])
|
||||
if (!Header.ExcludeFields.Contains(Field.MachineType))
|
||||
{
|
||||
if (datItem.MachineType.HasFlag(MachineType.Bios))
|
||||
xtw.WriteAttributeString("isbios", "yes");
|
||||
@@ -691,7 +691,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("ismechanical", "yes");
|
||||
}
|
||||
|
||||
if (!Header.ExcludeFields[(int)Field.Runnable])
|
||||
if (!Header.ExcludeFields.Contains(Field.Runnable))
|
||||
{
|
||||
if (datItem.Runnable == true)
|
||||
xtw.WriteAttributeString("runnable", "yes");
|
||||
@@ -715,7 +715,7 @@ namespace SabreTools.Library.DatFiles
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Category, Header.ExcludeFields)))
|
||||
xtw.WriteElementString("category", datItem.Category);
|
||||
|
||||
if (!Header.ExcludeFields[(int)Field.Infos] && datItem.Infos != null && datItem.Infos.Count > 0)
|
||||
if (!Header.ExcludeFields.Contains(Field.Infos) && datItem.Infos != null && datItem.Infos.Count > 0)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> kvp in datItem.Infos)
|
||||
{
|
||||
@@ -787,7 +787,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("name", biosSet.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.BiosDescription, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("description", biosSet.Description);
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && biosSet.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && biosSet.Default != null)
|
||||
xtw.WriteAttributeString("default", biosSet.Default.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -816,11 +816,11 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("region", disk.Region);
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Index, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("index", disk.Index);
|
||||
if (!Header.ExcludeFields[(int)Field.Writable] && disk.Writable != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Writable) && disk.Writable != null)
|
||||
xtw.WriteAttributeString("writable", disk.Writable == true ? "yes" : "no");
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus != ItemStatus.None)
|
||||
xtw.WriteAttributeString("status", disk.ItemStatus.ToString());
|
||||
if (!Header.ExcludeFields[(int)Field.Optional] && disk.Optional != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Optional) && disk.Optional != null)
|
||||
xtw.WriteAttributeString("optional", disk.Optional == true ? "yes" : "no");
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -829,7 +829,7 @@ namespace SabreTools.Library.DatFiles
|
||||
var rom = datItem as Rom;
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteAttributeString("name", rom.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.Size] && rom.Size != -1)
|
||||
if (!Header.ExcludeFields.Contains(Field.Size) && rom.Size != -1)
|
||||
xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.CRC, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
@@ -855,9 +855,9 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("region", rom.Region);
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Offset, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("offset", rom.Offset);
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus != ItemStatus.None)
|
||||
xtw.WriteAttributeString("status", rom.ItemStatus.ToString().ToLowerInvariant());
|
||||
if (!Header.ExcludeFields[(int)Field.Optional] && rom.Optional != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Optional) && rom.Optional != null)
|
||||
xtw.WriteAttributeString("optional", rom.Optional == true ? "yes" : "no");
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
@@ -859,7 +859,7 @@ namespace SabreTools.Library.DatFiles
|
||||
// Build the state based on excluded fields
|
||||
xtw.WriteStartElement(_deprecated ? "game" : "machine");
|
||||
xtw.WriteAttributeString("name", datItem.GetField(Field.MachineName, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.MachineType])
|
||||
if (!Header.ExcludeFields.Contains(Field.MachineType))
|
||||
{
|
||||
if (datItem.MachineType.HasFlag(MachineType.Bios))
|
||||
xtw.WriteAttributeString("isbios", "yes");
|
||||
@@ -869,7 +869,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("ismechanical", "yes");
|
||||
}
|
||||
|
||||
if (!Header.ExcludeFields[(int)Field.Runnable] && datItem.Runnable != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Runnable) && datItem.Runnable != null)
|
||||
{
|
||||
if (datItem.Runnable == true)
|
||||
xtw.WriteAttributeString("runnable", "yes");
|
||||
@@ -964,7 +964,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("name", biosSet.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.BiosDescription, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("description", biosSet.Description);
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && biosSet.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && biosSet.Default != null)
|
||||
xtw.WriteAttributeString("default", biosSet.Default.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -987,7 +987,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.SHA512, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus != ItemStatus.None)
|
||||
xtw.WriteAttributeString("status", disk.ItemStatus.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -1002,7 +1002,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("language", release.Language);
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Date, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("date", release.Date);
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && release.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && release.Default != null)
|
||||
xtw.WriteAttributeString("default", release.Default.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -1011,7 +1011,7 @@ namespace SabreTools.Library.DatFiles
|
||||
var rom = datItem as Rom;
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteAttributeString("name", rom.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.Size] && rom.Size != -1)
|
||||
if (!Header.ExcludeFields.Contains(Field.Size) && rom.Size != -1)
|
||||
xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.CRC, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
@@ -1031,7 +1031,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Date, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("date", rom.Date);
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus != ItemStatus.None)
|
||||
xtw.WriteAttributeString("status", rom.ItemStatus.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
@@ -777,8 +777,8 @@ namespace SabreTools.Library.DatFiles
|
||||
for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++)
|
||||
{
|
||||
xtw.WriteStartElement("directory");
|
||||
xtw.WriteAttributeString("name", !Header.ExcludeFields[(int)Field.MachineName] ? newsplit[i] : string.Empty);
|
||||
xtw.WriteAttributeString("description", !Header.ExcludeFields[(int)Field.MachineName] ? newsplit[i] : string.Empty);
|
||||
xtw.WriteAttributeString("name", !Header.ExcludeFields.Contains(Field.MachineName) ? newsplit[i] : string.Empty);
|
||||
xtw.WriteAttributeString("description", !Header.ExcludeFields.Contains(Field.MachineName) ? newsplit[i] : string.Empty);
|
||||
}
|
||||
|
||||
depth = depth - (last == -1 ? 0 : last) + newsplit.Count;
|
||||
@@ -879,7 +879,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("name", biosSet.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.BiosDescription, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("description", biosSet.Description);
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && biosSet.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && biosSet.Default != null)
|
||||
xtw.WriteAttributeString("default", biosSet.Default.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -903,7 +903,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.SHA512, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus != ItemStatus.None)
|
||||
{
|
||||
xtw.WriteStartElement("flags");
|
||||
|
||||
@@ -929,7 +929,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("language", release.Language);
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Date, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("date", release.Date);
|
||||
if (!Header.ExcludeFields[(int)Field.Default] && release.Default != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Default) && release.Default != null)
|
||||
xtw.WriteAttributeString("default", release.Default.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -939,7 +939,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "rom");
|
||||
xtw.WriteAttributeString("name", rom.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.Size] && rom.Size != -1)
|
||||
if (!Header.ExcludeFields.Contains(Field.Size) && rom.Size != -1)
|
||||
xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.CRC, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
@@ -959,7 +959,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Date, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("date", rom.Date);
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus != ItemStatus.None)
|
||||
{
|
||||
xtw.WriteStartElement("flags");
|
||||
|
||||
|
||||
@@ -701,7 +701,7 @@ namespace SabreTools.Library.DatFiles
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.CloneOf, Header.ExcludeFields)) && !string.Equals(datItem.MachineName, datItem.CloneOf, StringComparison.OrdinalIgnoreCase))
|
||||
xtw.WriteAttributeString("cloneof", datItem.CloneOf);
|
||||
|
||||
if (!Header.ExcludeFields[(int)Field.Supported])
|
||||
if (!Header.ExcludeFields.Contains(Field.Supported))
|
||||
{
|
||||
if (datItem.Supported == true)
|
||||
xtw.WriteAttributeString("supported", "yes");
|
||||
@@ -720,7 +720,7 @@ namespace SabreTools.Library.DatFiles
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Category, Header.ExcludeFields)))
|
||||
xtw.WriteElementString("category", datItem.Category);
|
||||
|
||||
if (!Header.ExcludeFields[(int)Field.Infos] && datItem.Infos != null && datItem.Infos.Count > 0)
|
||||
if (!Header.ExcludeFields.Contains(Field.Infos) && datItem.Infos != null && datItem.Infos.Count > 0)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> kvp in datItem.Infos)
|
||||
{
|
||||
@@ -788,7 +788,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("name", datItem.GetField(Field.PartName, Header.ExcludeFields));
|
||||
xtw.WriteAttributeString("interface", datItem.GetField(Field.PartInterface, Header.ExcludeFields));
|
||||
|
||||
if (!Header.ExcludeFields[(int)Field.Features] && datItem.Features != null && datItem.Features.Count > 0)
|
||||
if (!Header.ExcludeFields.Contains(Field.Features) && datItem.Features != null && datItem.Features.Count > 0)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> kvp in datItem.Features)
|
||||
{
|
||||
@@ -804,12 +804,12 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
case ItemType.Disk:
|
||||
var disk = datItem as Disk;
|
||||
if (!Header.ExcludeFields[(int)Field.AreaName] && string.IsNullOrWhiteSpace(areaName))
|
||||
if (!Header.ExcludeFields.Contains(Field.AreaName) && string.IsNullOrWhiteSpace(areaName))
|
||||
areaName = "cdrom";
|
||||
|
||||
xtw.WriteStartElement("diskarea");
|
||||
xtw.WriteAttributeString("name", areaName);
|
||||
if (!Header.ExcludeFields[(int)Field.AreaSize] && disk.AreaSize != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.AreaSize) && disk.AreaSize != null)
|
||||
xtw.WriteAttributeString("size", disk.AreaSize.ToString());
|
||||
|
||||
xtw.WriteStartElement("disk");
|
||||
@@ -828,9 +828,9 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.SHA512, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && disk.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && disk.ItemStatus != ItemStatus.None)
|
||||
xtw.WriteAttributeString("status", disk.ItemStatus.ToString().ToLowerInvariant());
|
||||
if (!Header.ExcludeFields[(int)Field.Writable] && disk.Writable != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.Writable) && disk.Writable != null)
|
||||
xtw.WriteAttributeString("writable", disk.Writable == true ? "yes" : "no");
|
||||
xtw.WriteEndElement();
|
||||
|
||||
@@ -840,17 +840,17 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
case ItemType.Rom:
|
||||
var rom = datItem as Rom;
|
||||
if (!Header.ExcludeFields[(int)Field.AreaName] && string.IsNullOrWhiteSpace(areaName))
|
||||
if (!Header.ExcludeFields.Contains(Field.AreaName) && string.IsNullOrWhiteSpace(areaName))
|
||||
areaName = "rom";
|
||||
|
||||
xtw.WriteStartElement("dataarea");
|
||||
xtw.WriteAttributeString("name", areaName);
|
||||
if (!Header.ExcludeFields[(int)Field.AreaSize] && rom.AreaSize != null)
|
||||
if (!Header.ExcludeFields.Contains(Field.AreaSize) && rom.AreaSize != null)
|
||||
xtw.WriteAttributeString("size", rom.AreaSize.ToString());
|
||||
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteAttributeString("name", rom.GetField(Field.Name, Header.ExcludeFields));
|
||||
if (!Header.ExcludeFields[(int)Field.Size] && rom.Size != -1)
|
||||
if (!Header.ExcludeFields.Contains(Field.Size) && rom.Size != -1)
|
||||
xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.CRC, Header.ExcludeFields)))
|
||||
xtw.WriteAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
@@ -872,7 +872,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("offset", rom.Offset);
|
||||
//if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Value, DatHeader.ExcludeFields)))
|
||||
// xtw.WriteAttributeString("value", rom.Value);
|
||||
if (!Header.ExcludeFields[(int)Field.Status] && rom.ItemStatus != ItemStatus.None)
|
||||
if (!Header.ExcludeFields.Contains(Field.Status) && rom.ItemStatus != ItemStatus.None)
|
||||
xtw.WriteAttributeString("status", rom.ItemStatus.ToString().ToLowerInvariant());
|
||||
//if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Loadflag, DatHeader.ExcludeFields)))
|
||||
// xtw.WriteAttributeString("loadflag", rom.Loadflag);
|
||||
|
||||
@@ -613,10 +613,10 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Get the value of that field as a string, if possible
|
||||
/// </summary>
|
||||
public string GetField(Field field, bool[] excludeFields)
|
||||
public string GetField(Field field, List<Field> excludeFields)
|
||||
{
|
||||
// If the field is to be excluded, return empty string
|
||||
if (excludeFields[(int)field])
|
||||
if (excludeFields.Contains(field))
|
||||
return string.Empty;
|
||||
|
||||
string fieldValue = null;
|
||||
|
||||
@@ -2231,7 +2231,7 @@ Some special strings that can be used:
|
||||
|
||||
foreach (string fieldName in GetList(features, ExcludeFieldListValue))
|
||||
{
|
||||
datHeader.ExcludeFields[(int)fieldName.AsField()] = true;
|
||||
datHeader.ExcludeFields.Add(fieldName.AsField());
|
||||
}
|
||||
|
||||
return datHeader;
|
||||
|
||||
Reference in New Issue
Block a user