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

@@ -155,7 +155,7 @@ namespace Aaru.Commands.Image
return (int)ErrorNumber.UnrecognizedFormat;
}
bool opened = false;
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
@@ -163,12 +163,11 @@ namespace Aaru.Commands.Image
opened = inputFormat.Open(inputFilter);
});
if(!opened)
if(opened != ErrorNumber.NoError)
{
AaruConsole.WriteLine("Unable to open image format");
AaruConsole.WriteLine("No error given");
AaruConsole.WriteLine("Error {opened} opening image format");
return (int)ErrorNumber.CannotOpenFormat;
return (int)opened;
}
Statistics.AddMediaFormat(inputFormat.Format);