mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Reduce the number of steps
This commit is contained in:
@@ -151,21 +151,23 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
// Get all values in the dictionary and write out
|
// Get all values in the dictionary and write out
|
||||||
List<RomData> sortable = new List<RomData>();
|
List<RomData> sortable = new List<RomData>();
|
||||||
List<string> keys = dict.Keys.ToList();
|
long count = 0;
|
||||||
foreach (string key in keys)
|
foreach (List<RomData> roms in dict.Values)
|
||||||
{
|
{
|
||||||
if (merge)
|
if (merge)
|
||||||
{
|
{
|
||||||
sortable.Add(dict[key][0]);
|
sortable.Add(roms[0]);
|
||||||
dict.Remove(key);
|
count++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sortable.AddRange(dict[key]);
|
sortable.AddRange(roms);
|
||||||
dict.Remove(key);
|
count += roms.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Log("The total number of items added for output is " + count);
|
||||||
|
|
||||||
// Sort the new list
|
// Sort the new list
|
||||||
RomManipulation.Sort(sortable, true);
|
RomManipulation.Sort(sortable, true);
|
||||||
|
|
||||||
|
|||||||
@@ -604,7 +604,8 @@ namespace SabreTools.Helper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roms">List of RomData objects representing the roms to be sorted</param>
|
/// <param name="roms">List of RomData objects representing the roms to be sorted</param>
|
||||||
/// <param name="norename">True if files are not renamed, false otherwise</param>
|
/// <param name="norename">True if files are not renamed, false otherwise</param>
|
||||||
public static void Sort(List<RomData> roms, bool norename)
|
/// <returns>True if it sorted correctly, false otherwise</returns>
|
||||||
|
public static bool Sort(List<RomData> roms, bool norename)
|
||||||
{
|
{
|
||||||
roms.Sort(delegate (RomData x, RomData y)
|
roms.Sort(delegate (RomData x, RomData y)
|
||||||
{
|
{
|
||||||
@@ -622,6 +623,7 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
return (norename ? String.Compare(x.Game, y.Game) : x.SystemID - y.SystemID);
|
return (norename ? String.Compare(x.Game, y.Game) : x.SystemID - y.SystemID);
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user