1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Added shape to led and improved layout-loading

This commit is contained in:
Darth Affe 2017-02-04 08:29:11 +01:00
parent bc8e5d54db
commit bdf446581e
9 changed files with 30 additions and 13 deletions

View File

@ -51,10 +51,10 @@ namespace RGB.NET.Core.Layout
public string Model { get; set; }
/// <summary>
/// Gets or sets the <see cref="LayoutShape"/> of the <see cref="DeviceLayout"/>.
/// Gets or sets the <see cref="Core.Shape"/> of the <see cref="DeviceLayout"/>.
/// </summary>
[XmlElement("Shape")]
public LayoutShape Shape { get; set; }
public Shape Shape { get; set; }
/// <summary>
/// Gets or sets the width of the <see cref="DeviceLayout"/>.

View File

@ -19,10 +19,10 @@ namespace RGB.NET.Core.Layout
public string Id { get; set; }
/// <summary>
/// Gets or sets the <see cref="LayoutShape"/> of the <see cref="LedLayout"/>.
/// Gets or sets the <see cref="RGB.NET.Core.Shape"/> of the <see cref="LedLayout"/>.
/// </summary>
[XmlElement("Shape")]
public LayoutShape Shape { get; set; }
public Shape Shape { get; set; }
/// <summary>
/// Gets or sets the x-position of the <see cref="LedLayout"/>.

View File

@ -22,6 +22,16 @@ namespace RGB.NET.Core
/// </summary>
public ILedId Id { get; }
private Shape _shape = Shape.Rectangle;
/// <summary>
/// Gets or sets the <see cref="Core.Shape"/> of the <see cref="Led"/>.
/// </summary>
public Shape Shape
{
get { return _shape; }
set { SetProperty(ref _shape, value); }
}
/// <summary>
/// Gets a rectangle representing the physical location of the <see cref="Led"/> relative to the <see cref="Device"/>.
/// </summary>

View File

@ -1,16 +1,22 @@
using System;
using RGB.NET.Core.Layout;
namespace RGB.NET.Core.Layout
namespace RGB.NET.Core
{
/// <summary>
/// Contains a list of different shapes used by <see cref="DeviceLayout"/>.
/// </summary>
[Serializable]
public enum LayoutShape
public enum Shape
{
/// <summary>
/// A simple rectangle.
/// </summary>
Rectangle = 0
Rectangle = 0,
/// <summary>
/// A simple circle.
/// </summary>
Circle = 1
}
}

View File

@ -49,7 +49,7 @@
<Compile Include="ColorCorrection\IColorCorrection.cs" />
<Compile Include="Devices\AbstractRGBDevice.cs" />
<Compile Include="Devices\RGBDeviceLighting.cs" />
<Compile Include="Devices\Layout\LayoutShape.cs" />
<Compile Include="Positioning\Shape.cs" />
<Compile Include="Devices\Layout\LedLayout.cs" />
<Compile Include="Devices\Layout\DeviceLayout.cs" />
<Compile Include="Devices\RGBDeviceType.cs" />

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using RGB.NET.Core;
using RGB.NET.Core.Layout;
@ -82,6 +80,8 @@ namespace RGB.NET.Devices.Corsair
led.LedRectangle.Location.Y = layoutLed.Y;
led.LedRectangle.Size.Width = layoutLed.Width;
led.LedRectangle.Size.Height = layoutLed.Height;
led.Shape = layoutLed.Shape;
}
}
}

View File

@ -34,6 +34,9 @@ namespace RGB.NET.Devices.Corsair
/// <inheritdoc />
public Uri Image { get; protected set; }
/// <inheritdoc />
public RGBDeviceLighting Lighting => RGBDeviceLighting.Key;
/// <summary>
/// Gets a flag that describes device capabilities. (<see cref="CorsairDeviceCaps" />)
/// </summary>

View File

@ -1,11 +1,9 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using System;
using System.IO;
using System.Reflection;
using RGB.NET.Core;
using RGB.NET.Core.Layout;
namespace RGB.NET.Devices.Corsair
{

View File

@ -59,7 +59,7 @@ namespace RGB.NET.Devices.Corsair
}
ApplyLayoutFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
$@"Layouts\Corsair\Keyboards\{KeyboardDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}\{KeyboardDeviceInfo.LogicalLayout.ToString().ToUpper()}.xml"));
$@"Layouts\Corsair\Keyboards\{KeyboardDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}\{KeyboardDeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"));
}
#endregion