public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) { foreach (Colour colour in sectorElements.Colours) { if (!ColourValidator.IsValidColourInteger(colour.Value.ToString())) { events.AddEvent(new ValidationRuleFailure("Invalid colour value " + colour.Value, colour)); } } }
public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) { foreach (Label label in sectorElements.Labels) { if (!ColourValidator.ColourValid(sectorElements, label.Colour)) { string errorMessage = $"Invalid colour value {label.Colour} in label {label.Text}"; events.AddEvent(new ValidationRuleFailure(errorMessage, label)); } } }
public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) { foreach (Region region in sectorElements.Regions) { foreach (RegionPoint point in region.Points) { if (point.Colour != null && !ColourValidator.ColourValid(sectorElements, point.Colour)) { string errorMessage = $"Invalid colour value {point.Colour} for region {region.Name}"; events.AddEvent(new ValidationRuleFailure(errorMessage, point)); } } } }
public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) { foreach (SidStarRoute sid in sectorElements.SidRoutes) { foreach (RouteSegment segment in sid.Segments) { if (segment.Colour != null && !ColourValidator.ColourValid(sectorElements, segment.Colour)) { string errorMessage = $"Invalid colour value {segment.Colour} in route segment for SID {sid.Identifier}"; events.AddEvent(new ValidationRuleFailure(errorMessage, segment)); } } } }
private static bool ColourValid(string colour, SectorElementCollection sectorElements) { return(colour == null || ColourValidator.ColourValid(sectorElements, colour)); }