Beispiel #1
0
        public override void Serialize(TextWriter writer, IEnumerable <World> worlds, SectorSerializeOptions options)
        {
            List <string> cols = new List <string> {
                "Hex",
                "Name",
                "UWP",
                "Remarks",
                "{Ix}",
                "(Ex)",
                "[Cx]",
                "N",
                "B",
                "Z",
                "PBG",
                "W",
                "A",
                "Stellar"
            };

            if (options.includeRoutes)
            {
                cols.Add("Routes");
            }

            ColumnSerializer formatter = new ColumnSerializer(cols);

            formatter.SetMinimumWidth("Name", 20);
            formatter.SetMinimumWidth("Remarks", 20);

            foreach (World world in worlds.OrderBy(world => world.SS))
            {
                List <string> row = new List <string> {
                    options.sscoords?world.SubsectorHex : world.Hex,
                           world.Name,
                           world.UWP,
                           world.Remarks,
                           world.Importance,
                           world.Economic,
                           world.Cultural,
                    DashIfEmpty(world.Nobility),
                    DashIfEmpty(world.Bases),
                    DashIfEmpty(world.Zone),
                    world.PBG,
                    world.Worlds > 0 ? world.Worlds.ToString() : "",
                    world.Allegiance,
                    world.Stellar
                };
                if (options.includeRoutes)
                {
                    row.Add(world.Routes);
                }
                formatter.AddRow(row);
            }
            formatter.Serialize(writer, options.includeHeader);
        }
Beispiel #2
0
        public override void Serialize(TextWriter writer, IEnumerable<World> worlds, bool includeHeader=true, bool sscoords=false)
        {
            ColumnSerializer formatter = new ColumnSerializer(new string[] {
                "Hex",
                "Name",
                "UWP",
                "Remarks",
                "{Ix}",
                "(Ex)",
                "[Cx]",
                "N",
                "B",
                "Z",
                "PBG",
                "W",
                "A",
                "Stellar"
            });

            formatter.SetMinimumWidth("Name", 20);
            formatter.SetMinimumWidth("Remarks", 20);

            foreach (World world in worlds.OrderBy(world => world.SS))
            {
                formatter.AddRow(new string[] {
                    sscoords ? world.SubsectorHex : world.Hex,
                    world.Name,
                    world.UWP,
                    world.Remarks,
                    world.Importance,
                    world.Economic,
                    world.Cultural,
                    DashIfEmpty(world.Nobility),
                    DashIfEmpty(world.Bases),
                    DashIfEmpty(world.Zone),
                    world.PBG,
                    world.Worlds > 0 ? world.Worlds.ToString() : "",
                    world.Allegiance,
                    world.Stellar
                });
            }
            formatter.Serialize(writer, includeHeader);
        }
Beispiel #3
0
        public override void Serialize(TextWriter writer, IEnumerable <World> worlds, bool includeHeader = true, bool sscoords = false)
        {
            ColumnSerializer formatter = new ColumnSerializer(new string[] {
                "Hex",
                "Name",
                "UWP",
                "Remarks",
                "{Ix}",
                "(Ex)",
                "[Cx]",
                "N",
                "B",
                "Z",
                "PBG",
                "W",
                "A",
                "Stellar"
            });

            formatter.SetMinimumWidth("Name", 20);
            formatter.SetMinimumWidth("Remarks", 20);

            foreach (World world in worlds.OrderBy(world => world.SS))
            {
                formatter.AddRow(new string[] {
                    sscoords?world.SubsectorHex: world.Hex,
                    world.Name,
                    world.UWP,
                    world.Remarks,
                    world.Importance,
                    world.Economic,
                    world.Cultural,
                    DashIfEmpty(world.Nobility),
                    DashIfEmpty(world.Bases),
                    DashIfEmpty(world.Zone),
                    world.PBG,
                    world.Worlds > 0 ? world.Worlds.ToString() : "",
                    world.Allegiance,
                    world.Stellar
                });
            }
            formatter.Serialize(writer, includeHeader);
        }