mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
An attempt to make diffing work the way I think it should
Basically, if a rom is a duplicate, it can be a duplicate within a system or source or across system or source, and by hash alone or by all data matching. The four combinations make an enum now and the diff function is the only one that uses them right now. If we're in dedup mode, we want to check hashes only in diff. Otherwise, we want to check against ones that match all information. This needs field testing.
This commit is contained in:
@@ -100,23 +100,40 @@ namespace SabreTools
|
||||
}
|
||||
|
||||
// Create a dictionary of all ROMs from the input DATs
|
||||
int i = 0;
|
||||
Dictionary<string, List<RomData>> dict = new Dictionary<string, List<RomData>>();
|
||||
foreach (string input in _inputs)
|
||||
{
|
||||
_logger.User("Adding DAT: " + input);
|
||||
dict = RomManipulation.ParseDict(input, 0, 0, dict, _logger);
|
||||
dict = RomManipulation.ParseDict(input, i, 0, dict, _logger);
|
||||
i++;
|
||||
}
|
||||
|
||||
// Modify the Dictionary if necessary and output the results
|
||||
if (_diff || _ad)
|
||||
{
|
||||
// Get all entries that have only one item in their list
|
||||
// Get all entries that don't have External dupes
|
||||
Dictionary<string, List<RomData>> diffed = new Dictionary<string, List<RomData>>();
|
||||
foreach (string key in dict.Keys)
|
||||
{
|
||||
if (dict[key].Count == 1)
|
||||
List<RomData> temp = dict[key];
|
||||
temp = RomManipulation.Merge(temp);
|
||||
|
||||
foreach (RomData rom in temp)
|
||||
{
|
||||
diffed.Add(key, dict[key]);
|
||||
if ((_dedup && rom.Dupe != DupeType.InternalHash) || (!_dedup && rom.Dupe != DupeType.InternalAll))
|
||||
{
|
||||
if (diffed.ContainsKey(key))
|
||||
{
|
||||
diffed[key].Add(rom);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<RomData> tl = new List<RomData>();
|
||||
tl.Add(rom);
|
||||
diffed.Add(key, tl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user