mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Create and use SortedKeys
This commit is contained in:
@@ -134,11 +134,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -464,11 +464,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -239,6 +239,20 @@ namespace SabreTools.Library.DatFiles
|
||||
DatHeader.Type = type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the keys in sorted order from the file dictionary
|
||||
/// </summary>
|
||||
/// <returns>List of the keys in sorted order</returns>
|
||||
public List<string> SortedKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
var keys = Items.Keys.ToList();
|
||||
keys.Sort(new NaturalComparer());
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure the key exists in the items dictionary
|
||||
/// </summary>
|
||||
@@ -1335,8 +1349,8 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Now, loop through the dictionary and populate the correct DATs
|
||||
watch.Start("Populating all output DATs");
|
||||
List<string> keys = Keys;
|
||||
|
||||
List<string> keys = Keys;
|
||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||
{
|
||||
List<DatItem> items = DatItem.Merge(this[key]);
|
||||
|
||||
@@ -290,11 +290,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -110,11 +110,8 @@ namespace SabreTools.Library.DatFiles
|
||||
VerifyFieldCount = true
|
||||
};
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -125,11 +125,8 @@ namespace SabreTools.Library.DatFiles
|
||||
VerifyFieldCount = true
|
||||
};
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -776,11 +776,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -253,11 +253,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -574,11 +574,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -671,11 +671,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -67,11 +67,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -757,11 +757,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -501,11 +501,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -392,11 +392,8 @@ namespace SabreTools.Library.DatFiles
|
||||
string lastgame = null;
|
||||
List<string> splitpath = new List<string>();
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -563,11 +563,8 @@ namespace SabreTools.Library.DatFiles
|
||||
string lastgame = null;
|
||||
List<string> splitpath = new List<string>();
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -882,11 +882,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out the header
|
||||
WriteHeader(svw);
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -554,11 +554,8 @@ namespace SabreTools.Library.DatFiles
|
||||
// Write out each of the machines and roms
|
||||
string lastgame = null;
|
||||
|
||||
// Get a properly sorted set of keys
|
||||
List<string> keys = Keys;
|
||||
keys.Sort(new NaturalComparer());
|
||||
|
||||
foreach (string key in keys)
|
||||
// Use a sorted list of games to output
|
||||
foreach (string key in SortedKeys)
|
||||
{
|
||||
List<DatItem> roms = this[key];
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace SabreTools.Library.Data
|
||||
/// <summary>
|
||||
/// The current toolset version to be used by all child applications
|
||||
/// </summary>
|
||||
public readonly static string Version = $"v1.0.2";
|
||||
//public readonly static string Version = $"v1.0.2-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
|
||||
///public readonly static string Version = $"v1.0.2";
|
||||
public readonly static string Version = $"v1.0.2-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
|
||||
public const int HeaderHeight = 3;
|
||||
|
||||
#region 0-byte file constants
|
||||
|
||||
Reference in New Issue
Block a user