コード例 #1
0
 public BurstOptions(IStoplight stoplight)
 {
     _stoplight = stoplight;
     var segment = new BurstSegment { Send = 1 };
     _burstSegments = new[] { segment };
     BurstPattern = segment.ToString();
 }
コード例 #2
0
 public IEnumerable <string> GetArgValidationErrors()
 {
     if (string.IsNullOrWhiteSpace(BurstPattern))
     {
         return(new[] { "invalid burstPattern: " + BurstPattern });
     }
     _burstSegments = BurstSegment.ParseSegments(BurstPattern);
     return(Enumerable.Empty <string>());
 }
コード例 #3
0
        public BurstOptions(IStoplight stoplight)
        {
            _stoplight = stoplight;
            var segment = new BurstSegment {
                Send = 1
            };

            _burstSegments = new[] { segment };
            BurstPattern   = segment.ToString();
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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);
        }