From 9dabb790706086eb9b8c01c94b0c88f39eb30d71 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 2 May 2019 20:25:53 +0100 Subject: [PATCH] Fix tape dump adding a spurious file at the end of a tape. --- DiscImageChef.Core/Devices/Dumping/SSC.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/DiscImageChef.Core/Devices/Dumping/SSC.cs b/DiscImageChef.Core/Devices/Dumping/SSC.cs index 76c255054..6c03de939 100644 --- a/DiscImageChef.Core/Devices/Dumping/SSC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SSC.cs @@ -680,7 +680,8 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Finished partition {0}", currentPartition); currentTapeFile.LastBlock = currentBlock - 1; - (outputPlugin as IWritableTapeImage).AddFile(currentTapeFile); + if(currentTapeFile.LastBlock > currentTapeFile.FirstBlock) + (outputPlugin as IWritableTapeImage).AddFile(currentTapeFile); currentTapePartition.LastBlock = currentBlock - 1; (outputPlugin as IWritableTapeImage).AddPartition(currentTapePartition); @@ -843,10 +844,15 @@ namespace DiscImageChef.Core.Devices.Dumping blocks = currentBlock + 1; end = DateTime.UtcNow; - currentTapeFile.LastBlock = currentBlock - 1; - (outputPlugin as IWritableTapeImage).AddFile(currentTapeFile); - currentTapePartition.LastBlock = currentBlock - 1; - (outputPlugin as IWritableTapeImage).AddPartition(currentTapePartition); + // If not aborted this is added at the end of medium + if(aborted) + { + currentTapeFile.LastBlock = currentBlock - 1; + (outputPlugin as IWritableTapeImage).AddFile(currentTapeFile); + + currentTapePartition.LastBlock = currentBlock - 1; + (outputPlugin as IWritableTapeImage).AddPartition(currentTapePartition); + } EndProgress?.Invoke(); mhddLog.Close();