예제 #1
0
        private void CreateDevices(Device[] devices)
        {
            var all = devices.Select(x => DeviceFactory.CreateDevice(this, x)).ToArray();

            var grouped = all.ToLookup(x => x.id.Split('_').First());

            Devices = grouped.Where(x => x.Count() == 1).Select(x => x.First())
                      .Concat(
                grouped.Where(x => x.Count() > 1).Select(x => DeviceFactory.CreateMultiDevice(x))
                )
                      .ToArray();

            deviceCache = all.ToDictionary(x => x.id);
        }