Sorry, the code got cut
SaveFileAsyncReadingSync(entry.OpenEntryStream(), folders[id], entry.FilePath)
where entry is each one of the RarArchiveEntry in my RARfile. The calls are concurrent, and the resulting images are corrupted. However if I do the calls sequentially everything works fine.
private async Task<string> SaveFileAsyncReadingSync(Stream streamSource, StorageFolder destinationStorageFolder, string destinationFileName)
{
var file = await destinationStorageFolder.CreateFileAsync(destinationFileName, CreationCollisionOption.ReplaceExisting);
using (var ostream = await file.OpenStreamForWriteAsync())
{
int count = 0;
do
{
var buffer = new byte[1024];
count = streamSource.Read(buffer, 0, 1024);
await ostream.WriteAsync(buffer, 0, count);
}
while (count > 0);
}
return destinationStorageFolder.Name + "/" + file.Name;
}
}
and it's called by:SaveFileAsyncReadingSync(entry.OpenEntryStream(), folders[id], entry.FilePath)
where entry is each one of the RarArchiveEntry in my RARfile. The calls are concurrent, and the resulting images are corrupted. However if I do the calls sequentially everything works fine.