thread lock

This commit is contained in:
4sval 2023-01-06 05:35:06 +01:00
parent 41ebad422d
commit eebaa19178
2 changed files with 8 additions and 4 deletions

@ -1 +1 @@
Subproject commit 7d4cd4656e2ebf97caea2d010e20b033612e88ca
Subproject commit bfb2b3ce34ceee5c9785d845a5da2b594f534493

View File

@ -908,6 +908,7 @@ public class CUE4ParseViewModel : ViewModel
}
}
private readonly object _rawData = new ();
public void ExportData(string fullPath, bool updateUi = true)
{
var fileName = fullPath.SubstringAfterLast('/');
@ -916,9 +917,12 @@ public class CUE4ParseViewModel : ViewModel
string path = UserSettings.Default.RawDataDirectory;
Parallel.ForEach(assets, kvp =>
{
path = Path.Combine(path, UserSettings.Default.KeepDirectoryStructure ? kvp.Key : kvp.Key.SubstringAfterLast('/')).Replace('\\', '/');
Directory.CreateDirectory(path.SubstringBeforeLast('/'));
File.WriteAllBytes(path, kvp.Value);
lock (_rawData)
{
path = Path.Combine(UserSettings.Default.RawDataDirectory, UserSettings.Default.KeepDirectoryStructure ? kvp.Key : kvp.Key.SubstringAfterLast('/')).Replace('\\', '/');
Directory.CreateDirectory(path.SubstringBeforeLast('/'));
File.WriteAllBytes(path, kvp.Value);
}
});
if (updateUi)