public Subsector ParseSubsector(TravellerMap map, string name, TextReader reader) { Subsector subsector = new Subsector(name); map.Add <Subsector>(subsector); WorldSECParser worldParser = new WorldSECParser(); string line = null; //int linecount = 0; bool startWorlds = false; while ((line = reader.ReadLine()) != null) { //linecount++; //if (linecount < 13) //continue; if (string.IsNullOrEmpty(line)) { continue; } else if (!startWorlds && line.StartsWith("....+")) { startWorlds = true; continue; } World world = worldParser.ParseWorld(map, line); subsector.Add(world); } return(subsector); }
public World ParseWorld(TravellerMap map, string line) { Match worldMatch = worldRegex.Match(line); if (!worldMatch.Success) { return(null); } string name = worldMatch.Groups["name"].Value.Trim(); string h = worldMatch.Groups["hex"].Value.Trim(); Hex hex = new Hex(h); string uwp = worldMatch.Groups["uwp"].Value.Trim(); World world = new World(name, hex, uwp); map.Add <World>(world); world.Base = worldMatch.Groups["base"].Value.Trim(); world.Codes = worldMatch.Groups["codes"].Value.Trim(); world.Zone = worldMatch.Groups["zone"].Value.Trim(); world.PBG = worldMatch.Groups["pbg"].Value.Trim(); world.Allegiance = worldMatch.Groups["allegiance"].Value.Trim(); world.StellarData = worldMatch.Groups["stellar"].Value.Trim(); return(world); }