mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DATFromDirParallel] Add locks
This commit is contained in:
@@ -209,6 +209,9 @@ namespace SabreTools
|
||||
{
|
||||
// Add the list if it doesn't exist already
|
||||
string key = rom.HashData.Size + "-" + rom.HashData.CRC;
|
||||
|
||||
lock (_datdata.Files)
|
||||
{
|
||||
if (!_datdata.Files.ContainsKey(key))
|
||||
{
|
||||
_datdata.Files.Add(key, new List<Rom>());
|
||||
@@ -217,6 +220,8 @@ namespace SabreTools
|
||||
_datdata.Files[key].Add(rom);
|
||||
_logger.User("File added: " + Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.User("File not added: " + Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
|
||||
@@ -308,10 +313,13 @@ namespace SabreTools
|
||||
{
|
||||
// Add the list if it doesn't exist already
|
||||
string key = rom.HashData.Size + "-" + rom.HashData.CRC;
|
||||
lock (_datdata.Files)
|
||||
{
|
||||
if (!_datdata.Files.ContainsKey(key))
|
||||
{
|
||||
_datdata.Files.Add(key, new List<Rom>());
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -391,7 +399,10 @@ namespace SabreTools
|
||||
rom.Name = romname;
|
||||
|
||||
// Add the file information to the DAT
|
||||
lock (_datdata.Files)
|
||||
{
|
||||
_datdata.Files[key].Add(rom);
|
||||
}
|
||||
|
||||
_logger.User("File added: " + romname + Environment.NewLine);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user