public BurstOptions(IStoplight stoplight) { _stoplight = stoplight; var segment = new BurstSegment { Send = 1 }; _burstSegments = new[] { segment }; BurstPattern = segment.ToString(); }
public IEnumerable <string> GetArgValidationErrors() { if (string.IsNullOrWhiteSpace(BurstPattern)) { return(new[] { "invalid burstPattern: " + BurstPattern }); } _burstSegments = BurstSegment.ParseSegments(BurstPattern); return(Enumerable.Empty <string>()); }
private static BurstSegment Parse(string burstPattern, int index, int sindex, int windex, int rindex) { bool hasWait = windex > sindex; bool hasRepeat = rindex > sindex; var segment = new BurstSegment(); var substring = burstPattern.Substring(sindex + 1, (hasWait ? windex : hasRepeat ? rindex : index) - sindex - 1); segment.Send = int.Parse(substring); if (hasWait) { substring = burstPattern.Substring(windex + 1, (hasRepeat ? rindex : index) - windex - 1); segment.Wait = int.Parse(substring); } if (hasRepeat) { substring = burstPattern.Substring(rindex + 1, index - rindex - 1); segment.Repeat = int.Parse(substring); } return segment; }
private static BurstSegment Parse(string burstPattern, int index, int sindex, int windex, int rindex) { bool hasWait = windex > sindex; bool hasRepeat = rindex > sindex; var segment = new BurstSegment(); var substring = burstPattern.Substring(sindex + 1, (hasWait ? windex : hasRepeat ? rindex : index) - sindex - 1); segment.Send = int.Parse(substring); if (hasWait) { substring = burstPattern.Substring(windex + 1, (hasRepeat ? rindex : index) - windex - 1); segment.Wait = int.Parse(substring); } if (hasRepeat) { substring = burstPattern.Substring(rindex + 1, index - rindex - 1); segment.Repeat = int.Parse(substring); } return(segment); }