Refactor IMediaImage.Open to return error status instead of boolean.

This commit is contained in:
2021-09-16 19:10:39 +01:00
parent ac275aa8cb
commit ef2fc1788a
86 changed files with 699 additions and 512 deletions

View File

@@ -69,7 +69,7 @@ namespace Aaru.Core.Devices.Dumping
double minSpeed = double.MaxValue;
byte[] readBuffer;
Modes.DecodedMode? decMode = null;
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>();
Dictionary<MediaTagType, byte[]> mediaTags = new();
byte[] cmdBuf;
bool ret;
@@ -694,10 +694,11 @@ namespace Aaru.Core.Devices.Dumping
var filters = new FiltersList();
IFilter filter = filters.GetFilter(_outputPath);
IMediaImage inputPlugin = ImageFormat.Detect(filter);
ErrorNumber opened = inputPlugin.Open(filter);
if(!inputPlugin.Open(filter))
if(opened != ErrorNumber.NoError)
{
StoppingErrorMessage?.Invoke("Could not open created image.");
StoppingErrorMessage?.Invoke($"Error {opened} opening created image.");
return;
}
@@ -733,7 +734,7 @@ namespace Aaru.Core.Devices.Dumping
sidecar = _preSidecar;
}
List<(ulong start, string type)> filesystems = new List<(ulong start, string type)>();
List<(ulong start, string type)> filesystems = new();
if(sidecar.BlockMedia[0].FileSystemInformation != null)
filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation