[fxcop] image resizer ui (#6841)

* adjustments

* Settings fixed

* Getting resizing tests operational again

* fixed default vs loading from settings

* one small tewak
This commit is contained in:
Clint Rutkas
2020-10-01 11:33:23 -07:00
committed by GitHub
parent 19b519638f
commit c219fe0d1d
21 changed files with 141 additions and 112 deletions

View File

@@ -24,12 +24,15 @@ namespace ImageResizer.Models
// NB: We read these from stdin since there are limits on the number of args you can have
string file;
while ((file = standardInput.ReadLine()) != null)
if (standardInput != null)
{
batch.Files.Add(file);
while ((file = standardInput.ReadLine()) != null)
{
batch.Files.Add(file);
}
}
for (var i = 0; i < args.Length; i++)
for (var i = 0; i < args?.Length; i++)
{
if (args[i] == "/d")
{
@@ -43,9 +46,7 @@ namespace ImageResizer.Models
return batch;
}
public IEnumerable<ResizeError> Process(
CancellationToken cancellationToken,
Action<int, double> reportProgress)
public IEnumerable<ResizeError> Process(Action<int, double> reportProgress, CancellationToken cancellationToken)
{
double total = Files.Count;
var completed = 0;
@@ -66,7 +67,9 @@ namespace ImageResizer.Models
{
Execute(file);
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
{
errors.Add(new ResizeError { File = Path.GetFileName(file), Error = ex.Message });
}