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
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -464,11 +464,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -239,6 +239,20 @@ namespace SabreTools.Library.DatFiles
|
|||||||
DatHeader.Type = type;
|
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>
|
/// <summary>
|
||||||
/// Ensure the key exists in the items dictionary
|
/// Ensure the key exists in the items dictionary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1335,8 +1349,8 @@ 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;
|
|
||||||
|
|
||||||
|
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]);
|
||||||
|
|||||||
@@ -290,11 +290,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -110,11 +110,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
VerifyFieldCount = true
|
VerifyFieldCount = true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -125,11 +125,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
VerifyFieldCount = true
|
VerifyFieldCount = true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -776,11 +776,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -253,11 +253,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -574,11 +574,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -671,11 +671,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -67,11 +67,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -757,11 +757,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -501,11 +501,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -392,11 +392,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
List<string> splitpath = new List<string>();
|
List<string> splitpath = new List<string>();
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -563,11 +563,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
List<string> splitpath = new List<string>();
|
List<string> splitpath = new List<string>();
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -882,11 +882,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out the header
|
// Write out the header
|
||||||
WriteHeader(svw);
|
WriteHeader(svw);
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -554,11 +554,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Write out each of the machines and roms
|
// Write out each of the machines and roms
|
||||||
string lastgame = null;
|
string lastgame = null;
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
// Use a sorted list of games to output
|
||||||
List<string> keys = Keys;
|
foreach (string key in SortedKeys)
|
||||||
keys.Sort(new NaturalComparer());
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<DatItem> roms = this[key];
|
List<DatItem> roms = this[key];
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace SabreTools.Library.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current toolset version to be used by all child applications
|
/// The current toolset version to be used by all child applications
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly static string Version = $"v1.0.2";
|
///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-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
|
||||||
public const int HeaderHeight = 3;
|
public const int HeaderHeight = 3;
|
||||||
|
|
||||||
#region 0-byte file constants
|
#region 0-byte file constants
|
||||||
|
|||||||
Reference in New Issue
Block a user