mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Perf improvements, fix regex
This commit is contained in:
@@ -1952,7 +1952,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the key and add the file
|
// Get the key and add the file
|
||||||
key = item.GetKey(Field.DatItem_CRC);
|
key = item.GetKey(Field.Machine_Name);
|
||||||
Items.Add(key, item);
|
Items.Add(key, item);
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// 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.ToList();
|
||||||
for (int k = 0; k < oldkeys.Count; k++)
|
Parallel.For(0, oldkeys.Count, Globals.ParallelOptions, k =>
|
||||||
{
|
{
|
||||||
string key = oldkeys[k];
|
string key = oldkeys[k];
|
||||||
|
|
||||||
@@ -793,7 +793,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If the key is now empty, remove it
|
// If the key is now empty, remove it
|
||||||
if (this[key].Count == 0)
|
if (this[key].Count == 0)
|
||||||
Remove(key);
|
Remove(key);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
||||||
|
|||||||
@@ -160,9 +160,9 @@ namespace SabreTools.Library.Tools
|
|||||||
input = input.ToLowerInvariant();
|
input = input.ToLowerInvariant();
|
||||||
|
|
||||||
// Create regex strings
|
// Create regex strings
|
||||||
string headerRegex = @"^(dat|header|datheader)[.-_\s]";
|
string headerRegex = @"^(dat|header|datheader)[.\-_\s]";
|
||||||
string machineRegex = @"^(game|machine)[.-_\s]";
|
string machineRegex = @"^(game|machine)[.\-_\s]";
|
||||||
string datItemRegex = @"^(item|datitem|archive|biosset|blank|disk|release|rom|sample)[.-_\s]";
|
string datItemRegex = @"^(item|datitem)[.\-_\s]";
|
||||||
|
|
||||||
// If we have a header field
|
// If we have a header field
|
||||||
if (Regex.IsMatch(input, headerRegex))
|
if (Regex.IsMatch(input, headerRegex))
|
||||||
@@ -1057,7 +1057,8 @@ namespace SabreTools.Library.Tools
|
|||||||
|
|
||||||
// Else, we fall back on the old matching
|
// Else, we fall back on the old matching
|
||||||
// TODO: Remove this entirely
|
// TODO: Remove this entirely
|
||||||
switch (input.Replace(' ', '_').Replace('-', '_').Replace('.', '_'))
|
// TODO: Normalize space replacement
|
||||||
|
switch (input)
|
||||||
{
|
{
|
||||||
#region Machine
|
#region Machine
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user