From c96578bf33f2e1c1fe2f4ffd0ff65a914d145829 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 30 Mar 2017 16:03:58 -0700 Subject: [PATCH] [DatFile] Make merging logic consistent with CMP --- SabreTools.Helper/Dats/Partials/DatFile.Manipulate.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Manipulate.cs b/SabreTools.Helper/Dats/Partials/DatFile.Manipulate.cs index 9e3ef362..f6854804 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Manipulate.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Manipulate.cs @@ -801,9 +801,16 @@ namespace SabreTools.Helper.Dats // Otherwise, if the parent doesn't already contain the non-disk, add it else if (item.Type != ItemType.Disk && !this[parent].Contains(item)) { - item.Name = item.Machine.Name + "\\" + item.Name; + // If we already have the same name in the parent set, rename the child + if (this[parent].Select(i => i.Name).Contains(item.Name)) + { + item.Name = item.Machine.Name + "\\" + item.Name; // TODO: Go back to this for all roms in the future + } + + // Update the machine to be the new parent item.Machine = parentMachine; + // Add the rom to the parent set this[parent].Add(item); } }