コード例 #1
0
        public void LedStateErrorsWhenOutOfRangeIndexIsUsed()
        {
            var state = new LedState();
            var outOfRangeIndex = state.Length + 1;

            state[outOfRangeIndex] = true;
        }
コード例 #2
0
        public void LedStateIndexerSetsCorrectBit()
        {
            var state = new LedState();
            Assert.AreEqual(0, state.LedRawBits);

            state[0] = true;
            state[7] = true;

            Assert.AreEqual(0x81, state.LedRawBits);
        }
コード例 #3
0
 public FullColorLiveFrame()
 {
     Colors = new List<RgbColor>();
     Leds = new LedState();
 }
コード例 #4
0
ファイル: Parser.cs プロジェクト: TransistorLabs/GlowBeanGlow
        private LedState ProcessLedStateArray()
        {
            var ledState = new LedState();
            AssertParameterSeparator();

            var arryStartToken = GetNextToken();
            AssertValid(arryStartToken, "expected: [\n\tNote: this can also be a array constant",
                        x => x.Type == TokenType.StartArray);

            Token nextToken;
            do
            {
                nextToken = GetNextToken();
                AssertValid(nextToken, "expected: numeric value, comma (,) or ]",
                            (x => x.Type == TokenType.Keyword || x.Type == TokenType.EndArray || x.Type == TokenType.EndParameterValue));

                if (nextToken.Type == TokenType.Keyword)
                {
                    int value = 0;
                    if (int.TryParse(nextToken.RawValue, out value))
                    {
                        ledState[value] = true;
                    }
                }
            } while (nextToken.Type != TokenType.EndArray);

            return ledState;
        }
コード例 #5
0
 public SetFrameInstruction()
 {
     Leds = new LedState();
     Color = new RgbColor();
 }
コード例 #6
0
 public LiveFrame()
 {
     Leds = new LedState();
     Color = new RgbColor();
 }