Exemplo n.º 1
0
        void AddJsonSequence(JsonObject jseq)
        {
            var name = jseq.GetOptionalPropertyAsStringOrNull("Name");
            var pmf  = new GlimPixelMap.Factory();

            // load devices and pixelmaps
            foreach (var jdev in jseq["Devices"].AsArray())
            {
                switch (jdev.ValueKind)
                {
                case JsonValueKind.String:
                    pmf.Add(Devices.FromJsonAlias(jdev));
                    break;

                case JsonValueKind.Object:
                    var jobj = jdev.AsObject();
                    pmf.Add(Devices.FromJsonAlias(jobj["Device"]), (int)jobj["PixelStart"].AsNumber(), (int)jobj["PixelCount"].AsNumber());
                    break;

                default:
                    throw new JsonKeyWrongTypeException(jdev, "Object", "String");
                }
            }
            // load effects
            var fx = new List <IFx>();

            foreach (var jfx in jseq["Effects"].AsArray())
            {
                fx.Add(JsonParseEffect(jfx.AsObject()));
            }
            Program.AddSequence(name, pmf.Compile(), fx);
        }
Exemplo n.º 2
0
        public override void SetDiscoveredDevices(IEnumerable <IGlimDevice> devices)
        {
            var gf = new GlimPixelMap.Factory();

            foreach (var d in devices)
            {
                var sd = new SequenceDeviceBasic(d.HostName, d.HostName, 300);
                mDevices.Add(sd);
                gf.Add(sd);
            }
            mPixelMap = gf.Compile();
        }