mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Make call to Keys automatically do .ToList()
This commit is contained in:
@@ -629,7 +629,7 @@ namespace RombaSharp
|
|||||||
|
|
||||||
// Once we have both, check for any new files
|
// Once we have both, check for any new files
|
||||||
List<string> dupehashes = new List<string>();
|
List<string> dupehashes = new List<string>();
|
||||||
List<string> keys = depot.Keys.ToList();
|
List<string> keys = depot.Keys;
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
{
|
{
|
||||||
List<DatItem> roms = depot[key];
|
List<DatItem> roms = depot[key];
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -1312,7 +1312,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// Get the keys from the file dictionary
|
/// Get the keys from the file dictionary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>IEnumerable of the keys</returns>
|
/// <returns>IEnumerable of the keys</returns>
|
||||||
public IEnumerable<string> Keys
|
public List<string> Keys
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -1324,7 +1324,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
lock (_items)
|
lock (_items)
|
||||||
{
|
{
|
||||||
return _items.Keys;
|
return _items.Keys.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1433,7 +1433,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_sortedBy = bucketBy;
|
_sortedBy = bucketBy;
|
||||||
|
|
||||||
// First do the initial sort of all of the roms inplace
|
// First do the initial sort of all of the roms inplace
|
||||||
List<string> oldkeys = Keys.ToList();
|
List<string> oldkeys = Keys;
|
||||||
Parallel.ForEach(oldkeys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(oldkeys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
// Get the unsorted current list
|
// Get the unsorted current list
|
||||||
@@ -1455,7 +1455,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now go through and sort all of the individual lists
|
// Now go through and sort all of the individual lists
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
// Get the possibly unsorted list
|
// Get the possibly unsorted list
|
||||||
@@ -1707,7 +1707,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Parallel.For(0, inputs.Count, Globals.ParallelOptions, i =>
|
Parallel.For(0, inputs.Count, Globals.ParallelOptions, i =>
|
||||||
{
|
{
|
||||||
// Get the list of keys from the DAT
|
// Get the list of keys from the DAT
|
||||||
List<string> keys = datHeaders[i].Keys.ToList();
|
List<string> keys = datHeaders[i].Keys;
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
{
|
{
|
||||||
// Add everything from the key to the internal DAT
|
// Add everything from the key to the internal DAT
|
||||||
@@ -1788,20 +1788,22 @@ namespace SabreTools.Library.DatFiles
|
|||||||
intDat.BucketBy(SortedBy.CRC, DedupeType.Full);
|
intDat.BucketBy(SortedBy.CRC, DedupeType.Full);
|
||||||
|
|
||||||
// Then we do a hashwise comparison against the base DAT
|
// Then we do a hashwise comparison against the base DAT
|
||||||
List<string> keys = intDat.Keys.ToList();
|
List<string> keys = intDat.Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> datItems = intDat[key];
|
List<DatItem> datItems = intDat[key];
|
||||||
List<DatItem> newDatItems = new List<DatItem>();
|
List<DatItem> newDatItems = new List<DatItem>();
|
||||||
foreach (DatItem datItem in datItems)
|
foreach (DatItem datItem in datItems)
|
||||||
{
|
{
|
||||||
List<DatItem> dupes = datItem.GetDuplicates(this);
|
List<DatItem> dupes = datItem.GetDuplicates(this, sorted: true);
|
||||||
|
DatItem newDatItem = (DatItem)datItem.Clone();
|
||||||
|
|
||||||
if (dupes.Count > 0)
|
if (dupes.Count > 0)
|
||||||
{
|
{
|
||||||
datItem.Name = dupes[0].Name;
|
newDatItem.Name = dupes[0].Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
newDatItems.Add(datItem);
|
newDatItems.Add(newDatItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now add the new list to the key
|
// Now add the new list to the key
|
||||||
@@ -1895,7 +1897,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
intDat.BucketBy(SortedBy.CRC, DedupeType.Full);
|
intDat.BucketBy(SortedBy.CRC, DedupeType.Full);
|
||||||
|
|
||||||
// Then we do a hashwise comparison against the base DAT
|
// Then we do a hashwise comparison against the base DAT
|
||||||
List<string> keys = intDat.Keys.ToList();
|
List<string> keys = intDat.Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> datItems = intDat[key];
|
List<DatItem> datItems = intDat[key];
|
||||||
@@ -1997,7 +1999,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// Now, loop through the dictionary and populate the correct DATs
|
// Now, loop through the dictionary and populate the correct DATs
|
||||||
watch.Start("Populating all output DATs");
|
watch.Start("Populating all output DATs");
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
|
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
@@ -2128,7 +2130,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Now, loop through the dictionary and populate the correct DATs
|
// Now, loop through the dictionary and populate the correct DATs
|
||||||
watch.Start("Populating all output DATs");
|
watch.Start("Populating all output DATs");
|
||||||
|
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = DatItem.Merge(this[key]);
|
List<DatItem> items = DatItem.Merge(this[key]);
|
||||||
@@ -2226,7 +2228,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If we're in SuperDAT mode, prefix all games with their respective DATs
|
// If we're in SuperDAT mode, prefix all games with their respective DATs
|
||||||
if (Type == "SuperDAT")
|
if (Type == "SuperDAT")
|
||||||
{
|
{
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key].ToList();
|
List<DatItem> items = this[key].ToList();
|
||||||
@@ -2352,7 +2354,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
SortedDictionary<string, List<DatItem>> sorted = new SortedDictionary<string, List<DatItem>>();
|
SortedDictionary<string, List<DatItem>> sorted = new SortedDictionary<string, List<DatItem>>();
|
||||||
|
|
||||||
// Now perform a deep clone on the entire dictionary
|
// Now perform a deep clone on the entire dictionary
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
{
|
{
|
||||||
// Clone each list of DATs in the dictionary
|
// Clone each list of DATs in the dictionary
|
||||||
@@ -2414,7 +2416,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Loop over every key in the dictionary
|
// Loop over every key in the dictionary
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
{
|
{
|
||||||
// For every item in the current key
|
// For every item in the current key
|
||||||
@@ -2471,7 +2473,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
// First we want to get a mapping for all games to description
|
// First we want to get a mapping for all games to description
|
||||||
ConcurrentDictionary<string, string> mapping = new ConcurrentDictionary<string, string>();
|
ConcurrentDictionary<string, string> mapping = new ConcurrentDictionary<string, string>();
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
@@ -2486,7 +2488,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Now we loop through every item and update accordingly
|
// Now we loop through every item and update accordingly
|
||||||
keys = Keys.ToList();
|
keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
@@ -2541,7 +2543,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Globals.Logger.User("Stripping requested hashes");
|
Globals.Logger.User("Stripping requested hashes");
|
||||||
|
|
||||||
// Now process all of the roms
|
// Now process all of the roms
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
@@ -2619,7 +2621,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string pattern = @"([0-9]{2}\.[0-9]{2}\.[0-9]{2}-)(.*?-.*?)";
|
string pattern = @"([0-9]{2}\.[0-9]{2}\.[0-9]{2}-)(.*?-.*?)";
|
||||||
|
|
||||||
// Now process all of the roms
|
// Now process all of the roms
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
@@ -2766,7 +2768,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddRomsFromBios()
|
private void AddRomsFromBios()
|
||||||
{
|
{
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
// If the game has no items in it, we want to continue
|
// If the game has no items in it, we want to continue
|
||||||
@@ -2814,7 +2816,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddRomsFromDevices()
|
private void AddRomsFromDevices()
|
||||||
{
|
{
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
// If the game has no devices, we continue
|
// If the game has no devices, we continue
|
||||||
@@ -2854,7 +2856,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddRomsFromParent()
|
private void AddRomsFromParent()
|
||||||
{
|
{
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
// If the game has no items in it, we want to continue
|
// If the game has no items in it, we want to continue
|
||||||
@@ -2910,7 +2912,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddRomsFromChildren()
|
private void AddRomsFromChildren()
|
||||||
{
|
{
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
// Determine if the game has a parent or not
|
// Determine if the game has a parent or not
|
||||||
@@ -2962,7 +2964,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void RemoveBiosAndDeviceSets()
|
private void RemoveBiosAndDeviceSets()
|
||||||
{
|
{
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
if (this[game].Count > 0
|
if (this[game].Count > 0
|
||||||
@@ -2980,7 +2982,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
private void RemoveBiosRomsFromChild()
|
private void RemoveBiosRomsFromChild()
|
||||||
{
|
{
|
||||||
// Loop through the romof tags
|
// Loop through the romof tags
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
// If the game has no items in it, we want to continue
|
// If the game has no items in it, we want to continue
|
||||||
@@ -3023,7 +3025,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void RemoveRomsFromChild()
|
private void RemoveRomsFromChild()
|
||||||
{
|
{
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
// If the game has no items in it, we want to continue
|
// If the game has no items in it, we want to continue
|
||||||
@@ -3074,7 +3076,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void RemoveTagsFromChild()
|
private void RemoveTagsFromChild()
|
||||||
{
|
{
|
||||||
List<string> games = Keys.ToList();
|
List<string> games = Keys;
|
||||||
foreach (string game in games)
|
foreach (string game in games)
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[game];
|
List<DatItem> items = this[game];
|
||||||
@@ -3963,7 +3965,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
BucketBy(SortedBy.SHA1, DedupeType.None);
|
BucketBy(SortedBy.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Then we want to loop through each of the hashes and see if we can rebuild
|
// Then we want to loop through each of the hashes and see if we can rebuild
|
||||||
List<string> hashes = Keys.ToList();
|
List<string> hashes = Keys;
|
||||||
foreach (string hash in hashes)
|
foreach (string hash in hashes)
|
||||||
{
|
{
|
||||||
// Pre-empt any issues that could arise from string length
|
// Pre-empt any issues that could arise from string length
|
||||||
@@ -4697,7 +4699,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
BucketBy(SortedBy.SHA1, DedupeType.None);
|
BucketBy(SortedBy.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Then we want to loop through each of the hashes and see if we can rebuild
|
// Then we want to loop through each of the hashes and see if we can rebuild
|
||||||
List<string> hashes = Keys.ToList();
|
List<string> hashes = Keys;
|
||||||
foreach (string hash in hashes)
|
foreach (string hash in hashes)
|
||||||
{
|
{
|
||||||
// Pre-empt any issues that could arise from string length
|
// Pre-empt any issues that could arise from string length
|
||||||
@@ -4913,7 +4915,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now separate the roms accordingly
|
// Now separate the roms accordingly
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
@@ -5135,7 +5137,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Now populate each of the DAT objects in turn
|
// Now populate each of the DAT objects in turn
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
@@ -5243,7 +5245,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Sort the input keys
|
// Sort the input keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(SplitByLevelSort);
|
keys.Sort(SplitByLevelSort);
|
||||||
|
|
||||||
// Then, we loop over the games
|
// Then, we loop over the games
|
||||||
@@ -5412,7 +5414,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Now populate each of the DAT objects in turn
|
// Now populate each of the DAT objects in turn
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
@@ -5637,7 +5639,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop through and add
|
// Loop through and add
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
{
|
{
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(true));
|
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(true));
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -1199,7 +1199,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
List<string> splitpath = new List<string>();
|
List<string> splitpath = new List<string>();
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
List<string> splitpath = new List<string>();
|
List<string> splitpath = new List<string>();
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
WriteHeader(sw, delim);
|
WriteHeader(sw, delim);
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Get a properly sorted set of keys
|
||||||
List<string> keys = Keys.ToList();
|
List<string> keys = Keys;
|
||||||
keys.Sort(new NaturalComparer());
|
keys.Sort(new NaturalComparer());
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
|
|||||||
@@ -583,8 +583,9 @@ namespace SabreTools.Library.Items
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="datdata">Dat to match against</param>
|
/// <param name="datdata">Dat to match against</param>
|
||||||
/// <param name="remove">True to remove matched roms from the input, false otherwise (default)</param>
|
/// <param name="remove">True to remove matched roms from the input, false otherwise (default)</param>
|
||||||
|
/// <param name="sorted">True if the DAT is already sorted accordingly, false otherwise (default)</param>
|
||||||
/// <returns>List of matched DatItem objects</returns>
|
/// <returns>List of matched DatItem objects</returns>
|
||||||
public List<DatItem> GetDuplicates(DatFile datdata, bool remove = false)
|
public List<DatItem> GetDuplicates(DatFile datdata, bool remove = false, bool sorted = false)
|
||||||
{
|
{
|
||||||
List<DatItem> output = new List<DatItem>();
|
List<DatItem> output = new List<DatItem>();
|
||||||
|
|
||||||
@@ -595,7 +596,7 @@ namespace SabreTools.Library.Items
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We want to get the proper key for the DatItem
|
// We want to get the proper key for the DatItem
|
||||||
string key = SortAndGetKey(datdata);
|
string key = SortAndGetKey(datdata, sorted);
|
||||||
|
|
||||||
// If the key doesn't exist, return the empty list
|
// If the key doesn't exist, return the empty list
|
||||||
if (!datdata.Contains(key))
|
if (!datdata.Contains(key))
|
||||||
|
|||||||
Reference in New Issue
Block a user