Code cleanup

This commit is contained in:
DarthAffe committed 2016-09-10 18:06:07 +02:00
1 parent f8c537aaff
commit 8390c7da68
22 files changed
+146 -116

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ using CUE.NET.Groups.Extensions;
namespace CUE.NET.Groups
{
/// <summary>
/// Represents a basic keygroup.
/// Represents a basic ledgroup.
/// </summary>
public abstract class AbstractLedGroup : AbstractEffectTarget<ILedGroup>, ILedGroup
{
@@ -30,7 +30,7 @@ namespace CUE.NET.Groups
public IBrush Brush { get; set; }
/// <summary>
/// Gets or sets the z-index of this keygroup to allow ordering them before drawing. (lowest first) (default: 0)
/// Gets or sets the z-index of this ledgroup to allow ordering them before drawing. (lowest first) (default: 0)
/// </summary>
public int ZIndex { get; set; } = 0;
+3 -3
View File
@@ -16,7 +16,7 @@ namespace CUE.NET.Groups.Extensions
/// </summary>
/// <param name="ledGroup">The <see cref="AbstractLedGroup" /> to convert.</param>
/// <returns>The converted <see cref="ListLedGroup" />.</returns>
public static ListLedGroup ToSimpleKeyGroup(this AbstractLedGroup ledGroup)
public static ListLedGroup ToSimpleLedGroup(this AbstractLedGroup ledGroup)
{
ListLedGroup simpleLedGroup = ledGroup as ListLedGroup;
if (simpleLedGroup == null)
@@ -35,7 +35,7 @@ namespace CUE.NET.Groups.Extensions
/// <returns>The new <see cref="ListLedGroup" />.</returns>
public static ListLedGroup Exclude(this AbstractLedGroup ledGroup, params CorsairLedId[] ledIds)
{
ListLedGroup simpleLedGroup = ledGroup.ToSimpleKeyGroup();
ListLedGroup simpleLedGroup = ledGroup.ToSimpleLedGroup();
foreach (CorsairLedId ledId in ledIds)
simpleLedGroup.RemoveLed(ledId);
return simpleLedGroup;
@@ -49,7 +49,7 @@ namespace CUE.NET.Groups.Extensions
/// <returns>The new <see cref="ListLedGroup" />.</returns>
public static ListLedGroup Exclude(this AbstractLedGroup ledGroup, params CorsairLed[] ledIds)
{
ListLedGroup simpleLedGroup = ledGroup.ToSimpleKeyGroup();
ListLedGroup simpleLedGroup = ledGroup.ToSimpleLedGroup();
foreach (CorsairLed led in ledIds)
simpleLedGroup.RemoveLed(led);
return simpleLedGroup;
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CUE.NET.Groups
IBrush Brush { get; set; }
/// <summary>
/// Gets or sets the z-index of this keygroup to allow ordering them before drawing. (lowest first) (default: 0)
/// Gets or sets the z-index of this ledgroup to allow ordering them before drawing. (lowest first) (default: 0)
/// </summary>
int ZIndex { get; set; }
+21 -17
View File
@@ -126,10 +126,10 @@ namespace CUE.NET.Groups
/// <summary>
/// Adds the given LED(s) to the ledgroup.
/// </summary>
/// <param name="LEDs">The LED(s) to add.</param>
public void AddLed(params CorsairLed[] LEDs)
/// <param name="leds">The LED(s) to add.</param>
public void AddLed(params CorsairLed[] leds)
{
AddLeds(LEDs);
AddLeds(leds);
}
/// <summary>
@@ -147,10 +147,11 @@ namespace CUE.NET.Groups
/// <param name="leds">The LEDs to add.</param>
public void AddLeds(IEnumerable<CorsairLed> leds)
{
if (leds != null)
foreach (CorsairLed led in leds)
if (led != null && !ContainsLed(led))
GroupLeds.Add(led);
if (leds == null) return;
foreach (CorsairLed led in leds)
if (led != null && !ContainsLed(led))
GroupLeds.Add(led);
}
/// <summary>
@@ -159,9 +160,10 @@ namespace CUE.NET.Groups
/// <param name="ledIds">The IDs of the LEDs to add.</param>
public void AddLeds(IEnumerable<CorsairLedId> ledIds)
{
if (ledIds != null)
foreach (CorsairLedId ledId in ledIds)
AddLed(Device[ledId]);
if (ledIds == null) return;
foreach (CorsairLedId ledId in ledIds)
AddLed(Device[ledId]);
}
/// <summary>
@@ -188,10 +190,11 @@ namespace CUE.NET.Groups
/// <param name="leds">The LEDs to remove.</param>
public void RemoveLeds(IEnumerable<CorsairLed> leds)
{
if (leds != null)
foreach (CorsairLed led in leds)
if (led != null)
GroupLeds.Remove(led);
if (leds == null) return;
foreach (CorsairLed led in leds)
if (led != null)
GroupLeds.Remove(led);
}
/// <summary>
@@ -200,9 +203,10 @@ namespace CUE.NET.Groups
/// <param name="ledIds">The IDs of the LEDs to remove.</param>
public void RemoveLeds(IEnumerable<CorsairLedId> ledIds)
{
if (ledIds != null)
foreach (CorsairLedId ledId in ledIds)
RemoveLed(Device[ledId]);
if (ledIds == null) return;
foreach (CorsairLedId ledId in ledIds)
RemoveLed(Device[ledId]);
}
/// <summary>