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>
|
/// </summary>
|
||||||
public enum DedupeType
|
public enum DedupeType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// No deduplication
|
||||||
|
/// </summary>
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deduplicate across all available fields
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Requires sorting by any hash</remarks>
|
||||||
Full,
|
Full,
|
||||||
|
|
||||||
// Force only deduping with certain types
|
/// <summary>
|
||||||
|
/// Deduplicate on a per-machine basis
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Requires sorting by machine</remarks>
|
||||||
Game,
|
Game,
|
||||||
CRC,
|
|
||||||
MD2,
|
|
||||||
MD4,
|
|
||||||
MD5,
|
|
||||||
SHA1,
|
|
||||||
SHA256,
|
|
||||||
SHA384,
|
|
||||||
SHA512,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -393,6 +393,10 @@ namespace SabreTools.DatFiles
|
|||||||
if (dedupeType == DedupeType.None)
|
if (dedupeType == DedupeType.None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Ensure Game deduplication is valid
|
||||||
|
if (dedupeType == DedupeType.Game && _bucketedBy != ItemKey.Machine)
|
||||||
|
return;
|
||||||
|
|
||||||
#if NET452_OR_GREATER || NETCOREAPP
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
||||||
#elif NET40_OR_GREATER
|
#elif NET40_OR_GREATER
|
||||||
@@ -407,9 +411,8 @@ namespace SabreTools.DatFiles
|
|||||||
// Sort the list of items to be consistent
|
// Sort the list of items to be consistent
|
||||||
Sort(ref sortedList, false);
|
Sort(ref sortedList, false);
|
||||||
|
|
||||||
// If we're merging the roms, do so
|
// Merge the items
|
||||||
if (dedupeType == DedupeType.Full || (dedupeType == DedupeType.Game && _bucketedBy == ItemKey.Machine))
|
sortedList = DatFileTool.Merge(sortedList);
|
||||||
sortedList = DatFileTool.Merge(sortedList);
|
|
||||||
|
|
||||||
// Add the list back to the dictionary
|
// Add the list back to the dictionary
|
||||||
RemoveBucket(key);
|
RemoveBucket(key);
|
||||||
|
|||||||
@@ -688,6 +688,10 @@ namespace SabreTools.DatFiles
|
|||||||
if (dedupeType == DedupeType.None)
|
if (dedupeType == DedupeType.None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Ensure Game deduplication is valid
|
||||||
|
if (dedupeType == DedupeType.Game && _bucketedBy != ItemKey.Machine)
|
||||||
|
return;
|
||||||
|
|
||||||
#if NET452_OR_GREATER || NETCOREAPP
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
||||||
#elif NET40_OR_GREATER
|
#elif NET40_OR_GREATER
|
||||||
@@ -702,9 +706,8 @@ namespace SabreTools.DatFiles
|
|||||||
// Sort the list of items to be consistent
|
// Sort the list of items to be consistent
|
||||||
Sort(ref sortedList, false);
|
Sort(ref sortedList, false);
|
||||||
|
|
||||||
// If we're merging the roms, do so
|
// Merge the items
|
||||||
if (dedupeType == DedupeType.Full || (dedupeType == DedupeType.Game && _bucketedBy == ItemKey.Machine))
|
sortedList = Merge(sortedList);
|
||||||
sortedList = Merge(sortedList);
|
|
||||||
|
|
||||||
// Get all existing mappings
|
// Get all existing mappings
|
||||||
List<ItemMappings> currentMappings = sortedList.ConvertAll(item =>
|
List<ItemMappings> currentMappings = sortedList.ConvertAll(item =>
|
||||||
|
|||||||
Reference in New Issue
Block a user