예제 #1
0
 public LOREvent(IEnumerable <BaseImporter.MappedDeviceDimmer> devices, LMS.channelsChannelEffect effect)
 {
     this.devices          = devices;
     base.endCentisecond   = effect.endCentisecond;
     base.endIntensity     = effect.endIntensity;
     base.intensity        = effect.intensity;
     base.startCentisecond = effect.startCentisecond;
     base.startIntensity   = effect.startIntensity;
     base.type             = effect.type;
 }
예제 #2
0
        private IEnumerable <ChannelEffect> GetChannelEffects(LMS.channelsChannelEffect effect)
        {
            int startMs = effect.startCentisecond * 10;
            int endMs   = effect.endCentisecond * 10;

            switch (effect.type)
            {
            case "intensity":
                if (!string.IsNullOrEmpty(effect.intensity))
                {
                    return(new List <ChannelEffect>()
                    {
                        new InstantChannelEffect
                        {
                            StartMs = startMs,
                            Brightness = double.Parse(effect.intensity) / 100.0
                        },
                        new InstantChannelEffect
                        {
                            StartMs = endMs,
                            Brightness = 0
                        }
                    });
                }
                else
                {
                    return(new List <ChannelEffect>()
                    {
                        new FadeChannelEffect
                        {
                            StartMs = startMs,
                            EndMs = endMs,
                            StartBrightness = double.Parse(effect.startIntensity) / 100.0,
                            EndBrightness = double.Parse(effect.endIntensity) / 100.0
                        }
                    });
                }

            case "shimmer":
                return(new List <ChannelEffect>()
                {
                    new ShimmerChannelEffect
                    {
                        StartMs = startMs,
                        EndMs = endMs
                    }
                });

            case "twinkle":
                if (!string.IsNullOrEmpty(effect.intensity))
                {
                    return new List <ChannelEffect>()
                           {
                               new TwinkleChannelEffect
                               {
                                   StartMs         = startMs,
                                   EndMs           = endMs,
                                   StartBrightness = double.Parse(effect.intensity) / 100.0,
                                   EndBrightness   = double.Parse(effect.intensity) / 100.0
                               }
                           }
                }
                ;
                else
                {
                    return new List <ChannelEffect>()
                           {
                               new TwinkleChannelEffect
                               {
                                   StartMs         = startMs,
                                   EndMs           = endMs,
                                   StartBrightness = double.Parse(effect.startIntensity) / 100.0,
                                   EndBrightness   = double.Parse(effect.endIntensity) / 100.0
                               }
                           }
                };

            default:
                throw new NotImplementedException("Unknown effect type " + effect.type);
            }
        }