internal void ApplyDevice(ArtemisDevice artemisDevice) { Device = artemisDevice; foreach (ArtemisLedLayout artemisLedLayout in Leds) { artemisLedLayout.ApplyDevice(Device); } }
internal void ApplyDevice(ArtemisDevice device) { Led = device.Leds.FirstOrDefault(d => d.RgbLed.Id.ToString() == RgbLayout.Id); if (Led != null) { Led.Layout = this; } ApplyCustomLedData(device); }
/// <summary> /// Automatically determine hints for this layer /// </summary> public List <IAdaptionHint> DetermineHints(IEnumerable <ArtemisDevice> devices) { List <IAdaptionHint> newHints = new(); if (devices.All(DoesLayerCoverDevice)) { DeviceAdaptionHint hint = new() { DeviceType = RGBDeviceType.All }; AdaptionHints.Add(hint); newHints.Add(hint); } else { // Any fully covered device will add a device adaption hint for that type foreach (IGrouping <ArtemisDevice, ArtemisLed> deviceLeds in Layer.Leds.GroupBy(l => l.Device)) { ArtemisDevice device = deviceLeds.Key; // If there is already an adaption hint for this type, don't add another if (AdaptionHints.Any(h => h is DeviceAdaptionHint d && d.DeviceType == device.RgbDevice.DeviceInfo.DeviceType)) { continue; } if (DoesLayerCoverDevice(device)) { DeviceAdaptionHint hint = new() { DeviceType = device.RgbDevice.DeviceInfo.DeviceType }; AdaptionHints.Add(hint); newHints.Add(hint); } } // Any fully covered category will add a category adaption hint for its category foreach (DeviceCategory deviceCategory in Enum.GetValues <DeviceCategory>()) { if (AdaptionHints.Any(h => h is CategoryAdaptionHint c && c.Category == deviceCategory)) { continue; } List <ArtemisDevice> categoryDevices = devices.Where(d => d.Categories.Contains(deviceCategory)).ToList(); if (categoryDevices.Any() && categoryDevices.All(DoesLayerCoverDevice)) { CategoryAdaptionHint hint = new() { Category = deviceCategory }; AdaptionHints.Add(hint); newHints.Add(hint); } } } return(newHints); }
private void ApplyCustomLedData(ArtemisDevice artemisDevice) { if (LayoutCustomLedData.LogicalLayouts == null || !LayoutCustomLedData.LogicalLayouts.Any()) { return; } Uri layoutDirectory = new(Path.GetDirectoryName(DeviceLayout.FilePath) !+"\\", UriKind.Absolute); // Prefer a matching layout or else a default layout (that has no name) LayoutCustomLedDataLogicalLayout logicalLayout = LayoutCustomLedData.LogicalLayouts .OrderBy(l => l.Name == artemisDevice.LogicalLayout) .ThenBy(l => l.Name == null) .First(); LogicalName = logicalLayout.Name; Image = new Uri(layoutDirectory, logicalLayout.Image); }
internal ArtemisLed(Led led, ArtemisDevice device) { RgbLed = led; Device = device; CalculateRectangles(); }
private bool DoesLayerCoverDevice(ArtemisDevice device) { return(device.Leds.All(l => Layer.Leds.Contains(l))); }
public ArtemisLed(Led led, ArtemisDevice device) { RgbLed = led; Device = device; CalculateRenderRectangle(); }
internal DeviceEventArgs(ArtemisDevice device) { Device = device; }
public ScaleColorCorrection(ArtemisDevice device) { _device = device; }