mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove ConcurrentList
This made sense at one point, but none of the operations that once used the concurrency in the type still process concurrently. As such, this class has been made redundant. All places that it was used previously have reverted to standard `List<T>`.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
using SabreTools.DatItems.Formats;
|
||||
@@ -98,7 +97,7 @@ have a current entry in the DAT index.";
|
||||
|
||||
foreach (string key in df.Items.Keys)
|
||||
{
|
||||
ConcurrentList<DatItem>? datItems = df.Items[key];
|
||||
List<DatItem>? datItems = df.Items[key];
|
||||
if (datItems == null)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
using SabreTools.DatItems.Formats;
|
||||
@@ -90,7 +89,7 @@ namespace RombaSharp.Features
|
||||
IEnumerable<string> keys = depot.Items.Keys;
|
||||
foreach (string key in keys)
|
||||
{
|
||||
ConcurrentList<DatItem>? roms = depot.Items[key];
|
||||
List<DatItem>? roms = depot.Items[key];
|
||||
if (roms == null)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SabreTools.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Thread-safe list class
|
||||
/// </summary>
|
||||
#if NET20 || NET35 || NET40
|
||||
public class ConcurrentList<T> : ICollection<T>, IEnumerable<T>, IEnumerable, IList<T>, ICollection, IList
|
||||
#else
|
||||
public class ConcurrentList<T> : ICollection<T>, IEnumerable<T>, IEnumerable, IList<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection, IList
|
||||
#endif
|
||||
{
|
||||
private List<T> _list = [];
|
||||
private readonly object _lock = new();
|
||||
|
||||
public T this[int index]
|
||||
{
|
||||
get { lock (_lock) return _list[index]; }
|
||||
set { lock (_lock) _list[index] = value; }
|
||||
}
|
||||
|
||||
object? IList.this[int index]
|
||||
{
|
||||
get { lock (_lock) return ((IList)_list)[index]; }
|
||||
set { lock (_lock) ((IList)_list)[index] = value; }
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { lock (_lock) return _list.Count; }
|
||||
}
|
||||
|
||||
public bool IsFixedSize => ((IList)_list).IsFixedSize;
|
||||
|
||||
public bool IsReadOnly => ((IList)_list).IsReadOnly;
|
||||
|
||||
public bool IsSynchronized => ((ICollection)_list).IsSynchronized;
|
||||
|
||||
public object SyncRoot => ((ICollection)_list).SyncRoot;
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
lock (_lock)
|
||||
_list.Add(item);
|
||||
}
|
||||
|
||||
public int Add(object? value)
|
||||
{
|
||||
lock (_lock)
|
||||
return ((IList)_list).Add(value);
|
||||
}
|
||||
|
||||
public void AddRange(IEnumerable<T> values)
|
||||
{
|
||||
lock (_lock)
|
||||
_list.AddRange(values);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
lock (_lock)
|
||||
_list.Clear();
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
lock (_lock)
|
||||
return _list.Contains(item);
|
||||
}
|
||||
|
||||
public bool Contains(object? value)
|
||||
{
|
||||
lock (_lock)
|
||||
return ((IList)_list).Contains(value);
|
||||
}
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
lock (_lock)
|
||||
_list.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
lock (_lock)
|
||||
((ICollection)_list).CopyTo(array, index);
|
||||
}
|
||||
|
||||
public void ForEach(Action<T> action)
|
||||
{
|
||||
lock (_lock)
|
||||
_list.ForEach(action);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
lock (_lock)
|
||||
return _list.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
lock (_lock)
|
||||
return ((IEnumerable)_list).GetEnumerator();
|
||||
}
|
||||
|
||||
public int IndexOf(T item)
|
||||
{
|
||||
lock (_lock)
|
||||
return _list.IndexOf(item);
|
||||
}
|
||||
|
||||
public int IndexOf(object? value)
|
||||
{
|
||||
lock (_lock)
|
||||
return ((IList)_list).IndexOf(value);
|
||||
}
|
||||
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
lock (_lock)
|
||||
_list.Insert(index, item);
|
||||
}
|
||||
|
||||
public void Insert(int index, object? value)
|
||||
{
|
||||
lock (_lock)
|
||||
((IList)_list).Insert(index, value);
|
||||
}
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
lock (_lock)
|
||||
return _list.Remove(item);
|
||||
}
|
||||
|
||||
public void Remove(object? value)
|
||||
{
|
||||
lock (_lock)
|
||||
((IList)_list).Remove(value);
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
lock (_lock)
|
||||
_list.RemoveAt(index);
|
||||
}
|
||||
|
||||
public void SetInternalList(List<T> list)
|
||||
{
|
||||
lock (_lock)
|
||||
_list = list;
|
||||
}
|
||||
|
||||
public void Sort(Comparison<T> comparison)
|
||||
{
|
||||
lock (_lock)
|
||||
_list.Sort(comparison);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SabreTools.Core
|
||||
{
|
||||
public static class ConcurrentListExtensions
|
||||
{
|
||||
public static ConcurrentList<T> ToConcurrentList<T>(this IEnumerable<T> values)
|
||||
{
|
||||
var list = new ConcurrentList<T>();
|
||||
list.SetInternalList([.. values]);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.DatFiles
|
||||
foreach (var key in Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem>? items = Items[key];
|
||||
List<DatItem>? items = Items[key];
|
||||
if (items == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
|
||||
@@ -746,7 +746,7 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="datItems">DatItems to check</param>
|
||||
/// <returns>True if the machine contains at least one writable item, false otherwise</returns>
|
||||
/// <remarks>Empty machines are kept with this</remarks>
|
||||
protected bool ContainsWritable(ConcurrentList<DatItem> datItems)
|
||||
protected bool ContainsWritable(List<DatItem> datItems)
|
||||
{
|
||||
// Empty machines are considered writable
|
||||
if (datItems == null || datItems.Count == 0)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
namespace SabreTools.DatFiles.Formats
|
||||
@@ -57,7 +56,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in Items.SortedKeys)
|
||||
{
|
||||
ConcurrentList<DatItem> datItems = Items.FilteredItems(key);
|
||||
List<DatItem> datItems = Items.FilteredItems(key);
|
||||
|
||||
// If this machine doesn't contain any writable items, skip
|
||||
if (!ContainsWritable(datItems))
|
||||
@@ -124,7 +123,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
continue;
|
||||
|
||||
// Resolve the names in the block
|
||||
items = [.. DatItem.ResolveNamesDB(items.ToConcurrentList())];
|
||||
items = [.. DatItem.ResolveNamesDB([.. items])];
|
||||
|
||||
for (int index = 0; index < items.Length; index++)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatItems;
|
||||
using SabreTools.DatItems.Formats;
|
||||
@@ -392,7 +391,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in Items.SortedKeys)
|
||||
{
|
||||
ConcurrentList<DatItem> datItems = Items.FilteredItems(key);
|
||||
List<DatItem> datItems = Items.FilteredItems(key);
|
||||
|
||||
// If this machine doesn't contain any writable items, skip
|
||||
if (!ContainsWritable(datItems))
|
||||
@@ -479,7 +478,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
continue;
|
||||
|
||||
// Resolve the names in the block
|
||||
items = [.. DatItem.ResolveNamesDB(items.ToConcurrentList())];
|
||||
items = [.. DatItem.ResolveNamesDB(items.ToList())];
|
||||
|
||||
for (int index = 0; index < items.Length; index++)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
namespace SabreTools.DatFiles.Formats
|
||||
@@ -220,7 +220,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in Items.SortedKeys)
|
||||
{
|
||||
ConcurrentList<DatItem> datItems = Items.FilteredItems(key);
|
||||
List<DatItem> datItems = Items.FilteredItems(key);
|
||||
|
||||
// If this machine doesn't contain any writable items, skip
|
||||
if (!ContainsWritable(datItems))
|
||||
@@ -308,7 +308,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
continue;
|
||||
|
||||
// Resolve the names in the block
|
||||
items = [.. DatItem.ResolveNamesDB(items.ToConcurrentList())];
|
||||
items = [.. DatItem.ResolveNamesDB([.. items])];
|
||||
|
||||
for (int index = 0; index < items.Length; index++)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace SabreTools.DatFiles
|
||||
/// Item dictionary with statistics, bucketing, and sorting
|
||||
/// </summary>
|
||||
[JsonObject("items"), XmlRoot("items")]
|
||||
public class ItemDictionary : IDictionary<string, ConcurrentList<DatItem>?>
|
||||
public class ItemDictionary : IDictionary<string, List<DatItem>?>
|
||||
{
|
||||
#region Private instance variables
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace SabreTools.DatFiles
|
||||
/// Internal dictionary for the class
|
||||
/// </summary>
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
private readonly ConcurrentDictionary<string, ConcurrentList<DatItem>?> items = [];
|
||||
private readonly ConcurrentDictionary<string, List<DatItem>?> items = [];
|
||||
#else
|
||||
private readonly Dictionary<string, ConcurrentList<DatItem>?> items = [];
|
||||
private readonly Dictionary<string, List<DatItem>?> items = [];
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -120,7 +120,7 @@ namespace SabreTools.DatFiles
|
||||
/// Passthrough to access the file dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">Key in the dictionary to reference</param>
|
||||
public ConcurrentList<DatItem>? this[string key]
|
||||
public List<DatItem>? this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -174,7 +174,7 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
/// <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, ConcurrentList<DatItem>? value)
|
||||
public void Add(string key, List<DatItem>? value)
|
||||
{
|
||||
AddRange(key, value);
|
||||
}
|
||||
@@ -282,7 +282,7 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
/// <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, ConcurrentList<DatItem>? value)
|
||||
public void AddRange(string key, List<DatItem>? value)
|
||||
{
|
||||
// Explicit lock for some weird corner cases
|
||||
lock (key)
|
||||
@@ -349,8 +349,8 @@ namespace SabreTools.DatFiles
|
||||
List<string> keys = [.. items.Keys];
|
||||
foreach (string key in keys)
|
||||
{
|
||||
ConcurrentList<DatItem>? oldItemList = items[key];
|
||||
ConcurrentList<DatItem>? newItemList = oldItemList?.Where(i => i.GetBoolFieldValue(DatItem.RemoveKey) != true)?.ToConcurrentList();
|
||||
List<DatItem>? oldItemList = items[key];
|
||||
List<DatItem>? newItemList = oldItemList?.Where(i => i.GetBoolFieldValue(DatItem.RemoveKey) != true)?.ToList();
|
||||
|
||||
Remove(key);
|
||||
AddRange(key, newItemList);
|
||||
@@ -421,12 +421,12 @@ namespace SabreTools.DatFiles
|
||||
/// Get a list of filtered items for a given key
|
||||
/// </summary>
|
||||
/// <param name="key">Key in the dictionary to retrieve</param>
|
||||
public ConcurrentList<DatItem> FilteredItems(string key)
|
||||
public List<DatItem> FilteredItems(string key)
|
||||
{
|
||||
lock (key)
|
||||
{
|
||||
// Get the list, if possible
|
||||
ConcurrentList<DatItem>? fi = items[key];
|
||||
List<DatItem>? fi = items[key];
|
||||
if (fi == null)
|
||||
return [];
|
||||
|
||||
@@ -434,7 +434,7 @@ namespace SabreTools.DatFiles
|
||||
return fi.Where(i => i != null)
|
||||
.Where(i => i.GetBoolFieldValue(DatItem.RemoveKey) != true)
|
||||
.Where(i => i.GetFieldValue<Machine>(DatItem.MachineKey) != null)
|
||||
.ToConcurrentList();
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,9 +561,9 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="datItem">Item to try to match</param>
|
||||
/// <param name="sorted">True if the DAT is already sorted accordingly, false otherwise (default)</param>
|
||||
/// <returns>List of matched DatItem objects</returns>
|
||||
public ConcurrentList<DatItem> GetDuplicates(DatItem datItem, bool sorted = false)
|
||||
public List<DatItem> GetDuplicates(DatItem datItem, bool sorted = false)
|
||||
{
|
||||
ConcurrentList<DatItem> output = [];
|
||||
List<DatItem> output = [];
|
||||
|
||||
// Check for an empty rom list first
|
||||
if (DatStatistics.TotalCount == 0)
|
||||
@@ -577,11 +577,11 @@ namespace SabreTools.DatFiles
|
||||
return output;
|
||||
|
||||
// Try to find duplicates
|
||||
ConcurrentList<DatItem>? roms = this[key];
|
||||
List<DatItem>? roms = this[key];
|
||||
if (roms == null)
|
||||
return output;
|
||||
|
||||
ConcurrentList<DatItem> left = [];
|
||||
List<DatItem> left = [];
|
||||
for (int i = 0; i < roms.Count; i++)
|
||||
{
|
||||
DatItem other = roms[i];
|
||||
@@ -627,7 +627,7 @@ namespace SabreTools.DatFiles
|
||||
return false;
|
||||
|
||||
// Try to find duplicates
|
||||
ConcurrentList<DatItem>? roms = this[key];
|
||||
List<DatItem>? roms = this[key];
|
||||
if (roms == null)
|
||||
return false;
|
||||
|
||||
@@ -748,7 +748,7 @@ namespace SabreTools.DatFiles
|
||||
#endif
|
||||
{
|
||||
// Get the possibly unsorted list
|
||||
ConcurrentList<DatItem>? sortedlist = this[key]?.ToConcurrentList();
|
||||
List<DatItem>? sortedlist = this[key]?.ToList();
|
||||
if (sortedlist == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -788,7 +788,7 @@ namespace SabreTools.DatFiles
|
||||
#endif
|
||||
{
|
||||
// Get the possibly unsorted list
|
||||
ConcurrentList<DatItem>? sortedlist = this[key];
|
||||
List<DatItem>? sortedlist = this[key];
|
||||
|
||||
// Sort the list of items to be consistent
|
||||
if (sortedlist != null)
|
||||
@@ -835,7 +835,7 @@ namespace SabreTools.DatFiles
|
||||
foreach (var key in keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem>? items = this[key];
|
||||
List<DatItem>? items = this[key];
|
||||
if (items == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -844,7 +844,7 @@ namespace SabreTools.DatFiles
|
||||
#endif
|
||||
|
||||
// Filter all items in the current key
|
||||
var newItems = new ConcurrentList<DatItem>();
|
||||
var newItems = new List<DatItem>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.PassesFilter(filterRunner))
|
||||
@@ -1149,7 +1149,7 @@ namespace SabreTools.DatFiles
|
||||
continue;
|
||||
#endif
|
||||
|
||||
ConcurrentList<DatItem> newItems = [];
|
||||
List<DatItem> newItems = [];
|
||||
foreach (DatItem item in items)
|
||||
{
|
||||
// Update machine name
|
||||
@@ -1710,7 +1710,7 @@ namespace SabreTools.DatFiles
|
||||
// Loop through and add
|
||||
foreach (string key in items.Keys)
|
||||
{
|
||||
ConcurrentList<DatItem>? datItems = items[key];
|
||||
List<DatItem>? datItems = items[key];
|
||||
if (datItems == null)
|
||||
continue;
|
||||
|
||||
@@ -1725,45 +1725,45 @@ namespace SabreTools.DatFiles
|
||||
|
||||
#region IDictionary Implementations
|
||||
|
||||
public ICollection<ConcurrentList<DatItem>?> Values => ((IDictionary<string, ConcurrentList<DatItem>?>)items).Values;
|
||||
public ICollection<List<DatItem>?> Values => ((IDictionary<string, List<DatItem>?>)items).Values;
|
||||
|
||||
public int Count => ((ICollection<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).Count;
|
||||
public int Count => ((ICollection<KeyValuePair<string, List<DatItem>?>>)items).Count;
|
||||
|
||||
public bool IsReadOnly => ((ICollection<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).IsReadOnly;
|
||||
public bool IsReadOnly => ((ICollection<KeyValuePair<string, List<DatItem>?>>)items).IsReadOnly;
|
||||
|
||||
public bool TryGetValue(string key, out ConcurrentList<DatItem>? value)
|
||||
public bool TryGetValue(string key, out List<DatItem>? value)
|
||||
{
|
||||
return ((IDictionary<string, ConcurrentList<DatItem>?>)items).TryGetValue(key, out value);
|
||||
return ((IDictionary<string, List<DatItem>?>)items).TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<string, ConcurrentList<DatItem>?> item)
|
||||
public void Add(KeyValuePair<string, List<DatItem>?> item)
|
||||
{
|
||||
((ICollection<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).Add(item);
|
||||
((ICollection<KeyValuePair<string, List<DatItem>?>>)items).Add(item);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
((ICollection<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).Clear();
|
||||
((ICollection<KeyValuePair<string, List<DatItem>?>>)items).Clear();
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<string, ConcurrentList<DatItem>?> item)
|
||||
public bool Contains(KeyValuePair<string, List<DatItem>?> item)
|
||||
{
|
||||
return ((ICollection<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).Contains(item);
|
||||
return ((ICollection<KeyValuePair<string, List<DatItem>?>>)items).Contains(item);
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<string, ConcurrentList<DatItem>?>[] array, int arrayIndex)
|
||||
public void CopyTo(KeyValuePair<string, List<DatItem>?>[] array, int arrayIndex)
|
||||
{
|
||||
((ICollection<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).CopyTo(array, arrayIndex);
|
||||
((ICollection<KeyValuePair<string, List<DatItem>?>>)items).CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<string, ConcurrentList<DatItem>?> item)
|
||||
public bool Remove(KeyValuePair<string, List<DatItem>?> item)
|
||||
{
|
||||
return ((ICollection<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).Remove(item);
|
||||
return ((ICollection<KeyValuePair<string, List<DatItem>?>>)items).Remove(item);
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<string, ConcurrentList<DatItem>?>> GetEnumerator()
|
||||
public IEnumerator<KeyValuePair<string, List<DatItem>?>> GetEnumerator()
|
||||
{
|
||||
return ((IEnumerable<KeyValuePair<string, ConcurrentList<DatItem>?>>)items).GetEnumerator();
|
||||
return ((IEnumerable<KeyValuePair<string, List<DatItem>?>>)items).GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
|
||||
@@ -11,7 +11,6 @@ using System.Threading.Tasks;
|
||||
#endif
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Filter;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatItems;
|
||||
@@ -119,9 +118,9 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
[JsonIgnore, XmlIgnore]
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
private readonly ConcurrentDictionary<string, ConcurrentList<long>> _buckets = [];
|
||||
private readonly ConcurrentDictionary<string, List<long>> _buckets = [];
|
||||
#else
|
||||
private readonly Dictionary<string, ConcurrentList<long>> _buckets = [];
|
||||
private readonly Dictionary<string, List<long>> _buckets = [];
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -618,9 +617,9 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="datItem">Item to try to match</param>
|
||||
/// <param name="sorted">True if the DAT is already sorted accordingly, false otherwise (default)</param>
|
||||
/// <returns>List of matched DatItem objects</returns>
|
||||
public ConcurrentList<(long, DatItem)> GetDuplicates(DatItem datItem, bool sorted = false)
|
||||
public List<(long, DatItem)> GetDuplicates(DatItem datItem, bool sorted = false)
|
||||
{
|
||||
ConcurrentList<(long, DatItem)> output = [];
|
||||
List<(long, DatItem)> output = [];
|
||||
|
||||
// Check for an empty rom list first
|
||||
if (DatStatistics.TotalCount == 0)
|
||||
@@ -635,26 +634,26 @@ namespace SabreTools.DatFiles
|
||||
return output;
|
||||
|
||||
// Try to find duplicates
|
||||
ConcurrentList<(long, DatItem)> left = [];
|
||||
List<(long, DatItem)> left = [];
|
||||
for (int i = 0; i < roms.Length; i++)
|
||||
{
|
||||
DatItem other = roms[i].Item2;
|
||||
(long index, DatItem other) = roms[i];
|
||||
if (other.GetBoolFieldValue(DatItem.RemoveKey) == true)
|
||||
continue;
|
||||
|
||||
if (datItem.Equals(other))
|
||||
{
|
||||
other.SetFieldValue<bool?>(DatItem.RemoveKey, true);
|
||||
output.Add(other);
|
||||
output.Add((index, other));
|
||||
}
|
||||
else
|
||||
{
|
||||
left.Add(other);
|
||||
left.Add((index, other));
|
||||
}
|
||||
}
|
||||
|
||||
// Add back all roms with the proper flags
|
||||
_buckets[key] = output.Concat(left).Select(i => i.Item1).ToConcurrentList();
|
||||
_buckets[key] = output.Concat(left).Select(i => i.Item1).ToList();
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -664,9 +663,9 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="datItem">Item to try to match</param>
|
||||
/// <param name="sorted">True if the DAT is already sorted accordingly, false otherwise (default)</param>
|
||||
/// <returns>List of matched DatItem objects</returns>
|
||||
public ConcurrentList<(long, DatItem)> GetDuplicates((long, DatItem) datItem, bool sorted = false)
|
||||
public List<(long, DatItem)> GetDuplicates((long, DatItem) datItem, bool sorted = false)
|
||||
{
|
||||
ConcurrentList<(long, DatItem)> output = [];
|
||||
List<(long, DatItem)> output = [];
|
||||
|
||||
// Check for an empty rom list first
|
||||
if (DatStatistics.TotalCount == 0)
|
||||
@@ -681,26 +680,26 @@ namespace SabreTools.DatFiles
|
||||
return output;
|
||||
|
||||
// Try to find duplicates
|
||||
ConcurrentList<(long, DatItem)> left = [];
|
||||
List<(long, DatItem)> left = [];
|
||||
for (int i = 0; i < roms.Length; i++)
|
||||
{
|
||||
DatItem other = roms[i].Item2;
|
||||
(long index, DatItem other) = roms[i];
|
||||
if (other.GetBoolFieldValue(DatItem.RemoveKey) == true)
|
||||
continue;
|
||||
|
||||
if (datItem.Item2.Equals(other))
|
||||
{
|
||||
other.SetFieldValue<bool?>(DatItem.RemoveKey, true);
|
||||
output.Add(other);
|
||||
output.Add((index, other));
|
||||
}
|
||||
else
|
||||
{
|
||||
left.Add(other);
|
||||
left.Add((index, other));
|
||||
}
|
||||
}
|
||||
|
||||
// Add back all roms with the proper flags
|
||||
_buckets[key] = output.Concat(left).Select(i => i.Item1).ToConcurrentList();
|
||||
_buckets[key] = output.Concat(left).Select(i => i.Item1).ToList();
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -1075,7 +1074,7 @@ namespace SabreTools.DatFiles
|
||||
if (dedupeType == DedupeType.Full || (dedupeType == DedupeType.Game && bucketBy == ItemKey.Machine))
|
||||
datItems = Deduplicate(datItems);
|
||||
|
||||
_buckets[bucketKeys[i]] = datItems.Select(m => m.Item1).ToConcurrentList();
|
||||
_buckets[bucketKeys[i]] = datItems.Select(m => m.Item1).ToList();
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
});
|
||||
#else
|
||||
@@ -1118,7 +1117,7 @@ namespace SabreTools.DatFiles
|
||||
|
||||
Sort(ref datItems, norename);
|
||||
|
||||
_buckets[bucketKeys[i]] = datItems.Select(m => m.Item1).ToConcurrentList();
|
||||
_buckets[bucketKeys[i]] = datItems.Select(m => m.Item1).ToList();
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
});
|
||||
#else
|
||||
@@ -1433,7 +1432,7 @@ namespace SabreTools.DatFiles
|
||||
items[j] = item;
|
||||
}
|
||||
|
||||
_buckets[key] = items.Select(i => i.Item1).ToConcurrentList();
|
||||
_buckets[key] = items.Select(i => i.Item1).ToList();
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
});
|
||||
#else
|
||||
@@ -1504,7 +1503,7 @@ namespace SabreTools.DatFiles
|
||||
return;
|
||||
|
||||
// Filter all items in the current key
|
||||
var newItems = new ConcurrentList<(long, DatItem)>();
|
||||
var newItems = new List<(long, DatItem)>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.Item2.PassesFilter(filterRunner))
|
||||
@@ -1512,7 +1511,7 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
|
||||
// Set the value in the key to the new set
|
||||
_buckets[bucketName] = newItems.Select(i => i.Item1).ToConcurrentList();
|
||||
_buckets[bucketName] = newItems.Select(i => i.Item1).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1570,7 +1569,7 @@ namespace SabreTools.DatFiles
|
||||
continue;
|
||||
#endif
|
||||
|
||||
ConcurrentList<(long, DatItem)> newItems = [];
|
||||
List<(long, DatItem)> newItems = [];
|
||||
foreach ((long, DatItem) item in items)
|
||||
{
|
||||
// Get the current machine
|
||||
@@ -1599,7 +1598,7 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
|
||||
// Replace the old list of roms with the new one
|
||||
_buckets[key] = newItems.Select(i => i.Item1).ToConcurrentList();
|
||||
_buckets[key] = newItems.Select(i => i.Item1).ToList();
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
});
|
||||
#else
|
||||
@@ -1937,14 +1936,14 @@ namespace SabreTools.DatFiles
|
||||
.Contains(mergeTag))
|
||||
{
|
||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||
_buckets[cloneOf!].Add(disk);
|
||||
_buckets[cloneOf!].Add(item.Item1);
|
||||
}
|
||||
|
||||
// If there is no merge tag, add to parent
|
||||
else if (mergeTag == null)
|
||||
{
|
||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||
_buckets[cloneOf!].Add(disk);
|
||||
_buckets[cloneOf!].Add(item.Item1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1970,7 +1969,7 @@ namespace SabreTools.DatFiles
|
||||
rom.SetName($"{machineName}\\{rom.GetName()}");
|
||||
|
||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||
_buckets[cloneOf!].Add(rom);
|
||||
_buckets[cloneOf!].Add(item.Item1);
|
||||
}
|
||||
|
||||
// If the parent doesn't already contain this item, add to subfolder of parent
|
||||
@@ -1980,7 +1979,7 @@ namespace SabreTools.DatFiles
|
||||
rom.SetName($"{machineName}\\{rom.GetName()}");
|
||||
|
||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||
_buckets[cloneOf!].Add(rom);
|
||||
_buckets[cloneOf!].Add(item.Item1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1991,7 +1990,7 @@ namespace SabreTools.DatFiles
|
||||
item.Item2.SetName($"{machineName}\\{item.Item2.GetName()}");
|
||||
|
||||
_itemToMachineMapping[item.Item1] = cloneOfMachine.Item1;
|
||||
_buckets[cloneOf!].Add(item);
|
||||
_buckets[cloneOf!].Add(item.Item1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -518,14 +519,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 ConcurrentList<DatItem> Merge(ConcurrentList<DatItem>? infiles)
|
||||
public static List<DatItem> Merge(List<DatItem>? infiles)
|
||||
{
|
||||
// Check for null or blank roms first
|
||||
if (infiles == null || infiles.Count == 0)
|
||||
return [];
|
||||
|
||||
// Create output list
|
||||
ConcurrentList<DatItem> outfiles = [];
|
||||
List<DatItem> outfiles = [];
|
||||
|
||||
// Then deduplicate them by checking to see if data matches previous saved roms
|
||||
int nodumpCount = 0;
|
||||
@@ -632,10 +633,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 ConcurrentList<DatItem> ResolveNames(ConcurrentList<DatItem> infiles)
|
||||
public static List<DatItem> ResolveNames(List<DatItem> infiles)
|
||||
{
|
||||
// Create the output list
|
||||
ConcurrentList<DatItem> output = [];
|
||||
List<DatItem> output = [];
|
||||
|
||||
// First we want to make sure the list is in alphabetical order
|
||||
Sort(ref infiles, true);
|
||||
@@ -729,10 +730,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 ConcurrentList<(long, DatItem)> ResolveNamesDB(ConcurrentList<(long, DatItem)> infiles)
|
||||
public static List<(long, DatItem)> ResolveNamesDB(List<(long, DatItem)> infiles)
|
||||
{
|
||||
// Create the output list
|
||||
ConcurrentList<(long, DatItem)> output = [];
|
||||
List<(long, DatItem)> output = [];
|
||||
|
||||
// First we want to make sure the list is in alphabetical order
|
||||
Sort(ref infiles, true);
|
||||
@@ -842,7 +843,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 ConcurrentList<DatItem> roms, bool norename)
|
||||
public static bool Sort(ref List<DatItem> roms, bool norename)
|
||||
{
|
||||
roms.Sort(delegate (DatItem x, DatItem y)
|
||||
{
|
||||
@@ -895,7 +896,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 ConcurrentList<(long, DatItem)> roms, bool norename)
|
||||
public static bool Sort(ref List<(long, DatItem)> roms, bool norename)
|
||||
{
|
||||
roms.Sort(delegate ((long, DatItem) x, (long, DatItem) y)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
using SabreTools.Filtering;
|
||||
@@ -43,7 +42,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem>? items = datFile.Items[key];
|
||||
List<DatItem>? items = datFile.Items[key];
|
||||
if (items == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -51,7 +50,7 @@ namespace SabreTools.DatTools
|
||||
continue;
|
||||
#endif
|
||||
|
||||
ConcurrentList<DatItem> newItems = [];
|
||||
List<DatItem> newItems = [];
|
||||
foreach (DatItem item in items)
|
||||
{
|
||||
DatItem newItem = item;
|
||||
@@ -193,7 +192,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in intDat.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem>? datItems = intDat.Items[key];
|
||||
List<DatItem>? datItems = intDat.Items[key];
|
||||
if (datItems == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -201,10 +200,10 @@ namespace SabreTools.DatTools
|
||||
continue;
|
||||
#endif
|
||||
|
||||
ConcurrentList<DatItem> newDatItems = [];
|
||||
List<DatItem> newDatItems = [];
|
||||
foreach (DatItem datItem in datItems)
|
||||
{
|
||||
ConcurrentList<DatItem> dupes = datFile.Items.GetDuplicates(datItem, sorted: true);
|
||||
List<DatItem> dupes = datFile.Items.GetDuplicates(datItem, sorted: true);
|
||||
if (datItem.Clone() is not DatItem newDatItem)
|
||||
continue;
|
||||
|
||||
@@ -241,7 +240,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in intDat.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem>? datItems = intDat.Items[key];
|
||||
List<DatItem>? datItems = intDat.Items[key];
|
||||
if (datItems == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -249,7 +248,7 @@ namespace SabreTools.DatTools
|
||||
continue;
|
||||
#endif
|
||||
|
||||
ConcurrentList<DatItem> newDatItems = [];
|
||||
List<DatItem> newDatItems = [];
|
||||
foreach (DatItem datItem in datItems)
|
||||
{
|
||||
if (datItem.Clone() is not DatItem newDatItem)
|
||||
@@ -455,7 +454,7 @@ namespace SabreTools.DatTools
|
||||
// Standard Against uses hashes
|
||||
else
|
||||
{
|
||||
ConcurrentList<DatItem>? datItems = intDat.Items[key];
|
||||
List<DatItem>? datItems = intDat.Items[key];
|
||||
if (datItems == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -463,7 +462,7 @@ namespace SabreTools.DatTools
|
||||
continue;
|
||||
#endif
|
||||
|
||||
ConcurrentList<DatItem> keepDatItems = [];
|
||||
List<DatItem> keepDatItems = [];
|
||||
foreach (DatItem datItem in datItems)
|
||||
{
|
||||
if (!datFile.Items.HasDuplicates(datItem, true))
|
||||
@@ -578,7 +577,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in datFile.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
List<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
|
||||
// If the rom list is empty or null, just skip it
|
||||
if (items == null || items.Count == 0)
|
||||
@@ -803,7 +802,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in datFile.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
List<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
|
||||
// If the rom list is empty or null, just skip it
|
||||
if (items == null || items.Count == 0)
|
||||
@@ -1013,7 +1012,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in datFile.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
List<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
|
||||
// If the rom list is empty or null, just skip it
|
||||
if (items == null || items.Count == 0)
|
||||
@@ -1327,7 +1326,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in datFile.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
List<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
|
||||
// If the rom list is empty or null, just skip it
|
||||
if (items == null || items.Count == 0)
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.IO;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
@@ -413,8 +412,8 @@ namespace SabreTools.DatTools
|
||||
return false;
|
||||
|
||||
// If either we have duplicates or we're filtering
|
||||
if (ShouldRebuild(datFile, datItem, fileStream, inverse, out ConcurrentList<DatItem> dupes))
|
||||
//if (ShouldRebuildDB(datFile, datItem, fileStream, inverse, out ConcurrentList<DatItem> dupes))
|
||||
if (ShouldRebuild(datFile, datItem, fileStream, inverse, out List<DatItem> dupes))
|
||||
//if (ShouldRebuildDB(datFile, datItem, fileStream, inverse, out List<DatItem> dupes))
|
||||
{
|
||||
// If we have a very specific TGZ->TGZ case, just copy it accordingly
|
||||
if (RebuildTorrentGzip(datFile, datItem, file, outDir, outputFormat, isZip))
|
||||
@@ -549,7 +548,7 @@ namespace SabreTools.DatTools
|
||||
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
||||
/// <param name="dupes">Output list of duplicate items to rebuild to</param>
|
||||
/// <returns>True if the item should be rebuilt, false otherwise</returns>
|
||||
private static bool ShouldRebuild(DatFile datFile, DatItem datItem, Stream? stream, bool inverse, out ConcurrentList<DatItem> dupes)
|
||||
private static bool ShouldRebuild(DatFile datFile, DatItem datItem, Stream? stream, bool inverse, out List<DatItem> dupes)
|
||||
{
|
||||
// Find if the file has duplicates in the DAT
|
||||
dupes = datFile.Items.GetDuplicates(datItem);
|
||||
@@ -604,7 +603,7 @@ namespace SabreTools.DatTools
|
||||
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
||||
/// <param name="dupes">Output list of duplicate items to rebuild to</param>
|
||||
/// <returns>True if the item should be rebuilt, false otherwise</returns>
|
||||
private static bool ShouldRebuildDB(DatFile datFile, (long, DatItem) datItem, Stream? stream, bool inverse, out ConcurrentList<(long, DatItem)> dupes)
|
||||
private static bool ShouldRebuildDB(DatFile datFile, (long, DatItem) datItem, Stream? stream, bool inverse, out List<(long, DatItem)> dupes)
|
||||
{
|
||||
// Find if the file has duplicates in the DAT
|
||||
dupes = datFile.ItemsDB.GetDuplicates(datItem);
|
||||
@@ -645,7 +644,8 @@ namespace SabreTools.DatTools
|
||||
machine.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, machinename);
|
||||
}
|
||||
|
||||
dupes.Add(item);
|
||||
long index = datFile.ItemsDB.AddItem(item, machineIndex, -1, false);
|
||||
dupes.Add((index, item));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Net;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
@@ -505,7 +504,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
|
||||
// Clean the input list and set all games to be pathless
|
||||
ConcurrentList<DatItem>? items = datFile.Items[key];
|
||||
List<DatItem>? items = datFile.Items[key];
|
||||
if (items == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -622,7 +621,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in datFile.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem>? items = datFile.Items[key];
|
||||
List<DatItem>? items = datFile.Items[key];
|
||||
if (items == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
@@ -904,7 +903,7 @@ namespace SabreTools.DatTools
|
||||
foreach (var key in datFile.Items.Keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
List<DatItem> items = DatItem.Merge(datFile.Items[key]);
|
||||
|
||||
// If the rom list is empty or null, just skip it
|
||||
if (items == null || items.Count == 0)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
@@ -219,7 +218,7 @@ namespace SabreTools.DatTools
|
||||
List<string> keys = [.. datFile.Items.SortedKeys];
|
||||
foreach (string key in keys)
|
||||
{
|
||||
ConcurrentList<DatItem>? items = datFile.Items[key];
|
||||
List<DatItem>? items = datFile.Items[key];
|
||||
if (items == null)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user