mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix issue with CHD-only dats
This commit is contained in:
@@ -58,6 +58,9 @@ namespace SabreTools.Library.DatFiles
|
||||
public List<DatItem> this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
// Explicit lock for some weird corner cases
|
||||
lock (key)
|
||||
{
|
||||
// Ensure the key exists
|
||||
EnsureKey(key);
|
||||
@@ -66,6 +69,7 @@ namespace SabreTools.Library.DatFiles
|
||||
return Items[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a value to the file dictionary
|
||||
@@ -73,6 +77,9 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="key">Key in the dictionary to add to</param>
|
||||
/// <param name="value">Value to add to the dictionary</param>
|
||||
public void Add(string key, DatItem value)
|
||||
{
|
||||
// Explicit lock for some weird corner cases
|
||||
lock (key)
|
||||
{
|
||||
// Ensure the key exists
|
||||
EnsureKey(key);
|
||||
@@ -87,6 +94,7 @@ namespace SabreTools.Library.DatFiles
|
||||
// Now update the statistics
|
||||
DatStats.AddItem(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a range of values to the file dictionary
|
||||
@@ -94,6 +102,9 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="key">Key in the dictionary to add to</param>
|
||||
/// <param name="value">Value to add to the dictionary</param>
|
||||
public void AddRange(string key, List<DatItem> value)
|
||||
{
|
||||
// Explicit lock for some weird corner cases
|
||||
lock (key)
|
||||
{
|
||||
// Ensure the key exists
|
||||
EnsureKey(key);
|
||||
@@ -107,6 +118,7 @@ namespace SabreTools.Library.DatFiles
|
||||
DatStats.AddItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get if the file dictionary contains the key
|
||||
@@ -119,8 +131,12 @@ namespace SabreTools.Library.DatFiles
|
||||
if (key == null)
|
||||
return false;
|
||||
|
||||
// Explicit lock for some weird corner cases
|
||||
lock (key)
|
||||
{
|
||||
return Items.ContainsKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get if the file dictionary contains the key and value
|
||||
@@ -134,8 +150,12 @@ namespace SabreTools.Library.DatFiles
|
||||
if (key == null)
|
||||
return false;
|
||||
|
||||
// Explicit lock for some weird corner cases
|
||||
lock (key)
|
||||
{
|
||||
if (Items.ContainsKey(key))
|
||||
return Items[key].Contains(value);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -804,13 +804,10 @@ namespace SabreTools.Library.DatFiles
|
||||
}
|
||||
}
|
||||
|
||||
// Lock the list and add the item back
|
||||
lock (newitems)
|
||||
{
|
||||
// Add the item to the output
|
||||
newitems.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
datFile.Remove(key);
|
||||
datFile.AddRange(key, newitems);
|
||||
|
||||
@@ -1116,8 +1116,10 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
// Then deduplicate them by checking to see if data matches previous saved roms
|
||||
int nodumpCount = 0;
|
||||
foreach (DatItem file in infiles)
|
||||
for (int f = 0; f < infiles.Count; f++)
|
||||
{
|
||||
DatItem file = infiles[f];
|
||||
|
||||
// If we don't have a Rom or a Disk, we skip checking for duplicates
|
||||
if (file.ItemType != ItemType.Rom && file.ItemType != ItemType.Disk)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user