private static void Run(Options options) { var a = Fleet.TryLoad(options.PathA); if (a == null) { Console.WriteLine("**Failed to load fleet A**"); return; } var b = Fleet.TryLoad(options.PathB); if (b == null) { Console.WriteLine("**Failed to load fleet B**"); return; } var sim = new Simulation(a, Path.GetFileNameWithoutExtension(options.PathA), b, Path.GetFileNameWithoutExtension(options.PathB)); Console.WriteLine("Created Scene"); Report?report; using (var loga = File.CreateText("CaptainsLog_A.txt")) using (var logb = File.CreateText("CaptainsLog_B.txt")) { sim.AddLog(0, loga); sim.AddLog(1, logb); report = sim.Run(); } Console.WriteLine(report); var output = options.OutputPath ?? "output.json.deflate"; using (var file = File.Create(output)) using (var zip = new DeflateStream(file, CompressionLevel.Optimal)) using (var stream = new StreamWriter(zip)) using (var writer = new JsonTextWriter(stream) { Formatting = Formatting.None }) { report.Serialize(writer); writer.Flush(); Console.WriteLine($"File Size (Compressed): {ToFileSize(file.Position)}"); } #if DEBUG using (var file = File.Create("output.json")) using (var stream = new StreamWriter(file)) using (var writer = new JsonTextWriter(stream) { Formatting = Formatting.Indented }) { report.Serialize(writer); writer.Flush(); Console.WriteLine($"File Size (Uncompressed): {ToFileSize(file.Position)}"); } #endif }