mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add back non-null markers for old .NET
This commit is contained in:
@@ -1210,7 +1210,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = this[romOf];
|
var parentItems = this[romOf!];
|
||||||
if (parentItems == null || parentItems.Count == 0)
|
if (parentItems == null || parentItems.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1397,7 +1397,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = this[cloneOf];
|
var parentItems = this[cloneOf!];
|
||||||
if (parentItems == null || parentItems.Count == 0)
|
if (parentItems == null || parentItems.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1416,7 +1416,7 @@ namespace SabreTools.DatFiles
|
|||||||
|
|
||||||
// Now we want to get the parent romof tag and put it in each of the items
|
// Now we want to get the parent romof tag and put it in each of the items
|
||||||
items = this[game];
|
items = this[game];
|
||||||
string? romof = this[cloneOf]![0].GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.RomOfKey);
|
string? romof = this[cloneOf!]![0].GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.RomOfKey);
|
||||||
foreach (DatItem item in items!)
|
foreach (DatItem item in items!)
|
||||||
{
|
{
|
||||||
item.GetFieldValue<Machine>(DatItem.MachineKey)!.SetFieldValue<string?>(Models.Metadata.Machine.RomOfKey, romof);
|
item.GetFieldValue<Machine>(DatItem.MachineKey)!.SetFieldValue<string?>(Models.Metadata.Machine.RomOfKey, romof);
|
||||||
@@ -1450,7 +1450,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Get the parent items
|
// Get the parent items
|
||||||
var parentItems = this[cloneOf];
|
var parentItems = this[cloneOf!];
|
||||||
|
|
||||||
// Otherwise, move the items from the current game to a subfolder of the parent game
|
// Otherwise, move the items from the current game to a subfolder of the parent game
|
||||||
DatItem copyFrom;
|
DatItem copyFrom;
|
||||||
@@ -1474,7 +1474,7 @@ namespace SabreTools.DatFiles
|
|||||||
string? mergeTag = disk.GetStringFieldValue(Models.Metadata.Disk.MergeKey);
|
string? mergeTag = disk.GetStringFieldValue(Models.Metadata.Disk.MergeKey);
|
||||||
|
|
||||||
// If the merge tag exists and the parent already contains it, skip
|
// If the merge tag exists and the parent already contains it, skip
|
||||||
if (mergeTag != null && this[cloneOf]!
|
if (mergeTag != null && this[cloneOf!]!
|
||||||
.Where(i => i is Disk)
|
.Where(i => i is Disk)
|
||||||
.Select(i => (i as Disk)!.GetName()).Contains(mergeTag))
|
.Select(i => (i as Disk)!.GetName()).Contains(mergeTag))
|
||||||
{
|
{
|
||||||
@@ -1482,19 +1482,19 @@ namespace SabreTools.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the merge tag exists but the parent doesn't contain it, add to parent
|
// If the merge tag exists but the parent doesn't contain it, add to parent
|
||||||
else if (mergeTag != null && !this[cloneOf]!
|
else if (mergeTag != null && !this[cloneOf!]!
|
||||||
.Where(i => i is Disk)
|
.Where(i => i is Disk)
|
||||||
.Select(i => (i as Disk)!.GetName()).Contains(mergeTag))
|
.Select(i => (i as Disk)!.GetName()).Contains(mergeTag))
|
||||||
{
|
{
|
||||||
disk.CopyMachineInformation(copyFrom);
|
disk.CopyMachineInformation(copyFrom);
|
||||||
Add(cloneOf, disk);
|
Add(cloneOf!, disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is no merge tag, add to parent
|
// If there is no merge tag, add to parent
|
||||||
else if (mergeTag == null)
|
else if (mergeTag == null)
|
||||||
{
|
{
|
||||||
disk.CopyMachineInformation(copyFrom);
|
disk.CopyMachineInformation(copyFrom);
|
||||||
Add(cloneOf, disk);
|
Add(cloneOf!, disk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1502,7 +1502,7 @@ namespace SabreTools.DatFiles
|
|||||||
else if (item is Rom rom)
|
else if (item is Rom rom)
|
||||||
{
|
{
|
||||||
// If the merge tag exists and the parent already contains it, skip
|
// If the merge tag exists and the parent already contains it, skip
|
||||||
if (rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey) != null && this[cloneOf]!
|
if (rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey) != null && this[cloneOf!]!
|
||||||
.Where(i => i is Rom).Select(i => (i as Rom)!.GetName())
|
.Where(i => i is Rom).Select(i => (i as Rom)!.GetName())
|
||||||
.Contains(rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey)))
|
.Contains(rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey)))
|
||||||
{
|
{
|
||||||
@@ -1510,7 +1510,7 @@ namespace SabreTools.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the merge tag exists but the parent doesn't contain it, add to subfolder of parent
|
// If the merge tag exists but the parent doesn't contain it, add to subfolder of parent
|
||||||
else if (rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey) != null && !this[cloneOf]!
|
else if (rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey) != null && !this[cloneOf!]!
|
||||||
.Where(i => i is Rom).Select(i => (i as Rom)!.GetName())
|
.Where(i => i is Rom).Select(i => (i as Rom)!.GetName())
|
||||||
.Contains(rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey)))
|
.Contains(rom.GetStringFieldValue(Models.Metadata.Rom.MergeKey)))
|
||||||
{
|
{
|
||||||
@@ -1518,28 +1518,28 @@ namespace SabreTools.DatFiles
|
|||||||
rom.SetName($"{rom.GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.NameKey)}\\{rom.GetName()}");
|
rom.SetName($"{rom.GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.NameKey)}\\{rom.GetName()}");
|
||||||
|
|
||||||
rom.CopyMachineInformation(copyFrom);
|
rom.CopyMachineInformation(copyFrom);
|
||||||
Add(cloneOf, rom);
|
Add(cloneOf!, rom);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the parent doesn't already contain this item, add to subfolder of parent
|
// If the parent doesn't already contain this item, add to subfolder of parent
|
||||||
else if (!this[cloneOf]!.Contains(item) || skipDedup)
|
else if (!this[cloneOf!]!.Contains(item) || skipDedup)
|
||||||
{
|
{
|
||||||
if (subfolder)
|
if (subfolder)
|
||||||
rom.SetName($"{item.GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.NameKey)}\\{rom.GetName()}");
|
rom.SetName($"{item.GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.NameKey)}\\{rom.GetName()}");
|
||||||
|
|
||||||
rom.CopyMachineInformation(copyFrom);
|
rom.CopyMachineInformation(copyFrom);
|
||||||
Add(cloneOf, rom);
|
Add(cloneOf!, rom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All other that would be missing to subfolder of parent
|
// All other that would be missing to subfolder of parent
|
||||||
else if (!this[cloneOf]!.Contains(item))
|
else if (!this[cloneOf!]!.Contains(item))
|
||||||
{
|
{
|
||||||
if (subfolder)
|
if (subfolder)
|
||||||
item.SetName($"{item.GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.NameKey)}\\{item.GetName()}");
|
item.SetName($"{item.GetFieldValue<Machine>(DatItem.MachineKey)!.GetStringFieldValue(Models.Metadata.Machine.NameKey)}\\{item.GetName()}");
|
||||||
|
|
||||||
item.CopyMachineInformation(copyFrom);
|
item.CopyMachineInformation(copyFrom);
|
||||||
Add(cloneOf, item);
|
Add(cloneOf!, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1605,7 +1605,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = this[romOf];
|
var parentItems = this[romOf!];
|
||||||
if (parentItems == null || parentItems.Count == 0)
|
if (parentItems == null || parentItems.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1645,7 +1645,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = this[cloneOf];
|
var parentItems = this[cloneOf!];
|
||||||
if (parentItems == null || parentItems.Count == 0)
|
if (parentItems == null || parentItems.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -1638,7 +1638,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = GetItemsForBucket(romOf);
|
var parentItems = GetItemsForBucket(romOf!);
|
||||||
if (parentItems == null || parentItems.Length == 0)
|
if (parentItems == null || parentItems.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1845,7 +1845,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = GetItemsForBucket(cloneOf);
|
var parentItems = GetItemsForBucket(cloneOf!);
|
||||||
if (parentItems == null || parentItems.Length == 0)
|
if (parentItems == null || parentItems.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1861,7 +1861,7 @@ namespace SabreTools.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the parent machine
|
// Get the parent machine
|
||||||
var parentMachine = GetMachineForItem(GetItemsForBucket(cloneOf)![0].Item1);
|
var parentMachine = GetMachineForItem(GetItemsForBucket(cloneOf!)![0].Item1);
|
||||||
if (parentMachine.Item2 == null)
|
if (parentMachine.Item2 == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1913,7 +1913,7 @@ namespace SabreTools.DatFiles
|
|||||||
foreach ((long, DatItem) item in items!)
|
foreach ((long, DatItem) item in items!)
|
||||||
{
|
{
|
||||||
// Get the parent items and current machine name
|
// Get the parent items and current machine name
|
||||||
var parentItems = GetItemsForBucket(cloneOf);
|
var parentItems = GetItemsForBucket(cloneOf!);
|
||||||
string? machineName = GetMachineForItem(item.Item1).Item2?.GetStringFieldValue(Models.Metadata.Machine.NameKey);
|
string? machineName = GetMachineForItem(item.Item1).Item2?.GetStringFieldValue(Models.Metadata.Machine.NameKey);
|
||||||
|
|
||||||
// Special disk handling
|
// Special disk handling
|
||||||
@@ -1937,14 +1937,14 @@ namespace SabreTools.DatFiles
|
|||||||
.Contains(mergeTag))
|
.Contains(mergeTag))
|
||||||
{
|
{
|
||||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||||
_buckets[cloneOf].Add(disk);
|
_buckets[cloneOf!].Add(disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is no merge tag, add to parent
|
// If there is no merge tag, add to parent
|
||||||
else if (mergeTag == null)
|
else if (mergeTag == null)
|
||||||
{
|
{
|
||||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||||
_buckets[cloneOf].Add(disk);
|
_buckets[cloneOf!].Add(disk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1970,7 +1970,7 @@ namespace SabreTools.DatFiles
|
|||||||
rom.SetName($"{machineName}\\{rom.GetName()}");
|
rom.SetName($"{machineName}\\{rom.GetName()}");
|
||||||
|
|
||||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||||
_buckets[cloneOf].Add(rom);
|
_buckets[cloneOf!].Add(rom);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the parent doesn't already contain this item, add to subfolder of parent
|
// If the parent doesn't already contain this item, add to subfolder of parent
|
||||||
@@ -1980,7 +1980,7 @@ namespace SabreTools.DatFiles
|
|||||||
rom.SetName($"{machineName}\\{rom.GetName()}");
|
rom.SetName($"{machineName}\\{rom.GetName()}");
|
||||||
|
|
||||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||||
_buckets[cloneOf].Add(rom);
|
_buckets[cloneOf!].Add(rom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1991,7 +1991,7 @@ namespace SabreTools.DatFiles
|
|||||||
item.Item2.SetName($"{machineName}\\{item.Item2.GetName()}");
|
item.Item2.SetName($"{machineName}\\{item.Item2.GetName()}");
|
||||||
|
|
||||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||||
_buckets[cloneOf].Add(item);
|
_buckets[cloneOf!].Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2064,7 +2064,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = GetItemsForBucket(romOf);
|
var parentItems = GetItemsForBucket(romOf!);
|
||||||
if (parentItems == null || parentItems.Length == 0)
|
if (parentItems == null || parentItems.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2104,7 +2104,7 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the parent doesn't have any items, we want to continue
|
// If the parent doesn't have any items, we want to continue
|
||||||
var parentItems = GetItemsForBucket(cloneOf);
|
var parentItems = GetItemsForBucket(cloneOf!);
|
||||||
if (parentItems == null || parentItems.Length == 0)
|
if (parentItems == null || parentItems.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2120,7 +2120,7 @@ namespace SabreTools.DatFiles
|
|||||||
|
|
||||||
// Now we want to get the parent romof tag and put it in each of the remaining items
|
// Now we want to get the parent romof tag and put it in each of the remaining items
|
||||||
items = GetItemsForBucket(game);
|
items = GetItemsForBucket(game);
|
||||||
machine = GetMachineForItem(GetItemsForBucket(cloneOf)![0].Item1);
|
machine = GetMachineForItem(GetItemsForBucket(cloneOf!)![0].Item1);
|
||||||
if (machine.Item2 == null)
|
if (machine.Item2 == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user