Ensure consistency by using ConcurrentList (fixes #36)

This commit is contained in:
Matt Nadareski
2021-07-18 21:00:01 -07:00
parent 2dc6dea0e7
commit 5d9ec18877
33 changed files with 289 additions and 122 deletions

View File

@@ -526,14 +526,14 @@ namespace SabreTools.DatItems
/// </summary>
/// <param name="infiles">List of File objects representing the roms to be merged</param>
/// <returns>A List of DatItem objects representing the merged roms</returns>
public static List<DatItem> Merge(List<DatItem> infiles)
public static ConcurrentList<DatItem> Merge(ConcurrentList<DatItem> infiles)
{
// Check for null or blank roms first
if (infiles == null || infiles.Count == 0)
return new List<DatItem>();
return new ConcurrentList<DatItem>();
// Create output list
List<DatItem> outfiles = new List<DatItem>();
ConcurrentList<DatItem> outfiles = new ConcurrentList<DatItem>();
// Then deduplicate them by checking to see if data matches previous saved roms
int nodumpCount = 0;
@@ -637,10 +637,10 @@ namespace SabreTools.DatItems
/// </summary>
/// <param name="infiles">List of File objects representing the roms to be merged</param>
/// <returns>A List of DatItem objects representing the renamed roms</returns>
public static List<DatItem> ResolveNames(List<DatItem> infiles)
public static ConcurrentList<DatItem> ResolveNames(ConcurrentList<DatItem> infiles)
{
// Create the output list
List<DatItem> output = new List<DatItem>();
ConcurrentList<DatItem> output = new ConcurrentList<DatItem>();
// First we want to make sure the list is in alphabetical order
Sort(ref infiles, true);
@@ -742,7 +742,7 @@ namespace SabreTools.DatItems
/// <param name="roms">List of File objects representing the roms to be sorted</param>
/// <param name="norename">True if files are not renamed, false otherwise</param>
/// <returns>True if it sorted correctly, false otherwise</returns>
public static bool Sort(ref List<DatItem> roms, bool norename)
public static bool Sort(ref ConcurrentList<DatItem> roms, bool norename)
{
roms.Sort(delegate (DatItem x, DatItem y)
{