-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
40 lines (31 loc) · 1.19 KB
/
Copy pathProgram.cs
File metadata and controls
40 lines (31 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using ImagesToBinary.Common;
using ImagesToBinary.Models;
using ImagesToBinary.Services;
using Microsoft.Extensions.Configuration;
namespace ImagesToBinary;
internal class Program
{
static async Task Main(string[] args)
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.Build();
var imageSettings = config.GetSection("ImageSettings").Get<ImageSettings>();
if (imageSettings == null)
{
Console.WriteLine("ImageSettings section not found in appsettings.json");
return;
}
var imageSettingsValidator = new ImageSettingsValidator(imageSettings);
var errors = imageSettingsValidator.ValidateImageSettings();
if (errors.Count > 0)
{
Console.WriteLine("Validation Faild, With Errors:");
Logger.LogErrors(errors);
return;
}
var imagesPathToBinaryService = new ImagesPathToBinaryService(imageSettings);
await Task.Run(() => imagesPathToBinaryService.ConvertImagesToBinaryInParallel());
}
}