public CompositeLightSectionBuilder(LightSectionBuilder lightSectionBuilder, CompositeLightBuilder compositeLightBuilder)
 {
     this.lightSectionBuilder = lightSectionBuilder;
       sidePercentageOnDiagonal = -1;
       this.compositeLightBuilder = compositeLightBuilder;
       fadeTime = ChromesthesiaConfig.LightFadeTime;
 }
        public LightSection Migrate(LightSectionV1 oldLightSection)
        {
            if (oldLightSection == null)
              {
            return null;
              }

              var newLightSectionBuilder = new LightSectionBuilder();

              foreach (var direction in EnumExtensions.GetCompassDirections())
              {
            var oldLight = (LightV1)oldLightSection.GetComponentValueInDirection(direction);
            if (oldLight == null)
            {
              continue;
            }

            var newLight = new Light()
            {
              Red = oldLight.Red,
              Green = oldLight.Green,
              Blue = oldLight.Blue,
              FadeTime = oldLight.FadeTime
            };
            newLightSectionBuilder.WithLightInDirection(direction, newLight);
              }

              return newLightSectionBuilder.Build();
        }
        public void FrameStatistics_RecordsSceneLength()
        {
            var lightSection = new LightSectionBuilder()
            .WithAllLights(arbitraryLight)
            .Build();
              var frames = new FrameBuilder()
            .AddFrame()
            .WithFrameLength(1000)
            .WithRepeated(false)
            .WithLightSection(lightSection)
            .AddFrame()
            .WithFrameLength(500)
            .WithRepeated(false)
            .WithLightSection(lightSection)
            .Build();
              var stats = new FrameStatistics(frames);

              Assert.AreEqual(frames.Sum(frame => frame.Length), stats.SceneLength);
        }
        public void FrameStatistics_ContainsNoDuplicates()
        {
            var lightSection = new LightSectionBuilder()
            .WithAllLights(arbitraryLight)
            .Build();
              var frames = new FrameBuilder()
            .AddFrame()
            .WithFrameLength(1000)
            .WithRepeated(false)
            .WithLightSection(lightSection)
            .AddFrame()
            .WithFrameLength(1000)
            .WithRepeated(false)
            .WithLightSection(lightSection)
            .Build();
              var stats = new FrameStatistics(frames);

              Assert.AreEqual(8, stats.EnabledDirectionalComponents.Count);
        }
        public void FrameStatistics_ContainsExpectedComponentType()
        {
            var lightSection = new LightSectionBuilder()
            .WithLightInDirection(eDirection.North, arbitraryLight)
            .Build();
              var frames = new FrameBuilder()
            .AddFrame()
            .WithFrameLength(1000)
            .WithRepeated(false)
            .WithLightSection(lightSection)
            .Build();
              var stats = new FrameStatistics(frames);

              Assert.IsTrue(stats.AreEnabledForComponent(eComponentType.Light));
              Assert.IsFalse(stats.AreEnabledForComponent(eComponentType.Fan));
              Assert.IsFalse(stats.AreEnabledForComponent(eComponentType.Rumble));

              Assert.IsTrue(stats.AreEnabledForComponentAndDirection(new DirectionalComponent(eComponentType.Light, eDirection.North)));
              Assert.AreEqual(1, stats.EnabledDirectionalComponents.Count());
        }
 public MorseFrameBuilder(LightSectionBuilder lightSectionBuilder, RumbleSectionBuilder rumbleSectionBuilder)
 {
     this.lightSectionBuilder = lightSectionBuilder;
       this.rumbleSectionBuilder = rumbleSectionBuilder;
 }
 public void Setup()
 {
     sectionBuilder = new LightSectionBuilder();
 }