DimerceDemoApplication/Program.cs
2023-01-05 14:56:42 +01:00

31 lines
No EOL
950 B
C#

using Configuration;
using DTO;
using static Configuration.DemoApplicationConfiguration;
namespace OrderParser
{
class Program
{
static void Main(string[] args)
{
try
{
var filesInfoConfig = DemoApplicationConfiguration.InitializeFrom(args);
var csvFileWriter = new CsvFileWriter(filesInfoConfig.OutputFile);
foreach (var jsonFile in filesInfoConfig.JsonFilesInfo)
{
var orderDTO = Newtonsoft.Json.JsonConvert.DeserializeObject<OrderDto>(File.ReadAllText(jsonFile.FullName));
var orderModel = new OrderModel(orderDTO);
csvFileWriter.writeOutRow(orderModel);
}
}
catch (DemoApplicationConfigurationException e)
{
Console.WriteLine(e.Message);
}
}
}
}