public async Task WriteVisitedSystems(string originSystem, SystemDetails[] systems)
        {
            var path = PathSanitizer.SanitizePath($"visited_{originSystem}.txt");

            await using var writer = new StreamWriter(path);
            int lines = 0;

            foreach (var sys in systems)
            {
                if (sys.Id64.HasValue)
                {
                    await writer.WriteLineAsync(sys.Id64.ToString());

                    ++lines;
                }
            }
            Console.WriteLine($"Generated {path} with {lines} systems.");
        }
示例#2
0
        public async Task WriteSystemList(string originSystem, SystemDetails[] systems, bool includeBodies, bool journeyPlotted)
        {
            var path = PathSanitizer.SanitizePath($"systems_{originSystem}.txt");

            await using var writer = new StreamWriter(path);

            await writer.WriteLineAsync(journeyPlotted?$"# distances calculated to previous system, starting from: {originSystem}" : $"# distances calculated to origin system: {originSystem}");

            foreach (var sys in systems)
            {
                var distance = journeyPlotted ? sys.PlottedDistance : sys.Ref.Distance;
                await WriteSystem(writer, sys, distance);

                if (includeBodies)
                {
                    foreach (var body in sys.FilteredBodies.OrderBy(b => b.DistanceToArrival))
                    {
                        await WriteBody(writer, body);
                    }
                }
            }

            Console.WriteLine($"Generated {path} with {systems.Length} systems.");
        }