From ffc4e70728e3df9c1b54a3852fa13faa95866c29 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 28 Apr 2016 14:30:02 -0700 Subject: [PATCH] Add more processing code for OfflineMerge --- OfflineMerge/OfflineMerge.cs | 57 +++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/OfflineMerge/OfflineMerge.cs b/OfflineMerge/OfflineMerge.cs index f52505e0..0b55d9c9 100644 --- a/OfflineMerge/OfflineMerge.cs +++ b/OfflineMerge/OfflineMerge.cs @@ -71,13 +71,68 @@ namespace SabreTools /// /// Process the supplied inputs and create the three required outputs: - /// (a) Net-New - (currentWithReplaced)-(currentAllMerged) + /// (a) Net New - (currentWithReplaced)-(currentAllMerged) /// (b) New Missing - (a)+(currentAllMissing) /// (c) Unneeded - (currentAllMerged)-(currentWithReplaced) /// /// True if the files were created properly, false otherwise public bool Process() { + // First get the combination Dictionary of currentWithReplaced and currentAllMerged + Dictionary> completeDats = new Dictionary>(); + completeDats = RomManipulation.ParseDict(_currentAllMerged, 0, 0, completeDats, _logger); + completeDats = RomManipulation.ParseDict(_currentWithReplaced, 0, 0, completeDats, _logger); + + // Now get Net New output dictionary + Dictionary> netNew = new Dictionary>(); + foreach (string key in completeDats.Keys) + { + if (completeDats[key].Count == 1) + { + if (completeDats[key][0].System == _currentWithReplaced) + { + if (netNew.ContainsKey(key)) + { + netNew[key].Add(completeDats[key][0]); + } + else + { + List temp = new List(); + temp.Add(completeDats[key][0]); + netNew.Add(key, temp); + } + + } + } + } + + // Now create the New Missing dictionary + Dictionary> newMissing = new Dictionary>(netNew); + newMissing = RomManipulation.ParseDict(_currentAllMissing, 0, 0, newMissing, _logger); + + // Now create the Unneeded dictionary + Dictionary> unneeded = new Dictionary>(); + foreach (string key in completeDats.Keys) + { + if (completeDats[key].Count == 1) + { + if (completeDats[key][0].System == _currentAllMerged) + { + if (netNew.ContainsKey(key)) + { + netNew[key].Add(completeDats[key][0]); + } + else + { + List temp = new List(); + temp.Add(completeDats[key][0]); + netNew.Add(key, temp); + } + + } + } + } + return true; } }