private static void CreateMainOutputFile(VottMainObject vottMainObject) { var outputFileName = "vottMainObject-export.json"; var outputFilePath = Path.Combine(outputDirectory.FullName, outputFileName); using var streamWriter = File.CreateText(outputFilePath); using var jsonTextWriter = new JsonTextWriter(streamWriter) { Formatting = Formatting.Indented, Indentation = 4 }; new JsonSerializer().Serialize(jsonTextWriter, vottMainObject); }
static void Main(string[] args) { CreateOutputDirectory(); var inputDirectoryInfo = new DirectoryInfo(@"C:\Users\Andrey\Downloads\aerial-cars-dataset-master"); var images = GetImages(inputDirectoryInfo); var vottMainObject = new VottMainObject(); var counter = 0; foreach (var image in images) { counter++; Console.WriteLine($"{image.Name} has been found! #{counter}."); var vottObject = Converter.Convert(image.FullName); vottMainObject.Assets.Add(vottObject.Asset.Id, vottObject); CreateOutputFile(vottObject); Console.WriteLine($"{image.Name} has been processed!"); } CreateMainOutputFile(vottMainObject); Console.WriteLine($"Main output file has been created!"); }