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,13 +209,18 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
// Add the list if it doesn't exist already
|
// Add the list if it doesn't exist already
|
||||||
string key = rom.HashData.Size + "-" + rom.HashData.CRC;
|
string key = rom.HashData.Size + "-" + rom.HashData.CRC;
|
||||||
if (!_datdata.Files.ContainsKey(key))
|
|
||||||
|
lock (_datdata.Files)
|
||||||
{
|
{
|
||||||
_datdata.Files.Add(key, new List<Rom>());
|
if (!_datdata.Files.ContainsKey(key))
|
||||||
|
{
|
||||||
|
_datdata.Files.Add(key, new List<Rom>());
|
||||||
|
}
|
||||||
|
|
||||||
|
_datdata.Files[key].Add(rom);
|
||||||
|
_logger.User("File added: " + Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
_datdata.Files[key].Add(rom);
|
|
||||||
_logger.User("File added: " + Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -308,9 +313,12 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
// Add the list if it doesn't exist already
|
// Add the list if it doesn't exist already
|
||||||
string key = rom.HashData.Size + "-" + rom.HashData.CRC;
|
string key = rom.HashData.Size + "-" + rom.HashData.CRC;
|
||||||
if (!_datdata.Files.ContainsKey(key))
|
lock (_datdata.Files)
|
||||||
{
|
{
|
||||||
_datdata.Files.Add(key, new List<Rom>());
|
if (!_datdata.Files.ContainsKey(key))
|
||||||
|
{
|
||||||
|
_datdata.Files.Add(key, new List<Rom>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -391,7 +399,10 @@ namespace SabreTools
|
|||||||
rom.Name = romname;
|
rom.Name = romname;
|
||||||
|
|
||||||
// Add the file information to the DAT
|
// Add the file information to the DAT
|
||||||
_datdata.Files[key].Add(rom);
|
lock (_datdata.Files)
|
||||||
|
{
|
||||||
|
_datdata.Files[key].Add(rom);
|
||||||
|
}
|
||||||
|
|
||||||
_logger.User("File added: " + romname + Environment.NewLine);
|
_logger.User("File added: " + romname + Environment.NewLine);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user