mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Migrate unoffical keys
This commit is contained in:
@@ -219,11 +219,11 @@ namespace SabreTools.DatFiles
|
||||
TotalCount++;
|
||||
|
||||
// Increment removal count
|
||||
if (item.Remove)
|
||||
if (item.GetFieldValue<bool>(DatItem.RemoveKey))
|
||||
RemovedCount++;
|
||||
|
||||
// Increment the item count for the type
|
||||
AddItemCount(item.ItemType);
|
||||
AddItemCount(item.GetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey));
|
||||
|
||||
// Some item types require special processing
|
||||
switch (item)
|
||||
@@ -399,8 +399,8 @@ namespace SabreTools.DatFiles
|
||||
|
||||
// Filter the list
|
||||
return fi.Where(i => i != null)
|
||||
.Where(i => !i.Remove)
|
||||
.Where(i => i.Machine.GetFieldValue<string?>(Models.Metadata.Machine.NameKey) != null)
|
||||
.Where(i => !i.GetFieldValue<bool>(DatItem.RemoveKey))
|
||||
.Where(i => i.GetFieldValue<Machine>(DatItem.MachineKey)!.GetFieldValue<string?>(Models.Metadata.Machine.NameKey) != null)
|
||||
.ToConcurrentList();
|
||||
}
|
||||
}
|
||||
@@ -500,11 +500,11 @@ namespace SabreTools.DatFiles
|
||||
TotalCount--;
|
||||
|
||||
// Decrement removal count
|
||||
if (item.Remove)
|
||||
if (item.GetFieldValue<bool>(DatItem.RemoveKey))
|
||||
RemovedCount--;
|
||||
|
||||
// Decrement the item count for the type
|
||||
RemoveItemCount(item.ItemType);
|
||||
RemoveItemCount(item.GetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey));
|
||||
|
||||
// Some item types require special processing
|
||||
switch (item)
|
||||
@@ -889,7 +889,7 @@ namespace SabreTools.DatFiles
|
||||
#endif
|
||||
|
||||
// If there are no non-blank items, remove
|
||||
else if (!items[key]!.Any(i => i != null && i.ItemType != ItemType.Blank))
|
||||
else if (!items[key]!.Any(i => i != null && i is not Blank))
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
items.TryRemove(key, out _);
|
||||
#else
|
||||
@@ -907,7 +907,7 @@ namespace SabreTools.DatFiles
|
||||
foreach (string key in keys)
|
||||
{
|
||||
ConcurrentList<DatItem>? oldItemList = items[key];
|
||||
ConcurrentList<DatItem>? newItemList = oldItemList?.Where(i => !i.Remove)?.ToConcurrentList();
|
||||
ConcurrentList<DatItem>? newItemList = oldItemList?.Where(i => !i.GetFieldValue<bool>(DatItem.RemoveKey))?.ToConcurrentList();
|
||||
|
||||
Remove(key);
|
||||
AddRange(key, newItemList);
|
||||
@@ -944,12 +944,12 @@ namespace SabreTools.DatFiles
|
||||
for (int i = 0; i < roms.Count; i++)
|
||||
{
|
||||
DatItem other = roms[i];
|
||||
if (other.Remove)
|
||||
if (other.GetFieldValue<bool>(DatItem.RemoveKey))
|
||||
continue;
|
||||
|
||||
if (datItem.Equals(other))
|
||||
{
|
||||
other.Remove = true;
|
||||
other.SetFieldValue<bool>(DatItem.RemoveKey, true);
|
||||
output.Add(other);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user