11// See https://aka.ms/new-console-template for more information
22
3- using System . Diagnostics ;
4- using System . Text . Json ;
5-
63using DotNetCampus . MediaConverters . Contexts ;
74using DotNetCampus . MediaConverters . Imaging . Optimizations ;
5+ using DotNetCampus . MediaConverters . Workers ;
86
97using SixLabors . ImageSharp ;
108using SixLabors . ImageSharp . PixelFormats ;
9+
10+ using System . Diagnostics ;
11+ using System . Text . Json ;
12+
1113using SourceGenerationContext = DotNetCampus . MediaConverters . Contexts . SourceGenerationContext ;
1214
1315namespace DotNetCampus . MediaConverters ;
@@ -44,16 +46,12 @@ public static async Task<int> Main(string[] args)
4446 break ;
4547 case ImageFileOptimizationFailureReason . UnknownImageFormat :
4648 return ErrorCode . UnknownImageFormat ;
47- break ;
4849 case ImageFileOptimizationFailureReason . InvalidImageContent :
4950 return ErrorCode . InvalidImageContent ;
50- break ;
5151 case ImageFileOptimizationFailureReason . FileNotFound :
5252 return ErrorCode . ImageFileNotFound ;
53- break ;
5453 case ImageFileOptimizationFailureReason . NotSupported :
5554 return ErrorCode . NotSupported ;
56- break ;
5755 default :
5856 throw new ArgumentOutOfRangeException ( ) ;
5957 }
@@ -66,10 +64,11 @@ public static async Task<int> Main(string[] args)
6664 if ( imageConvertContext . ImageConvertTaskList is { } list )
6765 {
6866 using var image = await Image . LoadAsync < Rgba32 > ( optimizedImageFile . FullName ) ;
67+ var workerProvider = new WorkerProvider ( ) ;
6968
70- foreach ( var imageConvertTask in list )
69+ foreach ( IImageConvertTask imageConvertTask in list )
7170 {
72- imageConvertTask . Run ( image ) ;
71+ workerProvider . Run ( image , imageConvertTask ) ;
7372 }
7473 }
7574
0 commit comments