mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Reduce DedupeType enum to reasonable values
This commit is contained in:
@@ -174,19 +174,22 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
public enum DedupeType
|
||||
{
|
||||
/// <summary>
|
||||
/// No deduplication
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Deduplicate across all available fields
|
||||
/// </summary>
|
||||
/// <remarks>Requires sorting by any hash</remarks>
|
||||
Full,
|
||||
|
||||
// Force only deduping with certain types
|
||||
/// <summary>
|
||||
/// Deduplicate on a per-machine basis
|
||||
/// </summary>
|
||||
/// <remarks>Requires sorting by machine</remarks>
|
||||
Game,
|
||||
CRC,
|
||||
MD2,
|
||||
MD4,
|
||||
MD5,
|
||||
SHA1,
|
||||
SHA256,
|
||||
SHA384,
|
||||
SHA512,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -393,6 +393,10 @@ namespace SabreTools.DatFiles
|
||||
if (dedupeType == DedupeType.None)
|
||||
return;
|
||||
|
||||
// Ensure Game deduplication is valid
|
||||
if (dedupeType == DedupeType.Game && _bucketedBy != ItemKey.Machine)
|
||||
return;
|
||||
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
||||
#elif NET40_OR_GREATER
|
||||
@@ -407,8 +411,7 @@ namespace SabreTools.DatFiles
|
||||
// Sort the list of items to be consistent
|
||||
Sort(ref sortedList, false);
|
||||
|
||||
// If we're merging the roms, do so
|
||||
if (dedupeType == DedupeType.Full || (dedupeType == DedupeType.Game && _bucketedBy == ItemKey.Machine))
|
||||
// Merge the items
|
||||
sortedList = DatFileTool.Merge(sortedList);
|
||||
|
||||
// Add the list back to the dictionary
|
||||
|
||||
@@ -688,6 +688,10 @@ namespace SabreTools.DatFiles
|
||||
if (dedupeType == DedupeType.None)
|
||||
return;
|
||||
|
||||
// Ensure Game deduplication is valid
|
||||
if (dedupeType == DedupeType.Game && _bucketedBy != ItemKey.Machine)
|
||||
return;
|
||||
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
||||
#elif NET40_OR_GREATER
|
||||
@@ -702,8 +706,7 @@ namespace SabreTools.DatFiles
|
||||
// Sort the list of items to be consistent
|
||||
Sort(ref sortedList, false);
|
||||
|
||||
// If we're merging the roms, do so
|
||||
if (dedupeType == DedupeType.Full || (dedupeType == DedupeType.Game && _bucketedBy == ItemKey.Machine))
|
||||
// Merge the items
|
||||
sortedList = Merge(sortedList);
|
||||
|
||||
// Get all existing mappings
|
||||
|
||||
Reference in New Issue
Block a user