コード例 #1
0
 internal void ApplyDevice(ArtemisDevice artemisDevice)
 {
     Device = artemisDevice;
     foreach (ArtemisLedLayout artemisLedLayout in Leds)
     {
         artemisLedLayout.ApplyDevice(Device);
     }
 }
コード例 #2
0
        internal void ApplyDevice(ArtemisDevice device)
        {
            Led = device.Leds.FirstOrDefault(d => d.RgbLed.Id.ToString() == RgbLayout.Id);
            if (Led != null)
            {
                Led.Layout = this;
            }

            ApplyCustomLedData(device);
        }
コード例 #3
0
ファイル: LayerAdapter.cs プロジェクト: Banky0014/Artemis
        /// <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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: ArtemisLed.cs プロジェクト: piechade/Artemis
 internal ArtemisLed(Led led, ArtemisDevice device)
 {
     RgbLed = led;
     Device = device;
     CalculateRectangles();
 }
コード例 #6
0
ファイル: LayerAdapter.cs プロジェクト: Banky0014/Artemis
 private bool DoesLayerCoverDevice(ArtemisDevice device)
 {
     return(device.Leds.All(l => Layer.Leds.Contains(l)));
 }
コード例 #7
0
 public ArtemisLed(Led led, ArtemisDevice device)
 {
     RgbLed = led;
     Device = device;
     CalculateRenderRectangle();
 }
コード例 #8
0
ファイル: DeviceEventArgs.cs プロジェクト: piechade/Artemis
 internal DeviceEventArgs(ArtemisDevice device)
 {
     Device = device;
 }
コード例 #9
0
 public ScaleColorCorrection(ArtemisDevice device)
 {
     _device = device;
 }