diff --git a/Directory.Build.props b/Directory.Build.props index 7269c0b..77f6870 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ disable enable Copyright © Mihnea Rădulescu 2023 - 2024 - 1.2024.05.04 + 1.2024.06.25 $(AssemblyVersion) embedded diff --git a/ImageNormalizer.Test/ImageNormalizer.Test.csproj b/ImageNormalizer.Test/ImageNormalizer.Test.csproj index 5ba7147..9d6c7ec 100644 --- a/ImageNormalizer.Test/ImageNormalizer.Test.csproj +++ b/ImageNormalizer.Test/ImageNormalizer.Test.csproj @@ -38,10 +38,10 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/ImageNormalizer/ApplicationRunner.cs b/ImageNormalizer/ApplicationRunner.cs index 981c847..b985c10 100644 --- a/ImageNormalizer/ApplicationRunner.cs +++ b/ImageNormalizer/ApplicationRunner.cs @@ -29,8 +29,7 @@ public void Run( var arguments = _argumentsFactory.Create( inputDirectory, outputDirectory, outputMaximumImageSize, outputImageQuality, maxDegreeOfParallelism); - var areValidArguments = _argumentsValidator.AreValidArguments( - arguments, out string? errorMessage); + var areValidArguments = _argumentsValidator.AreValidArguments(arguments, out string? errorMessage); if (!areValidArguments) { @@ -38,7 +37,11 @@ public void Run( return; } - + + _logger.Info( + $@"Normalizing images from input directory ""{arguments.InputPath}"" to output directory ""{arguments.OutputPath}"", resizing to output maximum image width/height {arguments.OutputMaximumImageSize}, at output image quality {arguments.OutputImageQuality}, using maximum degree of parallelism {arguments.MaxDegreeOfParallelism}."); + _logger.NewLine(); + try { var imageDirectoryInfo = _imageDirectoryInfoFactory.Create(arguments); diff --git a/ImageNormalizer/FileSystemInfo/ImageDirectoryInfo.cs b/ImageNormalizer/FileSystemInfo/ImageDirectoryInfo.cs index 4e46e1c..634daad 100644 --- a/ImageNormalizer/FileSystemInfo/ImageDirectoryInfo.cs +++ b/ImageNormalizer/FileSystemInfo/ImageDirectoryInfo.cs @@ -84,7 +84,7 @@ public void NormalizeFileSystemInfo() } _logger.Info( - $@"Processing input directory ""{_arguments.InputPath}"" into output directory ""{_arguments.OutputPath}"", resizing to output maximum image width/height {_arguments.OutputMaximumImageSize}, at output image quality {_arguments.OutputImageQuality}, using maximum degree of parallelism {_arguments.MaxDegreeOfParallelism}."); + $@"Processing images from input directory ""{_arguments.InputPath}"" to output directory ""{_arguments.OutputPath}""."); Parallel.ForEach( _imageFileInfoCollection, diff --git a/ImageNormalizer/Logger/ConsoleLogger.cs b/ImageNormalizer/Logger/ConsoleLogger.cs index 37d5f54..4b3d1ca 100644 --- a/ImageNormalizer/Logger/ConsoleLogger.cs +++ b/ImageNormalizer/Logger/ConsoleLogger.cs @@ -4,18 +4,11 @@ namespace ImageNormalizer.Logger; public class ConsoleLogger : ILogger { - public void Info(string message) - { - Console.Out.WriteLine(message); - } + public void NewLine() => Console.Out.WriteLine(); - public void Error(string message) - { - Console.Error.WriteLine($"Error: {message}"); - } + public void Info(string message) => Console.Out.WriteLine(message); + + public void Error(string message) => Console.Error.WriteLine($"Error: {message}"); - public void Error(Exception ex) - { - Console.Error.WriteLine($"Error: {ex}"); - } + public void Error(Exception ex) => Console.Error.WriteLine($"Error: {ex}"); } diff --git a/ImageNormalizer/Logger/ILogger.cs b/ImageNormalizer/Logger/ILogger.cs index 2b0129c..26fb68a 100644 --- a/ImageNormalizer/Logger/ILogger.cs +++ b/ImageNormalizer/Logger/ILogger.cs @@ -4,6 +4,8 @@ namespace ImageNormalizer.Logger; public interface ILogger { + void NewLine(); + void Info(string message); void Error(string message); diff --git a/ImageNormalizer/Program.cs b/ImageNormalizer/Program.cs index 5341d39..9010f4b 100644 --- a/ImageNormalizer/Program.cs +++ b/ImageNormalizer/Program.cs @@ -46,7 +46,7 @@ private static void RegisterCommands(CoconaApp app) [Argument(Description = "The input directory")] string inputDirectory, - [Argument(Description = "The output directory")] + [Argument(Description = "The output directory, to be created, if it does not exist")] string outputDirectory, [Option("max-width-height", ['m'], Description = "The output maximum image width/height")] @@ -59,7 +59,7 @@ private static void RegisterCommands(CoconaApp app) [Option("max-degree-of-parallelism", ['p'], Description = "The maximum degree of parallel image processing, upper-bounded by processor count")] [Range(1, 128)] - int maxDegreeOfParallelism = 16 + int maxDegreeOfParallelism = 4 ) => { var applicationRunner = app.Services.GetService(); diff --git a/README.md b/README.md index eb9bc22..d6358ef 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ __Usage__: ImageNormalizer [--max-width-height] [--quality] [--max-degree-of-par Arguments: * 0: input-directory - The input directory (Required) -* 1: output-directory - The output directory (Required) +* 1: output-directory - The output directory, to be created, if it does not exist (Required) Options: * -m, --max-width-height - The output maximum image width/height (Default: 3840) * -q, --quality - The output image quality (Default: 80) -* -p, --max-degree-of-parallelism - The maximum degree of parallel image processing, upper-bounded by processor count (Default: 16) +* -p, --max-degree-of-parallelism - The maximum degree of parallel image processing, upper-bounded by processor count (Default: 4) * -h, --help - Show help message * --version - Show version